diff options
author | isaacs <i@izs.me> | 2021-04-01 21:50:59 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-04-01 22:47:29 +0300 |
commit | cb6eb0d206b7e2f63d5c7a7a17bea4aed1b9f2bf (patch) | |
tree | ac007ae33240d3ba1de52e6538d5a45f9025856c /tap-snapshots | |
parent | 9237d375b0b7d34c7dc5ba70aec7f616f4133732 (diff) |
Support reporting on ERESOLVE errors when current is missing
While it is somewhat helpful to get reports on this, since it indicates
an underlying problem in Arborist, it's also very disruptive and
unhelpful for users. As of 2.3.0, Arborist gives us the currentEdge if
available, so we _can_ report on that at least. If there is no node
_or_ edge, then we just don't say what the current state is, which isn't
useful, but at least is less annoying than a 'property of null'
exception.
PR-URL: https://github.com/npm/cli/pull/3015
Credit: @isaacs
Close: #3015
Reviewed-by: @wraithgar
Diffstat (limited to 'tap-snapshots')
-rw-r--r-- | tap-snapshots/test-lib-utils-explain-eresolve.js-TAP.test.js | 182 |
1 files changed, 182 insertions, 0 deletions
diff --git a/tap-snapshots/test-lib-utils-explain-eresolve.js-TAP.test.js b/tap-snapshots/test-lib-utils-explain-eresolve.js-TAP.test.js index 87dcb861c..e06668015 100644 --- a/tap-snapshots/test-lib-utils-explain-eresolve.js-TAP.test.js +++ b/tap-snapshots/test-lib-utils-explain-eresolve.js-TAP.test.js @@ -418,6 +418,188 @@ to accept an incorrect (and potentially broken) dependency resolution. See \${REPORT} for a full report. ` +exports[`test/lib/utils/explain-eresolve.js TAP no current node, but has current edge > explain with color 1`] = ` +While resolving: [1meslint[22m@[1m7.22.0[22m +Found: [33mdev[39m [1meslint[22m@"[1mfile:.[22m" from the root project + +Could not resolve dependency: +[35mpeer[39m [1meslint[22m@"[1m^6.0.0[22m" from [1meslint-plugin-jsdoc[22m@[1m22.2.0[22m[2m[22m +[2mnode_modules/eslint-plugin-jsdoc[22m + [33mdev[39m [1meslint-plugin-jsdoc[22m@"[1m^22.1.0[22m" from the root project +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, but has current edge > explain with no color, depth of 6 1`] = ` +While resolving: eslint@7.22.0 +Found: dev eslint@"file:." from the root project + +Could not resolve dependency: +peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0 +node_modules/eslint-plugin-jsdoc + dev eslint-plugin-jsdoc@"^22.1.0" from the root project +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, but has current edge > report 1`] = ` +# npm resolution error report + +\${TIME} + +While resolving: eslint@7.22.0 +Found: dev eslint@"file:." from the root project + +Could not resolve dependency: +peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0 +node_modules/eslint-plugin-jsdoc + dev eslint-plugin-jsdoc@"^22.1.0" from the root project + +Fix the upstream dependency conflict, or retry +this command with --force, or --legacy-peer-deps +to accept an incorrect (and potentially broken) dependency resolution. + +Raw JSON explanation object: + +{ + "name": "no current node, but has current edge", + "json": true +} + +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, but has current edge > report with color 1`] = ` +While resolving: [1meslint[22m@[1m7.22.0[22m +Found: [33mdev[39m [1meslint[22m@"[1mfile:.[22m" from the root project + +Could not resolve dependency: +[35mpeer[39m [1meslint[22m@"[1m^6.0.0[22m" from [1meslint-plugin-jsdoc[22m@[1m22.2.0[22m[2m[22m +[2mnode_modules/eslint-plugin-jsdoc[22m + [33mdev[39m [1meslint-plugin-jsdoc[22m@"[1m^22.1.0[22m" from the root project + +Fix the upstream dependency conflict, or retry +this command with --force, or --legacy-peer-deps +to accept an incorrect (and potentially broken) dependency resolution. + +See \${REPORT} for a full report. +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, but has current edge > report with color, depth only 2 1`] = ` +While resolving: [1meslint[22m@[1m7.22.0[22m +Found: [33mdev[39m [1meslint[22m@"[1mfile:.[22m" from the root project + +Could not resolve dependency: +[35mpeer[39m [1meslint[22m@"[1m^6.0.0[22m" from [1meslint-plugin-jsdoc[22m@[1m22.2.0[22m[2m[22m +[2mnode_modules/eslint-plugin-jsdoc[22m + [33mdev[39m [1meslint-plugin-jsdoc[22m@"[1m^22.1.0[22m" from the root project + +Fix the upstream dependency conflict, or retry +this command with --force, or --legacy-peer-deps +to accept an incorrect (and potentially broken) dependency resolution. + +See \${REPORT} for a full report. +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, but has current edge > report with no color, depth of 6 1`] = ` +While resolving: eslint@7.22.0 +Found: dev eslint@"file:." from the root project + +Could not resolve dependency: +peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0 +node_modules/eslint-plugin-jsdoc + dev eslint-plugin-jsdoc@"^22.1.0" from the root project + +Fix the upstream dependency conflict, or retry +this command with --force, or --legacy-peer-deps +to accept an incorrect (and potentially broken) dependency resolution. + +See \${REPORT} for a full report. +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, no current edge, idk > explain with color 1`] = ` +While resolving: [1meslint[22m@[1m7.22.0[22m + +Could not resolve dependency: +[35mpeer[39m [1meslint[22m@"[1m^6.0.0[22m" from [1meslint-plugin-jsdoc[22m@[1m22.2.0[22m[2m[22m +[2mnode_modules/eslint-plugin-jsdoc[22m + [33mdev[39m [1meslint-plugin-jsdoc[22m@"[1m^22.1.0[22m" from the root project +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, no current edge, idk > explain with no color, depth of 6 1`] = ` +While resolving: eslint@7.22.0 + +Could not resolve dependency: +peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0 +node_modules/eslint-plugin-jsdoc + dev eslint-plugin-jsdoc@"^22.1.0" from the root project +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, no current edge, idk > report 1`] = ` +# npm resolution error report + +\${TIME} + +While resolving: eslint@7.22.0 + +Could not resolve dependency: +peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0 +node_modules/eslint-plugin-jsdoc + dev eslint-plugin-jsdoc@"^22.1.0" from the root project + +Fix the upstream dependency conflict, or retry +this command with --force, or --legacy-peer-deps +to accept an incorrect (and potentially broken) dependency resolution. + +Raw JSON explanation object: + +{ + "name": "no current node, no current edge, idk", + "json": true +} + +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, no current edge, idk > report with color 1`] = ` +While resolving: [1meslint[22m@[1m7.22.0[22m + +Could not resolve dependency: +[35mpeer[39m [1meslint[22m@"[1m^6.0.0[22m" from [1meslint-plugin-jsdoc[22m@[1m22.2.0[22m[2m[22m +[2mnode_modules/eslint-plugin-jsdoc[22m + [33mdev[39m [1meslint-plugin-jsdoc[22m@"[1m^22.1.0[22m" from the root project + +Fix the upstream dependency conflict, or retry +this command with --force, or --legacy-peer-deps +to accept an incorrect (and potentially broken) dependency resolution. + +See \${REPORT} for a full report. +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, no current edge, idk > report with color, depth only 2 1`] = ` +While resolving: [1meslint[22m@[1m7.22.0[22m + +Could not resolve dependency: +[35mpeer[39m [1meslint[22m@"[1m^6.0.0[22m" from [1meslint-plugin-jsdoc[22m@[1m22.2.0[22m[2m[22m +[2mnode_modules/eslint-plugin-jsdoc[22m + [33mdev[39m [1meslint-plugin-jsdoc[22m@"[1m^22.1.0[22m" from the root project + +Fix the upstream dependency conflict, or retry +this command with --force, or --legacy-peer-deps +to accept an incorrect (and potentially broken) dependency resolution. + +See \${REPORT} for a full report. +` + +exports[`test/lib/utils/explain-eresolve.js TAP no current node, no current edge, idk > report with no color, depth of 6 1`] = ` +While resolving: eslint@7.22.0 + +Could not resolve dependency: +peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0 +node_modules/eslint-plugin-jsdoc + dev eslint-plugin-jsdoc@"^22.1.0" from the root project + +Fix the upstream dependency conflict, or retry +this command with --force, or --legacy-peer-deps +to accept an incorrect (and potentially broken) dependency resolution. + +See \${REPORT} for a full report. +` + exports[`test/lib/utils/explain-eresolve.js TAP withShrinkwrap > explain with color 1`] = ` While resolving: [1m@isaacs/peer-dep-cycle-b[22m@[1m1.0.0[22m Found: [1m@isaacs/peer-dep-cycle-c[22m@[1m2.0.0[22m[2m[22m |