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:
authornlf <quitlahok@gmail.com>2021-04-15 20:35:51 +0300
committerRuy Adorno <ruyadorno@hotmail.com>2021-04-22 16:49:46 +0300
commit42ca59eeedd3e402aa1c606941f7f52864e6039b (patch)
tree48850769adba5ada1828f8c7309c5b28a8063ebc /test
parenta4e7f4e4b40d645fed97622a97c7fa72aa5da82b (diff)
fix(ls): do not exit with error when all problems are extraneous deps
PR-URL: https://github.com/npm/cli/pull/3086 Credit: @nlf Close: #3086 Reviewed-by: @wraithgar, @ruyadorno
Diffstat (limited to 'test')
-rw-r--r--test/lib/ls.js39
1 files changed, 8 insertions, 31 deletions
diff --git a/test/lib/ls.js b/test/lib/ls.js
index 6eab0b05b..5b13f808d 100644
--- a/test/lib/ls.js
+++ b/test/lib/ls.js
@@ -149,11 +149,7 @@ t.test('ls', (t) => {
...simpleNmFixture,
})
ls.exec([], (err) => {
- t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
- t.matchSnapshot(
- redactCwd(err.message),
- 'should log all extraneous deps on error msg'
- )
+ t.error(err) // should not error for extraneous
t.matchSnapshot(redactCwd(result), 'should output tree missing name/version of top-level package')
t.end()
})
@@ -171,12 +167,7 @@ t.test('ls', (t) => {
...simpleNmFixture,
})
ls.exec([], (err) => {
- t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
- t.equal(
- redactCwd(err.message),
- 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls-extraneous-deps/node_modules/lorem',
- 'should log extraneous dep as error'
- )
+ t.error(err) // should not error for extraneous
t.matchSnapshot(redactCwd(result), 'should output containing problems info')
t.end()
})
@@ -1410,7 +1401,7 @@ t.test('ls', (t) => {
})
ls.exec(['c'], (err) => {
- t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
+ t.error(err) // should not error for extraneous
t.matchSnapshot(redactCwd(result), 'should print tree and not duplicate child of missing items')
t.end()
})
@@ -1570,11 +1561,7 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
ls.exec([], (err) => {
- t.match(err.code, 'ELSPROBLEMS', 'should have ELSPROBLEMS error code')
- t.matchSnapshot(
- redactCwd(err.message),
- 'should log all extraneous deps on error msg'
- )
+ t.error(err) // should not error for extraneous
t.matchSnapshot(redactCwd(result), 'should output parseable missing name/version of top-level package')
t.end()
})
@@ -1592,7 +1579,7 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
ls.exec([], (err) => {
- t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
+ t.error(err) // should not error for extraneous
t.matchSnapshot(redactCwd(result), 'should output containing problems info')
t.end()
})
@@ -1973,8 +1960,7 @@ t.test('ls --parseable', (t) => {
...simpleNmFixture,
})
ls.exec([], (err) => {
- t.equal(err.code, 'ELSPROBLEMS', 'should have error code')
- t.match(redactCwd(err.message), 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/lorem', 'should have error code')
+ t.error(err) // should not error for extraneous
t.matchSnapshot(redactCwd(result), 'should output long parseable output with extraneous info')
t.end()
})
@@ -2414,7 +2400,7 @@ t.test('ls --json', (t) => {
...simpleNmFixture,
})
ls.exec([], (err) => {
- t.match(err, { code: 'ELSPROBLEMS' }, 'should list dep problems')
+ t.error(err) // should not error for extraneous
t.same(
jsonParse(result),
{
@@ -2470,16 +2456,7 @@ t.test('ls --json', (t) => {
...simpleNmFixture,
})
ls.exec([], (err) => {
- t.equal(
- redactCwd(err.message),
- 'extraneous: lorem@1.0.0 {CWD}/tap-testdir-ls-ls---json-extraneous-deps/node_modules/lorem',
- 'should log extraneous dep as error'
- )
- t.equal(
- err.code,
- 'ELSPROBLEMS',
- 'should have ELSPROBLEMS error code'
- )
+ t.error(err) // should not error for extraneous
t.same(
jsonParse(result),
{