summaryrefslogtreecommitdiff
path: root/deps/npm/test/lib/ls.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/test/lib/ls.js')
-rw-r--r--deps/npm/test/lib/ls.js1944
1 files changed, 976 insertions, 968 deletions
diff --git a/deps/npm/test/lib/ls.js b/deps/npm/test/lib/ls.js
index 6a91e8c352..256ebf3534 100644
--- a/deps/npm/test/lib/ls.js
+++ b/deps/npm/test/lib/ls.js
@@ -7,28 +7,28 @@ t.cleanSnapshot = str => str.split(/\r\n/).join('\n')
const simpleNmFixture = {
node_modules: {
- 'foo': {
+ foo: {
'package.json': JSON.stringify({
name: 'foo',
version: '1.0.0',
dependencies: {
- 'bar': '^1.0.0'
- }
- })
+ bar: '^1.0.0',
+ },
+ }),
},
- 'bar': {
+ bar: {
'package.json': JSON.stringify({
name: 'bar',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
- 'lorem': {
+ lorem: {
'package.json': JSON.stringify({
name: 'lorem',
- version: '1.0.0'
- })
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
}
const diffDepTypesNmFixture = {
@@ -39,9 +39,9 @@ const diffDepTypesNmFixture = {
description: 'A DEV dep kind of dep',
version: '1.0.0',
dependencies: {
- 'foo': '^1.0.0'
- }
- })
+ foo: '^1.0.0',
+ },
+ }),
},
'prod-dep': {
'package.json': JSON.stringify({
@@ -49,35 +49,35 @@ const diffDepTypesNmFixture = {
description: 'A PROD dep kind of dep',
version: '1.0.0',
dependencies: {
- 'bar': '^2.0.0'
- }
+ bar: '^2.0.0',
+ },
}),
node_modules: {
bar: {
'package.json': JSON.stringify({
name: 'bar',
description: 'A dep that bars',
- version: '2.0.0'
- })
- }
- }
+ version: '2.0.0',
+ }),
+ },
+ },
},
'optional-dep': {
'package.json': JSON.stringify({
name: 'optional-dep',
description: 'Maybe a dep?',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
'peer-dep': {
'package.json': JSON.stringify({
name: 'peer-dep',
description: 'Peer-dep description here',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
- ...simpleNmFixture.node_modules
- }
+ ...simpleNmFixture.node_modules,
+ },
}
let prefix
@@ -95,24 +95,32 @@ const _flatOptions = {
link: false,
only: null,
parseable: false,
- get prefix () { return prefix },
- production: false
+ get prefix () {
+ return prefix
+ },
+ production: false,
}
const ls = requireInject('../../lib/ls.js', {
'../../lib/npm.js': {
flatOptions: _flatOptions,
limit: {
- fetch: 3
+ fetch: 3,
+ },
+ get prefix () {
+ return _flatOptions.prefix
+ },
+ get globalDir () {
+ return globalDir
},
- get prefix () { return _flatOptions.prefix },
- get globalDir () { return globalDir },
config: {
get (key) {
return _flatOptions[key]
- }
- }
+ },
+ },
+ },
+ '../../lib/utils/output.js': msg => {
+ result = msg
},
- '../../lib/utils/output.js': msg => { result = msg }
})
const redactCwd = res =>
@@ -136,10 +144,10 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -150,7 +158,7 @@ t.test('ls', (t) => {
t.test('missing package.json', (t) => {
prefix = t.testdir({
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
@@ -169,10 +177,10 @@ t.test('ls', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- foo: '^1.0.0'
- }
+ foo: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
@@ -194,10 +202,10 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['lorem'], (err) => {
t.ifError(err, 'npm ls')
@@ -216,10 +224,10 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- ipsum: '^1.0.0'
- }
+ ipsum: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['.'], (err) => {
t.ifError(err, 'should not throw on missing dep above current level')
@@ -237,10 +245,10 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['bar'], (err) => {
t.ifError(err, 'npm ls')
@@ -257,18 +265,18 @@ t.test('ls', (t) => {
dependencies: {
foo: '^1.0.0',
lorem: '^1.0.0',
- ipsum: '^1.0.0'
- }
+ ipsum: '^1.0.0',
+ },
}),
node_modules: {
...simpleNmFixture.node_modules,
ipsum: {
'package.json': JSON.stringify({
name: 'ipsum',
- version: '1.0.0'
- })
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
})
ls(['bar@*', 'lorem@1.0.0'], (err) => {
t.ifError(err, 'npm ls')
@@ -284,10 +292,10 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['notadep'], (err) => {
t.ifError(err, 'npm ls')
@@ -311,10 +319,10 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -334,10 +342,10 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -357,8 +365,8 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
a: '^1.0.0',
- e: '^1.0.0'
- }
+ e: '^1.0.0',
+ },
}),
node_modules: {
a: {
@@ -366,9 +374,9 @@ t.test('ls', (t) => {
name: 'a',
version: '1.0.0',
dependencies: {
- b: '^1.0.0'
- }
- })
+ b: '^1.0.0',
+ },
+ }),
},
b: {
'package.json': JSON.stringify({
@@ -376,29 +384,29 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
c: '^1.0.0',
- d: '*'
- }
- })
+ d: '*',
+ },
+ }),
},
c: {
'package.json': JSON.stringify({
name: 'c',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
d: {
'package.json': JSON.stringify({
name: 'd',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
e: {
'package.json': JSON.stringify({
name: 'e',
- version: '1.0.0'
- })
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -416,10 +424,10 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^2.0.0',
- ipsum: '^1.0.0'
- }
+ ipsum: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
@@ -443,10 +451,10 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
foo: '^2.0.0',
- ipsum: '^1.0.0'
- }
+ ipsum: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
@@ -464,19 +472,19 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing dev deps')
@@ -493,19 +501,19 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing only development deps')
@@ -522,29 +530,29 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0',
- 'linked-dep': '^1.0.0'
+ lorem: '^1.0.0',
+ 'linked-dep': '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
'linked-dep': {
'package.json': JSON.stringify({
name: 'linked-dep',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
node_modules: {
'linked-dep': t.fixture('symlink', '../linked-dep'),
- ...diffDepTypesNmFixture.node_modules
- }
+ ...diffDepTypesNmFixture.node_modules,
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing linked deps')
@@ -559,15 +567,15 @@ t.test('ls', (t) => {
name: 'print-deduped-symlinks',
version: '1.0.0',
dependencies: {
- 'a': '^1.0.0',
- 'b': '^1.0.0'
- }
+ a: '^1.0.0',
+ b: '^1.0.0',
+ },
}),
- 'b': {
+ b: {
'package.json': JSON.stringify({
name: 'b',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
node_modules: {
a: {
@@ -575,12 +583,12 @@ t.test('ls', (t) => {
name: 'a',
version: '1.0.0',
dependencies: {
- b: '^1.0.0'
- }
- })
+ b: '^1.0.0',
+ },
+ }),
},
- 'b': t.fixture('symlink', '../b')
- }
+ b: t.fixture('symlink', '../b'),
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing linked deps')
@@ -597,19 +605,19 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing production deps')
@@ -626,19 +634,19 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing only prod deps')
@@ -655,19 +663,19 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree info with descriptions')
@@ -686,19 +694,19 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing top-level deps with descriptions')
@@ -711,7 +719,7 @@ t.test('ls', (t) => {
t.test('json read problems', (t) => {
prefix = t.testdir({
- 'package.json': '{broken json'
+ 'package.json': '{broken json',
})
ls([], (err) => {
t.match(err, { code: 'EJSONPARSE' }, 'should throw EJSONPARSE error')
@@ -736,19 +744,19 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^2.0.0' // mismatching version #
- }
+ 'peer-dep': '^2.0.0', // mismatching version #
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree signaling mismatching peer dep in problems')
@@ -763,9 +771,9 @@ t.test('ls', (t) => {
name: 'invalid-deduped-dep',
version: '1.0.0',
dependencies: {
- 'a': '^1.0.0',
- 'b': '^2.0.0'
- }
+ a: '^1.0.0',
+ b: '^2.0.0',
+ },
}),
node_modules: {
a: {
@@ -773,17 +781,17 @@ t.test('ls', (t) => {
name: 'a',
version: '1.0.0',
dependencies: {
- b: '^2.0.0'
- }
- })
+ b: '^2.0.0',
+ },
+ }),
},
b: {
'package.json': JSON.stringify({
name: 'b',
- version: '1.0.0'
- })
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree signaling mismatching peer dep in problems')
@@ -798,9 +806,9 @@ t.test('ls', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'a': '^1.0.0',
- 'b': '^1.0.0'
- }
+ a: '^1.0.0',
+ b: '^1.0.0',
+ },
}),
node_modules: {
a: {
@@ -808,11 +816,11 @@ t.test('ls', (t) => {
name: 'a',
version: '1.0.0',
dependencies: {
- b: '^1.0.0'
- }
- })
- }
- }
+ b: '^1.0.0',
+ },
+ }),
+ },
+ },
})
ls([], (err) => {
t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
@@ -828,9 +836,9 @@ t.test('ls', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
peerDependencies: {
- 'peer-dep': '*'
- }
- })
+ 'peer-dep': '*',
+ },
+ }),
})
ls([], (err) => {
t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
@@ -848,20 +856,20 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
'missing-optional-dep': '^1.0.0',
- 'optional-dep': '^2.0.0' // mismatching version #
+ 'optional-dep': '^2.0.0', // mismatching version #
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], (err) => {
t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
@@ -878,29 +886,29 @@ t.test('ls', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'a': '^1.0.0'
- }
+ a: '^1.0.0',
+ },
}),
node_modules: {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: 'a',
version: '1.0.0',
dependencies: {
- b: '^1.0.0'
- }
- })
+ b: '^1.0.0',
+ },
+ }),
},
- 'b': {
+ b: {
'package.json': JSON.stringify({
name: 'b',
version: '1.0.0',
dependencies: {
- a: '^1.0.0'
- }
- })
- }
- }
+ a: '^1.0.0',
+ },
+ }),
+ },
+ },
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -916,29 +924,29 @@ t.test('ls', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'a': '^1.0.0'
- }
+ a: '^1.0.0',
+ },
}),
node_modules: {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: 'a',
version: '1.0.0',
dependencies: {
- b: '^1.0.0'
- }
- })
+ b: '^1.0.0',
+ },
+ }),
},
- 'b': {
+ b: {
'package.json': JSON.stringify({
name: 'b',
version: '1.0.0',
dependencies: {
- a: '^1.0.0'
- }
- })
- }
- }
+ a: '^1.0.0',
+ },
+ }),
+ },
+ },
})
ls(['a'], (err) => {
t.ifError(err, 'npm ls')
@@ -956,37 +964,37 @@ t.test('ls', (t) => {
dependencies: {
'@npmcli/a': '^1.0.0',
'@npmcli/b': '^1.0.0',
- '@npmcli/c': '^1.0.0'
- }
+ '@npmcli/c': '^1.0.0',
+ },
}),
node_modules: {
'@npmcli': {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: '@npmcli/a',
version: '1.0.0',
dependencies: {
- '@npmcli/b': '^1.0.0'
- }
- })
+ '@npmcli/b': '^1.0.0',
+ },
+ }),
},
- 'b': {
+ b: {
'package.json': JSON.stringify({
name: '@npmcli/b',
- version: '1.1.2'
- })
+ version: '1.1.2',
+ }),
},
- 'c': {
+ c: {
'package.json': JSON.stringify({
name: '@npmcli/c',
version: '1.0.0',
dependencies: {
- '@npmcli/b': '^1.0.0'
- }
- })
- }
- }
- }
+ '@npmcli/b': '^1.0.0',
+ },
+ }),
+ },
+ },
+ },
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -1005,37 +1013,37 @@ t.test('ls', (t) => {
dependencies: {
'@npmcli/a': '^1.0.0',
'@npmcli/b': '^1.0.0',
- '@npmcli/c': '^1.0.0'
- }
+ '@npmcli/c': '^1.0.0',
+ },
}),
node_modules: {
'@npmcli': {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: '@npmcli/a',
version: '1.0.0',
dependencies: {
- '@npmcli/b': '^1.0.0'
- }
- })
+ '@npmcli/b': '^1.0.0',
+ },
+ }),
},
- 'b': {
+ b: {
'package.json': JSON.stringify({
name: '@npmcli/b',
- version: '1.1.2'
- })
+ version: '1.1.2',
+ }),
},
- 'c': {
+ c: {
'package.json': JSON.stringify({
name: '@npmcli/c',
version: '1.0.0',
dependencies: {
- '@npmcli/b': '^1.0.0'
- }
- })
- }
- }
- }
+ '@npmcli/b': '^1.0.0',
+ },
+ }),
+ },
+ },
+ },
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -1055,37 +1063,37 @@ t.test('ls', (t) => {
dependencies: {
'@npmcli/a': '^1.0.0',
'@npmcli/b': '^1.0.0',
- '@npmcli/c': '^1.0.0'
- }
+ '@npmcli/c': '^1.0.0',
+ },
}),
node_modules: {
'@npmcli': {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: '@npmcli/a',
version: '1.0.0',
dependencies: {
- '@npmcli/b': '^1.0.0'
- }
- })
+ '@npmcli/b': '^1.0.0',
+ },
+ }),
},
- 'b': {
+ b: {
'package.json': JSON.stringify({
name: '@npmcli/b',
- version: '1.1.2'
- })
+ version: '1.1.2',
+ }),
},
- 'c': {
+ c: {
'package.json': JSON.stringify({
name: '@npmcli/c',
version: '1.0.0',
dependencies: {
- '@npmcli/b': '^1.0.0'
- }
- })
- }
- }
- }
+ '@npmcli/b': '^1.0.0',
+ },
+ }),
+ },
+ },
+ },
})
ls(['@npmcli/b'], (err) => {
t.ifError(err, 'npm ls')
@@ -1103,37 +1111,37 @@ t.test('ls', (t) => {
dependencies: {
'@npmcli/a': '^1.0.0',
'@npmcli/b': '^1.0.0',
- '@npmcli/c': '^1.0.0'
- }
+ '@npmcli/c': '^1.0.0',
+ },
}),
node_modules: {
'@npmcli': {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: '@npmcli/a',
version: '1.0.0',
dependencies: {
- '@npmcli/c': '^1.0.0'
- }
- })
+ '@npmcli/c': '^1.0.0',
+ },
+ }),
},
- 'b': {
+ b: {
'package.json': JSON.stringify({
name: '@npmcli/b',
version: '1.1.2',
dependencies: {
- '@npmcli/c': '^1.0.0'
- }
- })
+ '@npmcli/c': '^1.0.0',
+ },
+ }),
},
- 'c': {
+ c: {
'package.json': JSON.stringify({
name: '@npmcli/c',
- version: '1.0.0'
- })
- }
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
+ },
})
ls(['@npmcli/c'], (err) => {
t.ifError(err, 'npm ls')
@@ -1148,22 +1156,22 @@ t.test('ls', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- a: 'npm:b@1.0.0'
- }
+ a: 'npm:b@1.0.0',
+ },
}),
node_modules: {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: 'b',
version: '1.0.0',
_from: 'a@npm:b',
_resolved: 'https://localhost:8080/abbrev/-/abbrev-1.1.1.tgz',
_requested: {
- type: 'alias'
- }
- })
- }
- }
+ type: 'alias',
+ },
+ }),
+ },
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing aliases')
@@ -1177,11 +1185,11 @@ t.test('ls', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'abbrev': 'git+https://github.com/isaacs/abbrev-js.git'
- }
+ abbrev: 'git+https://github.com/isaacs/abbrev-js.git',
+ },
}),
node_modules: {
- 'abbrev': {
+ abbrev: {
'package.json': JSON.stringify({
name: 'abbrev',
version: '1.1.1',
@@ -1194,11 +1202,11 @@ t.test('ls', (t) => {
rawSpec: 'git+https:github.com/isaacs/abbrev-js.git',
saveSpec: 'git+https://github.com/isaacs/abbrev-js.git',
fetchSpec: 'https://github.com/isaacs/abbrev-js.git',
- gitCommittish: null
- }
- })
- }
- }
+ gitCommittish: null,
+ },
+ }),
+ },
+ },
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -1213,36 +1221,36 @@ t.test('ls', (t) => {
a: {
'package.json': JSON.stringify({
name: 'a',
- version: '1.0.1'
- })
- }
+ version: '1.0.1',
+ }),
+ },
},
'package-lock.json': JSON.stringify({
- 'name': 'npm-broken-resolved-field-test',
- 'version': '1.0.0',
- 'lockfileVersion': 2,
- 'requires': true,
- 'packages': {
+ name: 'npm-broken-resolved-field-test',
+ version: '1.0.0',
+ lockfileVersion: 2,
+ requires: true,
+ packages: {
'': {
- 'name': 'a',
- 'version': '1.0.1'
- }
+ name: 'a',
+ version: '1.0.1',
+ },
},
- 'dependencies': {
+ dependencies: {
a: {
- 'version': '1.0.1',
- 'resolved': 'foo@bar://b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
- 'integrity': 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ=='
- }
- }
- }),
- 'package.json': JSON.stringify({
- 'name': 'npm-broken-resolved-field-test',
- 'version': '1.0.0',
- 'dependencies': {
- 'a': '^1.0.1'
- }
- })
+ version: '1.0.1',
+ resolved: 'foo@bar://b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
+ integrity: 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
+ },
+ },
+ }),
+ 'package.json': JSON.stringify({
+ name: 'npm-broken-resolved-field-test',
+ version: '1.0.0',
+ dependencies: {
+ a: '^1.0.1',
+ },
+ }),
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -1257,8 +1265,8 @@ t.test('ls', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'simple-output': '^2.0.0'
- }
+ 'simple-output': '^2.0.0',
+ },
}),
node_modules: {
'simple-output': {
@@ -1276,17 +1284,17 @@ t.test('ls', (t) => {
escapedName: 'simple-output',
rawSpec: '',
saveSpec: null,
- fetchSpec: 'latest'
+ fetchSpec: 'latest',
},
_requiredBy: [
'#USER',
- '/'
+ '/',
],
_shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc',
- _spec: 'simple-output'
- })
- }
- }
+ _spec: 'simple-output',
+ }),
+ },
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should not be printed in tree output')
@@ -1301,24 +1309,24 @@ t.test('ls', (t) => {
a: {
'package.json': JSON.stringify({
name: 'a',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
b: {
'package.json': JSON.stringify({
name: 'b',
- version: '1.0.0'
+ version: '1.0.0',
}),
node_modules: {
c: {
'package.json': JSON.stringify({
name: 'c',
- version: '1.0.0'
- })
- }
- }
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
+ },
+ },
})
// mimics lib/npm.js globalDir getter but pointing to fixtures
@@ -1338,8 +1346,8 @@ t.test('ls', (t) => {
name: 'filter-by-child-of-missing-dep',
version: '1.0.0',
dependencies: {
- 'a': '^1.0.0'
- }
+ a: '^1.0.0',
+ },
}),
node_modules: {
b: {
@@ -1347,34 +1355,34 @@ t.test('ls', (t) => {
name: 'b',
version: '1.0.0',
dependencies: {
- c: '^1.0.0'
- }
- })
+ c: '^1.0.0',
+ },
+ }),
},
c: {
'package.json': JSON.stringify({
name: 'c',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
d: {
'package.json': JSON.stringify({
name: 'd',
version: '1.0.0',
dependencies: {
- c: '^2.0.0'
- }
+ c: '^2.0.0',
+ },
}),
node_modules: {
c: {
'package.json': JSON.stringify({
name: 'c',
- version: '2.0.0'
- })
- }
- }
- }
- }
+ version: '2.0.0',
+ }),
+ },
+ },
+ },
+ },
})
ls(['c'], (err) => {
@@ -1391,8 +1399,8 @@ t.test('ls', (t) => {
version: '1.0.0',
workspaces: [
'./a',
- './b'
- ]
+ './b',
+ ],
}),
node_modules: {
a: t.fixture('symlink', '../a'),
@@ -1400,25 +1408,25 @@ t.test('ls', (t) => {
c: {
'package.json': JSON.stringify({
name: 'c',
- version: '1.0.0'
- })
- }
+ version: '1.0.0',
+ }),
+ },
},
a: {
'package.json': JSON.stringify({
name: 'a',
version: '1.0.0',
dependencies: {
- c: '^1.0.0'
- }
- })
+ c: '^1.0.0',
+ },
+ }),
},
b: {
'package.json': JSON.stringify({
name: 'b',
- version: '1.0.0'
- })
- }
+ version: '1.0.0',
+ }),
+ },
})
ls([], (err) => {
@@ -1443,44 +1451,44 @@ t.test('ls', (t) => {
version: '1.0.0',
dependencies: {
a: '^1.0.0',
- b: '^1.0.0'
- }
+ b: '^1.0.0',
+ },
}),
node_modules: {
a: {
'package.json': JSON.stringify({
name: 'a',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
b: {
'package.json': JSON.stringify({
name: 'b',
version: '1.0.0',
dependencies: {
- c: '^1.0.0'
- }
- })
+ c: '^1.0.0',
+ },
+ }),
},
c: {
'package.json': JSON.stringify({
name: 'c',
version: '1.0.0',
dependencies: {
- d: '^1.0.0'
- }
- })
+ d: '^1.0.0',
+ },
+ }),
},
d: {
'package.json': JSON.stringify({
name: 'd',
version: '1.0.0',
dependencies: {
- a: '^1.0.0'
- }
- })
- }
- }
+ a: '^1.0.0',
+ },
+ }),
+ },
+ },
})
t.plan(6)
@@ -1521,10 +1529,10 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -1535,7 +1543,7 @@ t.test('ls --parseable', (t) => {
t.test('missing package.json', (t) => {
prefix = t.testdir({
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
@@ -1554,10 +1562,10 @@ t.test('ls --parseable', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- foo: '^1.0.0'
- }
+ foo: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
@@ -1573,10 +1581,10 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['lorem'], (err) => {
t.ifError(err, 'npm ls')
@@ -1592,10 +1600,10 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['bar'], (err) => {
t.ifError(err, 'npm ls')
@@ -1612,18 +1620,18 @@ t.test('ls --parseable', (t) => {
dependencies: {
foo: '^1.0.0',
lorem: '^1.0.0',
- ipsum: '^1.0.0'
- }
+ ipsum: '^1.0.0',
+ },
}),
node_modules: {
...simpleNmFixture.node_modules,
ipsum: {
'package.json': JSON.stringify({
name: 'ipsum',
- version: '1.0.0'
- })
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
})
ls(['bar@*', 'lorem@1.0.0'], (err) => {
t.ifError(err, 'npm ls')
@@ -1639,10 +1647,10 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['notadep'], (err) => {
t.ifError(err, 'npm ls')
@@ -1666,10 +1674,10 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -1689,10 +1697,10 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -1712,10 +1720,10 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -1733,10 +1741,10 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^2.0.0',
- ipsum: '^1.0.0'
- }
+ ipsum: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.match(err, { code: 'ELSPROBLEMS' }, 'should list dep problems')
@@ -1753,19 +1761,19 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing dev deps')
@@ -1782,19 +1790,19 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing only development deps')
@@ -1811,29 +1819,29 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0',
- 'linked-dep': '^1.0.0'
+ lorem: '^1.0.0',
+ 'linked-dep': '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
'linked-dep': {
'package.json': JSON.stringify({
name: 'linked-dep',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
node_modules: {
'linked-dep': t.fixture('symlink', '../linked-dep'),
- ...diffDepTypesNmFixture.node_modules
- }
+ ...diffDepTypesNmFixture.node_modules,
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing linked deps')
@@ -1850,19 +1858,19 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing production deps')
@@ -1879,19 +1887,19 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing only prod deps')
@@ -1908,19 +1916,19 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree info with descriptions')
@@ -1935,10 +1943,10 @@ t.test('ls --parseable', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- foo: '^1.0.0'
- }
+ foo: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
@@ -1956,10 +1964,10 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
foo: '^2.0.0',
- ipsum: '^1.0.0'
- }
+ ipsum: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.match(err, { code: 'ELSPROBLEMS' }, 'should list dep problems')
@@ -1977,29 +1985,29 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0',
- 'linked-dep': '^1.0.0'
+ lorem: '^1.0.0',
+ 'linked-dep': '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
'linked-dep': {
'package.json': JSON.stringify({
name: 'linked-dep',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
node_modules: {
'linked-dep': t.fixture('symlink', '../linked-dep'),
- ...diffDepTypesNmFixture.node_modules
- }
+ ...diffDepTypesNmFixture.node_modules,
+ },
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -2019,19 +2027,19 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing top-level deps with descriptions')
@@ -2044,7 +2052,7 @@ t.test('ls --parseable', (t) => {
t.test('json read problems', (t) => {
prefix = t.testdir({
- 'package.json': '{broken json'
+ 'package.json': '{broken json',
})
ls([], (err) => {
t.match(err, { code: 'EJSONPARSE' }, 'should throw EJSONPARSE error')
@@ -2069,19 +2077,19 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^2.0.0' // mismatching version #
- }
+ 'peer-dep': '^2.0.0', // mismatching version #
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output parseable signaling missing peer dep in problems')
@@ -2096,20 +2104,20 @@ t.test('ls --parseable', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
'missing-optional-dep': '^1.0.0',
- 'optional-dep': '^2.0.0' // mismatching version #
+ 'optional-dep': '^2.0.0', // mismatching version #
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], (err) => {
t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
@@ -2125,29 +2133,29 @@ t.test('ls --parseable', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'a': '^1.0.0'
- }
+ a: '^1.0.0',
+ },
}),
node_modules: {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: 'a',
version: '1.0.0',
dependencies: {
- b: '^1.0.0'
- }
- })
+ b: '^1.0.0',
+ },
+ }),
},
- 'b': {
+ b: {
'package.json': JSON.stringify({
name: 'b',
version: '1.0.0',
dependencies: {
- a: '^1.0.0'
- }
- })
- }
- }
+ a: '^1.0.0',
+ },
+ }),
+ },
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should print tree output ommiting deduped ref')
@@ -2161,22 +2169,22 @@ t.test('ls --parseable', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- a: 'npm:b@1.0.0'
- }
+ a: 'npm:b@1.0.0',
+ },
}),
node_modules: {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: 'b',
version: '1.0.0',
_from: 'a@npm:b',
_resolved: 'https://localhost:8080/abbrev/-/abbrev-1.1.1.tgz',
_requested: {
- type: 'alias'
- }
- })
- }
- }
+ type: 'alias',
+ },
+ }),
+ },
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing aliases')
@@ -2190,11 +2198,11 @@ t.test('ls --parseable', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'abbrev': 'git+https://github.com/isaacs/abbrev-js.git'
- }
+ abbrev: 'git+https://github.com/isaacs/abbrev-js.git',
+ },
}),
node_modules: {
- 'abbrev': {
+ abbrev: {
'package.json': JSON.stringify({
name: 'abbrev',
version: '1.1.1',
@@ -2207,11 +2215,11 @@ t.test('ls --parseable', (t) => {
rawSpec: 'git+https:github.com/isaacs/abbrev-js.git',
saveSpec: 'git+https://github.com/isaacs/abbrev-js.git',
fetchSpec: 'https://github.com/isaacs/abbrev-js.git',
- gitCommittish: null
- }
- })
- }
- }
+ gitCommittish: null,
+ },
+ }),
+ },
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should output tree containing git refs')
@@ -2225,8 +2233,8 @@ t.test('ls --parseable', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'simple-output': '^2.0.0'
- }
+ 'simple-output': '^2.0.0',
+ },
}),
node_modules: {
'simple-output': {
@@ -2244,17 +2252,17 @@ t.test('ls --parseable', (t) => {
escapedName: 'simple-output',
rawSpec: '',
saveSpec: null,
- fetchSpec: 'latest'
+ fetchSpec: 'latest',
},
_requiredBy: [
'#USER',
- '/'
+ '/',
],
_shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc',
- _spec: 'simple-output'
- })
- }
- }
+ _spec: 'simple-output',
+ }),
+ },
+ },
})
ls([], () => {
t.matchSnapshot(redactCwd(result), 'should not be printed in tree output')
@@ -2269,24 +2277,24 @@ t.test('ls --parseable', (t) => {
a: {
'package.json': JSON.stringify({
name: 'a',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
b: {
'package.json': JSON.stringify({
name: 'b',
- version: '1.0.0'
+ version: '1.0.0',
}),
node_modules: {
c: {
'package.json': JSON.stringify({
name: 'c',
- version: '1.0.0'
- })
- }
- }
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
+ },
+ },
})
// mimics lib/npm.js globalDir getter but pointing to fixtures
@@ -2314,10 +2322,10 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -2326,19 +2334,19 @@ t.test('ls --json', (t) => {
{
name: 'test-npm-ls',
version: '1.0.0',
- 'dependencies': {
- 'foo': {
- 'version': '1.0.0',
- 'dependencies': {
- 'bar': {
- 'version': '1.0.0'
- }
- }
- },
- 'lorem': {
- 'version': '1.0.0'
- }
- }
+ dependencies: {
+ foo: {
+ version: '1.0.0',
+ dependencies: {
+ bar: {
+ version: '1.0.0',
+ },
+ },
+ },
+ lorem: {
+ version: '1.0.0',
+ },
+ },
},
'should output json representation of dependencies structure'
)
@@ -2348,46 +2356,46 @@ t.test('ls --json', (t) => {
t.test('missing package.json', (t) => {
prefix = t.testdir({
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.match(err, { code: 'ELSPROBLEMS' }, 'should list dep problems')
t.deepEqual(
jsonParse(result),
{
- 'problems': [
+ problems: [
'extraneous: bar@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/bar',
'extraneous: foo@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/foo',
- 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/lorem'
+ 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/lorem',
],
- 'dependencies': {
- 'bar': {
- 'version': '1.0.0',
- 'extraneous': true,
- 'problems': [
- 'extraneous: bar@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/bar'
- ]
- },
- 'foo': {
- 'version': '1.0.0',
- 'extraneous': true,
- 'problems': [
- 'extraneous: foo@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/foo'
+ dependencies: {
+ bar: {
+ version: '1.0.0',
+ extraneous: true,
+ problems: [
+ 'extraneous: bar@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/bar',
+ ],
+ },
+ foo: {
+ version: '1.0.0',
+ extraneous: true,
+ problems: [
+ 'extraneous: foo@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/foo',
+ ],
+ dependencies: {
+ bar: {
+ version: '1.0.0',
+ },
+ },
+ },
+ lorem: {
+ version: '1.0.0',
+ extraneous: true,
+ problems: [
+ 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/lorem',
],
- 'dependencies': {
- 'bar': {
- 'version': '1.0.0'
- }
- }
- },
- 'lorem': {
- 'version': '1.0.0',
- 'extraneous': true,
- 'problems': [
- 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-package-json/node_modules/lorem'
- ]
- }
- }
+ },
+ },
},
'should output json missing name/version of top-level package'
)
@@ -2401,10 +2409,10 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- foo: '^1.0.0'
- }
+ foo: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.equal(
@@ -2422,26 +2430,26 @@ t.test('ls --json', (t) => {
{
name: 'test-npm-ls',
version: '1.0.0',
- 'problems': [
- 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-extraneous-deps/node_modules/lorem'
+ problems: [
+ 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-extraneous-deps/node_modules/lorem',
],
- 'dependencies': {
- 'foo': {
- 'version': '1.0.0',
- 'dependencies': {
- 'bar': {
- 'version': '1.0.0'
- }
- }
- },
- 'lorem': {
- 'version': '1.0.0',
- 'extraneous': true,
- 'problems': [
- 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-extraneous-deps/node_modules/lorem'
- ]
- }
- }
+ dependencies: {
+ foo: {
+ version: '1.0.0',
+ dependencies: {
+ bar: {
+ version: '1.0.0',
+ },
+ },
+ },
+ lorem: {
+ version: '1.0.0',
+ extraneous: true,
+ problems: [
+ 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-extraneous-deps/node_modules/lorem',
+ ],
+ },
+ },
},
'should output json containing problems info'
)
@@ -2456,10 +2464,10 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['lorem'], (err) => {
t.ifError(err, 'npm ls')
@@ -2468,11 +2476,11 @@ t.test('ls --json', (t) => {
{
name: 'test-npm-ls',
version: '1.0.0',
- 'dependencies': {
- 'lorem': {
- 'version': '1.0.0'
- }
- }
+ dependencies: {
+ lorem: {
+ version: '1.0.0',
+ },
+ },
},
'should output json contaning only occurences of filtered by package'
)
@@ -2492,10 +2500,10 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['bar'], (err) => {
t.ifError(err, 'npm ls')
@@ -2509,11 +2517,11 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
bar: {
- version: '1.0.0'
- }
- }
- }
- }
+ version: '1.0.0',
+ },
+ },
+ },
+ },
},
'should output json contaning only occurences of filtered by package'
)
@@ -2529,39 +2537,39 @@ t.test('ls --json', (t) => {
dependencies: {
foo: '^1.0.0',
lorem: '^1.0.0',
- ipsum: '^1.0.0'
- }
+ ipsum: '^1.0.0',
+ },
}),
node_modules: {
...simpleNmFixture.node_modules,
ipsum: {
'package.json': JSON.stringify({
name: 'ipsum',
- version: '1.0.0'
- })
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
})
ls(['bar@*', 'lorem@1.0.0'], (err) => {
t.ifError(err, 'npm ls')
t.deepEqual(
jsonParse(result),
{
- 'version': '1.0.0',
- 'name': 'test-npm-ls',
- 'dependencies': {
- 'foo': {
- 'version': '1.0.0',
- 'dependencies': {
- 'bar': {
- 'version': '1.0.0'
- }
- }
- },
- 'lorem': {
- 'version': '1.0.0'
- }
- }
+ version: '1.0.0',
+ name: 'test-npm-ls',
+ dependencies: {
+ foo: {
+ version: '1.0.0',
+ dependencies: {
+ bar: {
+ version: '1.0.0',
+ },
+ },
+ },
+ lorem: {
+ version: '1.0.0',
+ },
+ },
},
'should output json contaning only occurences of multiple filtered packages and their ancestors'
)
@@ -2576,10 +2584,10 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls(['notadep'], (err) => {
t.ifError(err, 'npm ls')
@@ -2587,7 +2595,7 @@ t.test('ls --json', (t) => {
jsonParse(result),
{
name: 'test-npm-ls',
- version: '1.0.0'
+ version: '1.0.0',
},
'should output json containing no dependencies info'
)
@@ -2610,10 +2618,10 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -2622,14 +2630,14 @@ t.test('ls --json', (t) => {
{
name: 'test-npm-ls',
version: '1.0.0',
- 'dependencies': {
- 'foo': {
- 'version': '1.0.0'
+ dependencies: {
+ foo: {
+ version: '1.0.0',
},
- 'lorem': {
- 'version': '1.0.0'
- }
- }
+ lorem: {
+ version: '1.0.0',
+ },
+ },
},
'should output json containing only top-level dependencies'
)
@@ -2648,10 +2656,10 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -2660,14 +2668,14 @@ t.test('ls --json', (t) => {
{
name: 'test-npm-ls',
version: '1.0.0',
- 'dependencies': {
- 'foo': {
- 'version': '1.0.0'
+ dependencies: {
+ foo: {
+ version: '1.0.0',
},
- 'lorem': {
- 'version': '1.0.0'
- }
- }
+ lorem: {
+ version: '1.0.0',
+ },
+ },
},
'should output json containing only top-level dependencies'
)
@@ -2686,10 +2694,10 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^1.0.0',
- lorem: '^1.0.0'
- }
+ lorem: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.ifError(err, 'npm ls')
@@ -2698,19 +2706,19 @@ t.test('ls --json', (t) => {
{
name: 'test-npm-ls',
version: '1.0.0',
- 'dependencies': {
- 'foo': {
- 'version': '1.0.0',
- 'dependencies': {
- 'bar': {
- 'version': '1.0.0'
- }
- }
- },
- 'lorem': {
- 'version': '1.0.0'
- }
- }
+ dependencies: {
+ foo: {
+ version: '1.0.0',
+ dependencies: {
+ bar: {
+ version: '1.0.0',
+ },
+ },
+ },
+ lorem: {
+ version: '1.0.0',
+ },
+ },
},
'should output json containing top-level deps and their deps only'
)
@@ -2727,51 +2735,51 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
foo: '^2.0.0',
- ipsum: '^1.0.0'
- }
+ ipsum: '^1.0.0',
+ },
}),
- ...simpleNmFixture
+ ...simpleNmFixture,
})
ls([], (err) => {
t.match(err, { code: 'ELSPROBLEMS' }, 'should list dep problems')
t.deepEqual(
jsonParse(result),
{
- 'name': 'test-npm-ls',
- 'version': '1.0.0',
- 'problems': [
+ name: 'test-npm-ls',
+ version: '1.0.0',
+ problems: [
'invalid: foo@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/foo',
'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
- 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/lorem'
+ 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/lorem',
],
- 'dependencies': {
- 'foo': {
- 'version': '1.0.0',
- 'invalid': true,
- 'problems': [
- 'invalid: foo@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/foo'
+ dependencies: {
+ foo: {
+ version: '1.0.0',
+ invalid: true,
+ problems: [
+ 'invalid: foo@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/foo',
],
- 'dependencies': {
- 'bar': {
- 'version': '1.0.0'
- }
- }
- },
- 'lorem': {
- 'version': '1.0.0',
- 'extraneous': true,
- 'problems': [
- 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/lorem'
- ]
- },
- 'ipsum': {
- 'required': '^1.0.0',
- 'missing': true,
- 'problems': [
- 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0'
- ]
- }
- }
+ dependencies: {
+ bar: {
+ version: '1.0.0',
+ },
+ },
+ },
+ lorem: {
+ version: '1.0.0',
+ extraneous: true,
+ problems: [
+ 'extraneous: lorem@1.0.0 {CWD}/ls-ls-json-missing-invalid-extraneous/node_modules/lorem',
+ ],
+ },
+ ipsum: {
+ required: '^1.0.0',
+ missing: true,
+ problems: [
+ 'missing: ipsum@^1.0.0, required by test-npm-ls@1.0.0',
+ ],
+ },
+ },
},
'should output json containing top-level deps and their deps only'
)
@@ -2787,19 +2795,19 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.deepEqual(
@@ -2813,11 +2821,11 @@ t.test('ls --json', (t) => {
dependencies: {
foo: {
version: '1.0.0',
- dependencies: { bar: { version: '1.0.0' } }
- }
- }
- }
- }
+ dependencies: { bar: { version: '1.0.0' } },
+ },
+ },
+ },
+ },
},
'should output json containing dev deps'
)
@@ -2834,19 +2842,19 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.deepEqual(
@@ -2860,11 +2868,11 @@ t.test('ls --json', (t) => {
dependencies: {
foo: {
version: '1.0.0',
- dependencies: { bar: { version: '1.0.0' } }
- }
- }
- }
- }
+ dependencies: { bar: { version: '1.0.0' } },
+ },
+ },
+ },
+ },
},
'should output json containing only development deps'
)
@@ -2881,29 +2889,29 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0',
- 'linked-dep': '^1.0.0'
+ lorem: '^1.0.0',
+ 'linked-dep': '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
'linked-dep': {
'package.json': JSON.stringify({
name: 'linked-dep',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
node_modules: {
'linked-dep': t.fixture('symlink', '../linked-dep'),
- ...diffDepTypesNmFixture.node_modules
- }
+ ...diffDepTypesNmFixture.node_modules,
+ },
})
ls([], () => {
t.deepEqual(
@@ -2914,9 +2922,9 @@ t.test('ls --json', (t) => {
dependencies: {
'linked-dep': {
version: '1.0.0',
- resolved: 'file:../linked-dep'
- }
- }
+ resolved: 'file:../linked-dep',
+ },
+ },
},
'should output json containing linked deps'
)
@@ -2933,19 +2941,19 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.deepEqual(
@@ -2956,8 +2964,8 @@ t.test('ls --json', (t) => {
dependencies: {
lorem: { version: '1.0.0' },
'optional-dep': { version: '1.0.0' },
- 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } }
- }
+ 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } },
+ },
},
'should output json containing production deps'
)
@@ -2974,19 +2982,19 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.deepEqual(
@@ -2997,8 +3005,8 @@ t.test('ls --json', (t) => {
dependencies: {
lorem: { version: '1.0.0' },
'optional-dep': { version: '1.0.0' },
- 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } }
- }
+ 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } },
+ },
},
'should output json containing only prod deps'
)
@@ -3014,121 +3022,121 @@ t.test('ls --json', (t) => {
'dedupe-tests-a': {
'package.json': JSON.stringify({
name: '@isaacs/dedupe-tests-a',
- version: '1.0.1'
+ version: '1.0.1',
}),
node_modules: {
'@isaacs': {
'dedupe-tests-b': {
name: '@isaacs/dedupe-tests-b',
- version: '1.0.0'
- }
- }
- }
+ version: '1.0.0',
+ },
+ },
+ },
},
'dedupe-tests-b': {
'package.json': JSON.stringify({
name: '@isaacs/dedupe-tests-b',
- version: '2.0.0'
- })
- }
- }
+ version: '2.0.0',
+ }),
+ },
+ },
},
'package-lock.json': JSON.stringify({
- 'name': 'dedupe-lockfile',
- 'version': '1.0.0',
- 'lockfileVersion': 2,
- 'requires': true,
- 'packages': {
+ name: 'dedupe-lockfile',
+ version: '1.0.0',
+ lockfileVersion: 2,
+ requires: true,
+ packages: {
'': {
- 'name': 'dedupe-lockfile',
- 'version': '1.0.0',
- 'dependencies': {
+ name: 'dedupe-lockfile',
+ version: '1.0.0',
+ dependencies: {
'@isaacs/dedupe-tests-a': '1.0.1',
- '@isaacs/dedupe-tests-b': '1||2'
- }
+ '@isaacs/dedupe-tests-b': '1||2',
+ },
},
'node_modules/@isaacs/dedupe-tests-a': {
- 'name': '@isaacs/dedupe-tests-a',
- 'version': '1.0.1',
- 'resolved': 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
- 'integrity': 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
- 'dependencies': {
- '@isaacs/dedupe-tests-b': '1'
- }
+ name: '@isaacs/dedupe-tests-a',
+ version: '1.0.1',
+ resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
+ integrity: 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
+ dependencies: {
+ '@isaacs/dedupe-tests-b': '1',
+ },
},
'node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b': {
- 'name': '@isaacs/dedupe-tests-b',
- 'version': '1.0.0',
- 'resolved': 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
- 'integrity': 'sha512-3nmvzIb8QL8OXODzipwoV3U8h9OQD9g9RwOPuSBQqjqSg9JZR1CCFOWNsDUtOfmwY8HFUJV9EAZ124uhqVxq+w=='
+ name: '@isaacs/dedupe-tests-b',
+ version: '1.0.0',
+ resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
+ integrity: 'sha512-3nmvzIb8QL8OXODzipwoV3U8h9OQD9g9RwOPuSBQqjqSg9JZR1CCFOWNsDUtOfmwY8HFUJV9EAZ124uhqVxq+w==',
},
'node_modules/@isaacs/dedupe-tests-b': {
- 'name': '@isaacs/dedupe-tests-b',
- 'version': '2.0.0',
- 'resolved': 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
- 'integrity': 'sha512-KTYkpRv9EzlmCg4Gsm/jpclWmRYFCXow8GZKJXjK08sIZBlElTZEa5Bw/UQxIvEfcKmWXczSqItD49Kr8Ax4UA=='
- }
+ name: '@isaacs/dedupe-tests-b',
+ version: '2.0.0',
+ resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
+ integrity: 'sha512-KTYkpRv9EzlmCg4Gsm/jpclWmRYFCXow8GZKJXjK08sIZBlElTZEa5Bw/UQxIvEfcKmWXczSqItD49Kr8Ax4UA==',
+ },
},
- 'dependencies': {
+ dependencies: {
'@isaacs/dedupe-tests-a': {
- 'version': '1.0.1',
- 'resolved': 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
- 'integrity': 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
- 'requires': {
- '@isaacs/dedupe-tests-b': '1'
+ version: '1.0.1',
+ resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
+ integrity: 'sha512-8AN9lNCcBt5Xeje7fMEEpp5K3rgcAzIpTtAjYb/YMUYu8SbIVF6wz0WqACDVKvpQOUcSfNHZQNLNmue0QSwXOQ==',
+ requires: {
+ '@isaacs/dedupe-tests-b': '1',
},
- 'dependencies': {
+ dependencies: {
'@isaacs/dedupe-tests-b': {
- 'version': '1.0.0',
- 'resolved': 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
- 'integrity': 'sha512-3nmvzIb8QL8OXODzipwoV3U8h9OQD9g9RwOPuSBQqjqSg9JZR1CCFOWNsDUtOfmwY8HFUJV9EAZ124uhqVxq+w=='
- }
- }
+ version: '1.0.0',
+ resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
+ integrity: 'sha512-3nmvzIb8QL8OXODzipwoV3U8h9OQD9g9RwOPuSBQqjqSg9JZR1CCFOWNsDUtOfmwY8HFUJV9EAZ124uhqVxq+w==',
+ },
+ },
},
'@isaacs/dedupe-tests-b': {
- 'version': '2.0.0',
- 'resolved': 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
- 'integrity': 'sha512-KTYkpRv9EzlmCg4Gsm/jpclWmRYFCXow8GZKJXjK08sIZBlElTZEa5Bw/UQxIvEfcKmWXczSqItD49Kr8Ax4UA=='
- }
- }
+ version: '2.0.0',
+ resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
+ integrity: 'sha512-KTYkpRv9EzlmCg4Gsm/jpclWmRYFCXow8GZKJXjK08sIZBlElTZEa5Bw/UQxIvEfcKmWXczSqItD49Kr8Ax4UA==',
+ },
+ },
}),
'package.json': JSON.stringify({
- 'name': 'dedupe-lockfile',
- 'version': '1.0.0',
- 'dependencies': {
+ name: 'dedupe-lockfile',
+ version: '1.0.0',
+ dependencies: {
'@isaacs/dedupe-tests-a': '1.0.1',
- '@isaacs/dedupe-tests-b': '1||2'
- }
- })
+ '@isaacs/dedupe-tests-b': '1||2',
+ },
+ }),
})
ls([], () => {
t.deepEqual(
jsonParse(result),
{
- 'version': '1.0.0',
- 'name': 'dedupe-lockfile',
- 'dependencies': {
+ version: '1.0.0',
+ name: 'dedupe-lockfile',
+ dependencies: {
'@isaacs/dedupe-tests-a': {
- 'version': '1.0.1',
- 'resolved': 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
- 'dependencies': {
+ version: '1.0.1',
+ resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-a/-/dedupe-tests-a-1.0.1.tgz',
+ dependencies: {
'@isaacs/dedupe-tests-b': {
- 'resolved': 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
- 'extraneous': true,
- 'problems': [
- 'extraneous: @isaacs/dedupe-tests-b@ {CWD}/ls-ls-json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b'
- ]
- }
- }
+ resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-1.0.0.tgz',
+ extraneous: true,
+ problems: [
+ 'extraneous: @isaacs/dedupe-tests-b@ {CWD}/ls-ls-json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b',
+ ],
+ },
+ },
},
'@isaacs/dedupe-tests-b': {
- 'version': '2.0.0',
- 'resolved': 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz'
- }
+ version: '2.0.0',
+ resolved: 'https://registry.npmjs.org/@isaacs/dedupe-tests-b/-/dedupe-tests-b-2.0.0.tgz',
+ },
},
- 'problems': [
- 'extraneous: @isaacs/dedupe-tests-b@ {CWD}/ls-ls-json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b'
- ]
+ problems: [
+ 'extraneous: @isaacs/dedupe-tests-b@ {CWD}/ls-ls-json-from-lockfile/node_modules/@isaacs/dedupe-tests-a/node_modules/@isaacs/dedupe-tests-b',
+ ],
},
'should output json containing only prod deps'
)
@@ -3144,19 +3152,19 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.deepEqual(
@@ -3174,7 +3182,7 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: {},
path: '{CWD}/ls-ls-json--long/node_modules/peer-dep',
- extraneous: false
+ extraneous: false,
},
'dev-dep': {
name: 'dev-dep',
@@ -3193,23 +3201,23 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: {},
path: '{CWD}/ls-ls-json--long/node_modules/bar',
- extraneous: false
- }
+ extraneous: false,
+ },
},
_id: 'foo@1.0.0',
devDependencies: {},
peerDependencies: {},
_dependencies: { bar: '^1.0.0' },
path: '{CWD}/ls-ls-json--long/node_modules/foo',
- extraneous: false
- }
+ extraneous: false,
+ },
},
_id: 'dev-dep@1.0.0',
devDependencies: {},
peerDependencies: {},
_dependencies: { foo: '^1.0.0' },
path: '{CWD}/ls-ls-json--long/node_modules/dev-dep',
- extraneous: false
+ extraneous: false,
},
lorem: {
name: 'lorem',
@@ -3219,7 +3227,7 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: {},
path: '{CWD}/ls-ls-json--long/node_modules/lorem',
- extraneous: false
+ extraneous: false,
},
'optional-dep': {
name: 'optional-dep',
@@ -3230,7 +3238,7 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: {},
path: '{CWD}/ls-ls-json--long/node_modules/optional-dep',
- extraneous: false
+ extraneous: false,
},
'prod-dep': {
name: 'prod-dep',
@@ -3246,16 +3254,16 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: {},
path: '{CWD}/ls-ls-json--long/node_modules/prod-dep/node_modules/bar',
- extraneous: false
- }
+ extraneous: false,
+ },
},
_id: 'prod-dep@1.0.0',
devDependencies: {},
peerDependencies: {},
_dependencies: { bar: '^2.0.0' },
path: '{CWD}/ls-ls-json--long/node_modules/prod-dep',
- extraneous: false
- }
+ extraneous: false,
+ },
},
devDependencies: { 'dev-dep': '^1.0.0' },
optionalDependencies: { 'optional-dep': '^1.0.0' },
@@ -3263,7 +3271,7 @@ t.test('ls --json', (t) => {
_id: 'test-npm-ls@1.0.0',
_dependencies: { 'prod-dep': '^1.0.0', lorem: '^1.0.0', 'optional-dep': '^1.0.0' },
path: '{CWD}/ls-ls-json--long',
- extraneous: false
+ extraneous: false,
},
'should output long json info'
)
@@ -3282,19 +3290,19 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], () => {
t.deepEqual(
@@ -3312,7 +3320,7 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: {},
path: '{CWD}/ls-ls-json--long-depth-0/node_modules/peer-dep',
- extraneous: false
+ extraneous: false,
},
'dev-dep': {
name: 'dev-dep',
@@ -3323,7 +3331,7 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: { foo: '^1.0.0' },
path: '{CWD}/ls-ls-json--long-depth-0/node_modules/dev-dep',
- extraneous: false
+ extraneous: false,
},
lorem: {
name: 'lorem',
@@ -3333,7 +3341,7 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: {},
path: '{CWD}/ls-ls-json--long-depth-0/node_modules/lorem',
- extraneous: false
+ extraneous: false,
},
'optional-dep': {
name: 'optional-dep',
@@ -3344,7 +3352,7 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: {},
path: '{CWD}/ls-ls-json--long-depth-0/node_modules/optional-dep',
- extraneous: false
+ extraneous: false,
},
'prod-dep': {
name: 'prod-dep',
@@ -3355,8 +3363,8 @@ t.test('ls --json', (t) => {
peerDependencies: {},
_dependencies: { bar: '^2.0.0' },
path: '{CWD}/ls-ls-json--long-depth-0/node_modules/prod-dep',
- extraneous: false
- }
+ extraneous: false,
+ },
},
devDependencies: { 'dev-dep': '^1.0.0' },
optionalDependencies: { 'optional-dep': '^1.0.0' },
@@ -3364,7 +3372,7 @@ t.test('ls --json', (t) => {
_id: 'test-npm-ls@1.0.0',
_dependencies: { 'prod-dep': '^1.0.0', lorem: '^1.0.0', 'optional-dep': '^1.0.0' },
path: '{CWD}/ls-ls-json--long-depth-0',
- extraneous: false
+ extraneous: false,
},
'should output json containing top-level deps in long format'
)
@@ -3377,7 +3385,7 @@ t.test('ls --json', (t) => {
t.test('json read problems', (t) => {
prefix = t.testdir({
- 'package.json': '{broken json'
+ 'package.json': '{broken json',
})
ls([], (err) => {
t.match(err.message, 'Failed to parse root package.json', 'should have missin root package.json msg')
@@ -3387,8 +3395,8 @@ t.test('ls --json', (t) => {
{
invalid: true,
problems: [
- 'error in {CWD}/ls-ls-json-json-read-problems: Failed to parse root package.json'
- ]
+ 'error in {CWD}/ls-ls-json-json-read-problems: Failed to parse root package.json',
+ ],
},
'should print empty json result'
)
@@ -3416,19 +3424,19 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
- 'optional-dep': '^1.0.0'
+ 'optional-dep': '^1.0.0',
},
peerDependencies: {
- 'peer-dep': '^2.0.0' // mismatching version #
- }
+ 'peer-dep': '^2.0.0', // mismatching version #
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], (err) => {
t.match(err.code, 'ELSPROBLEMS', 'Should have ELSPROBLEMS error code')
@@ -3438,29 +3446,29 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
problems: [
- 'invalid: peer-dep@1.0.0 {CWD}/ls-ls-json-unmet-peer-dep/node_modules/peer-dep'
+ 'invalid: peer-dep@1.0.0 {CWD}/ls-ls-json-unmet-peer-dep/node_modules/peer-dep',
],
dependencies: {
'peer-dep': {
version: '1.0.0',
invalid: true,
problems: [
- 'invalid: peer-dep@1.0.0 {CWD}/ls-ls-json-unmet-peer-dep/node_modules/peer-dep'
- ]
+ 'invalid: peer-dep@1.0.0 {CWD}/ls-ls-json-unmet-peer-dep/node_modules/peer-dep',
+ ],
},
'dev-dep': {
version: '1.0.0',
dependencies: {
foo: {
version: '1.0.0',
- dependencies: { bar: { version: '1.0.0' } }
- }
- }
+ dependencies: { bar: { version: '1.0.0' } },
+ },
+ },
},
lorem: { version: '1.0.0' },
'optional-dep': { version: '1.0.0' },
- 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } }
- }
+ 'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } },
+ },
},
'should output json signaling missing peer dep in problems'
)
@@ -3475,20 +3483,20 @@ t.test('ls --json', (t) => {
version: '1.0.0',
dependencies: {
'prod-dep': '^1.0.0',
- 'lorem': '^1.0.0'
+ lorem: '^1.0.0',
},
devDependencies: {
- 'dev-dep': '^1.0.0'
+ 'dev-dep': '^1.0.0',
},
optionalDependencies: {
'missing-optional-dep': '^1.0.0',
- 'optional-dep': '^2.0.0' // mismatching version #
+ 'optional-dep': '^2.0.0', // mismatching version #
},
peerDependencies: {
- 'peer-dep': '^1.0.0'
- }
+ 'peer-dep': '^1.0.0',
+ },
}),
- ...diffDepTypesNmFixture
+ ...diffDepTypesNmFixture,
})
ls([], (err) => {
t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
@@ -3499,32 +3507,32 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
problems: [
- 'invalid: optional-dep@1.0.0 {CWD}/ls-ls-json-unmet-optional-dep/node_modules/optional-dep' // mismatching optional deps get flagged in problems
+ 'invalid: optional-dep@1.0.0 {CWD}/ls-ls-json-unmet-optional-dep/node_modules/optional-dep', // mismatching optional deps get flagged in problems
],
dependencies: {
'optional-dep': {
version: '1.0.0',
invalid: true,
problems: [
- 'invalid: optional-dep@1.0.0 {CWD}/ls-ls-json-unmet-optional-dep/node_modules/optional-dep'
- ]
+ 'invalid: optional-dep@1.0.0 {CWD}/ls-ls-json-unmet-optional-dep/node_modules/optional-dep',
+ ],
},
'peer-dep': {
- version: '1.0.0'
+ version: '1.0.0',
},
'dev-dep': {
version: '1.0.0',
dependencies: {
foo: {
version: '1.0.0',
- dependencies: { bar: { version: '1.0.0' } }
- }
- }
+ dependencies: { bar: { version: '1.0.0' } },
+ },
+ },
},
lorem: { version: '1.0.0' },
'prod-dep': { version: '1.0.0', dependencies: { bar: { version: '2.0.0' } } },
- 'missing-optional-dep': {} // missing optional dep has an empty entry in json output
- }
+ 'missing-optional-dep': {}, // missing optional dep has an empty entry in json output
+ },
},
'should output json with empty entry for missing optional deps'
)
@@ -3538,29 +3546,29 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'a': '^1.0.0'
- }
+ a: '^1.0.0',
+ },
}),
node_modules: {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: 'a',
version: '1.0.0',
dependencies: {
- b: '^1.0.0'
- }
- })
+ b: '^1.0.0',
+ },
+ }),
},
- 'b': {
+ b: {
'package.json': JSON.stringify({
name: 'b',
version: '1.0.0',
dependencies: {
- a: '^1.0.0'
- }
- })
- }
- }
+ a: '^1.0.0',
+ },
+ }),
+ },
+ },
})
ls([], () => {
t.deepEqual(
@@ -3575,12 +3583,12 @@ t.test('ls --json', (t) => {
b: {
version: '1.0.0',
dependencies: {
- a: { version: '1.0.0' }
- }
- }
- }
- }
- }
+ a: { version: '1.0.0' },
+ },
+ },
+ },
+ },
+ },
},
'should print json output containing deduped ref'
)
@@ -3594,22 +3602,22 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- a: 'npm:b@1.0.0'
- }
+ a: 'npm:b@1.0.0',
+ },
}),
node_modules: {
- 'a': {
+ a: {
'package.json': JSON.stringify({
name: 'b',
version: '1.0.0',
_from: 'a@npm:b',
_resolved: 'https://localhost:8080/abbrev/-/abbrev-1.1.1.tgz',
_requested: {
- type: 'alias'
- }
- })
- }
- }
+ type: 'alias',
+ },
+ }),
+ },
+ },
})
ls([], () => {
t.deepEqual(
@@ -3620,9 +3628,9 @@ t.test('ls --json', (t) => {
dependencies: {
a: {
version: '1.0.0',
- resolved: 'https://localhost:8080/abbrev/-/abbrev-1.1.1.tgz'
- }
- }
+ resolved: 'https://localhost:8080/abbrev/-/abbrev-1.1.1.tgz',
+ },
+ },
},
'should output json containing aliases'
)
@@ -3636,11 +3644,11 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'abbrev': 'git+https://github.com/isaacs/abbrev-js.git'
- }
+ abbrev: 'git+https://github.com/isaacs/abbrev-js.git',
+ },
}),
node_modules: {
- 'abbrev': {
+ abbrev: {
'package.json': JSON.stringify({
name: 'abbrev',
version: '1.1.1',
@@ -3653,11 +3661,11 @@ t.test('ls --json', (t) => {
rawSpec: 'git+https:github.com/isaacs/abbrev-js.git',
saveSpec: 'git+https://github.com/isaacs/abbrev-js.git',
fetchSpec: 'https://github.com/isaacs/abbrev-js.git',
- gitCommittish: null
- }
- })
- }
- }
+ gitCommittish: null,
+ },
+ }),
+ },
+ },
})
ls([], () => {
t.deepEqual(
@@ -3668,9 +3676,9 @@ t.test('ls --json', (t) => {
dependencies: {
abbrev: {
version: '1.1.1',
- resolved: 'git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c'
- }
- }
+ resolved: 'git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c',
+ },
+ },
},
'should output json containing git refs'
)
@@ -3684,8 +3692,8 @@ t.test('ls --json', (t) => {
name: 'test-npm-ls',
version: '1.0.0',
dependencies: {
- 'simple-output': '^2.0.0'
- }
+ 'simple-output': '^2.0.0',
+ },
}),
node_modules: {
'simple-output': {
@@ -3703,17 +3711,17 @@ t.test('ls --json', (t) => {
escapedName: 'simple-output',
rawSpec: '',
saveSpec: null,
- fetchSpec: 'latest'
+ fetchSpec: 'latest',
},
_requiredBy: [
'#USER',
- '/'
+ '/',
],
_shasum: '3c07708ec9ef3e3c985cf0ddd67df09ab8ec2abc',
- _spec: 'simple-output'
- })
- }
- }
+ _spec: 'simple-output',
+ }),
+ },
+ },
})
ls([], () => {
t.deepEqual(
@@ -3724,9 +3732,9 @@ t.test('ls --json', (t) => {
dependencies: {
'simple-output': {
version: '2.1.1',
- resolved: 'https://registry.npmjs.org/simple-output/-/simple-output-2.1.1.tgz'
- }
- }
+ resolved: 'https://registry.npmjs.org/simple-output/-/simple-output-2.1.1.tgz',
+ },
+ },
},
'should be printed in json output'
)
@@ -3737,15 +3745,15 @@ t.test('ls --json', (t) => {
t.test('node.name fallback if missing root package name', (t) => {
prefix = t.testdir({
'package.json': JSON.stringify({
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
})
ls([], () => {
t.deepEqual(
jsonParse(result),
{
- 'version': '1.0.0',
- 'name': 'ls-ls-json-node-name-fallback-if-missing-root-package-name'
+ version: '1.0.0',
+ name: 'ls-ls-json-node-name-fallback-if-missing-root-package-name',
},
'should use node.name as key in json result obj'
)
@@ -3760,24 +3768,24 @@ t.test('ls --json', (t) => {
a: {
'package.json': JSON.stringify({
name: 'a',
- version: '1.0.0'
- })
+ version: '1.0.0',
+ }),
},
b: {
'package.json': JSON.stringify({
name: 'b',
- version: '1.0.0'
+ version: '1.0.0',
}),
node_modules: {
c: {
'package.json': JSON.stringify({
name: 'c',
- version: '1.0.0'
- })
- }
- }
- }
- }
+ version: '1.0.0',
+ }),
+ },
+ },
+ },
+ },
})
// mimics lib/npm.js globalDir getter but pointing to fixtures
@@ -3787,19 +3795,19 @@ t.test('ls --json', (t) => {
t.deepEqual(
jsonParse(result),
{
- 'dependencies': {
- 'a': {
- 'version': '1.0.0'
- },
- 'b': {
- 'version': '1.0.0',
- 'dependencies': {
- 'c': {
- 'version': '1.0.0'
- }
- }
- }
- }
+ dependencies: {
+ a: {
+ version: '1.0.0',
+ },
+ b: {
+ version: '1.0.0',
+ dependencies: {
+ c: {
+ version: '1.0.0',
+ },
+ },
+ },
+ },
},
'should print json output for global deps'
)