Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNathan Fritz <fritzy@github.com>2022-03-02 20:51:41 +0300
committerGitHub <noreply@github.com>2022-03-02 20:51:41 +0300
commita0900bdf1ab7a68988984735f1f3885d02ffb67f (patch)
treeab3a5f190d67d83d109abd4fb2412fdb486359ec /test
parent45fc297f12e63c026715945a186ba0ec4efbdedb (diff)
fix(ls): respect `--include-workspace-root` (#4481)
Diffstat (limited to 'test')
-rw-r--r--test/lib/commands/ls.js11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/lib/commands/ls.js b/test/lib/commands/ls.js
index 1cbcb593f..9fd4db167 100644
--- a/test/lib/commands/ls.js
+++ b/test/lib/commands/ls.js
@@ -1384,6 +1384,7 @@ t.test('ls', t => {
name: 'workspaces-tree',
version: '1.0.0',
workspaces: ['./a', './b', './d', './group/*'],
+ dependencies: { pacote: '1.0.0' },
}),
node_modules: {
a: t.fixture('symlink', '../a'),
@@ -1412,6 +1413,9 @@ t.test('ls', t => {
baz: {
'package.json': JSON.stringify({ name: 'baz', version: '1.0.0' }),
},
+ pacote: {
+ 'package.json': JSON.stringify({ name: 'pacote', version: '1.0.0' }),
+ },
},
a: {
'package.json': JSON.stringify({
@@ -1469,6 +1473,7 @@ t.test('ls', t => {
npm.flatOptions.workspacesEnabled = false
await ls.exec([])
t.matchSnapshot(redactCwd(result), 'should not list workspaces with --no-workspaces')
+
config.all = true
config.depth = Infinity
npm.color = false
@@ -1495,6 +1500,12 @@ t.test('ls', t => {
t.matchSnapshot(redactCwd(result), 'should filter using workspace config')
+ // filter out a single workspace and include root
+ npm.flatOptions.includeWorkspaceRoot = true
+ await ls.execWorkspaces([], ['d'])
+ t.matchSnapshot(redactCwd(result), 'should inlude root and specified workspace')
+ npm.flatOptions.includeWorkspaceRoot = false
+
// filter out a workspace by parent path
await ls.execWorkspaces([], ['./group'])