Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Isaacs/update arborist 2.8.0 #3588

Merged
merged 1 commit into from Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 11 additions & 4 deletions lib/utils/explain-eresolve.js
Expand Up @@ -9,26 +9,33 @@ const { explainEdge, explainNode, printNode } = require('./explain-dep.js')
// The full report (ie, depth=Infinity) is always written to the cache folder
// at ${cache}/eresolve-report.txt along with full json.
const explain = (expl, color, depth) => {
const { edge, current, peerConflict, currentEdge } = expl
const { edge, dep, current, peerConflict, currentEdge } = expl

const out = []
if (edge.from && edge.from.whileInstalling)
out.push('While resolving: ' + printNode(edge.from.whileInstalling, color))
const whileInstalling = dep && dep.whileInstalling ||
current && current.whileInstalling ||
edge && edge.from && edge.from.whileInstalling
if (whileInstalling)
out.push('While resolving: ' + printNode(whileInstalling, color))

// it "should" be impossible for an ERESOLVE explanation to lack both
// current and currentEdge, but better to have a less helpful error
// than a crashing failure.
if (current)
out.push('Found: ' + explainNode(current, depth, color))
else if (peerConflict && peerConflict.current)
out.push('Found: ' + explainNode(peerConflict.current, depth, color))
else if (currentEdge)
out.push('Found: ' + explainEdge(currentEdge, depth, color))
else /* istanbul ignore else - should always have one */ if (edge)
out.push('Found: ' + explainEdge(edge, depth, color))

out.push('\nCould not resolve dependency:\n' +
explainEdge(edge, depth, color))

if (peerConflict) {
const heading = '\nConflicting peer dependency:'
const pc = explainNode(peerConflict, depth, color)
const pc = explainNode(peerConflict.peer, depth, color)
out.push(heading + ' ' + pc)
}

Expand Down
151 changes: 151 additions & 0 deletions tap-snapshots/test/lib/utils/explain-eresolve.js.test.cjs
Expand Up @@ -215,6 +215,142 @@ to accept an incorrect (and potentially broken) dependency resolution.
See \${REPORT} for a full report.
`

exports[`test/lib/utils/explain-eresolve.js TAP eslint-plugin case > explain with color, depth of 2 1`] = `
While resolving: eslint-plugin-react@7.24.0
Found: eslint@6.8.0
node_modules/eslint
dev eslint@"^3 || ^4 || ^5 || ^6 || ^7" from the root project
3 more (@typescript-eslint/parser, ...)

Could not resolve dependency:
dev eslint-plugin-eslint-plugin@"^3.1.0" from the root project

Conflicting peer dependency: eslint@7.31.0
node_modules/eslint
peer eslint@"^7.0.0" from eslint-plugin-eslint-plugin@3.5.1
node_modules/eslint-plugin-eslint-plugin
dev eslint-plugin-eslint-plugin@"^3.1.0" from the root project
`

exports[`test/lib/utils/explain-eresolve.js TAP eslint-plugin case > explain with no color, depth of 6 1`] = `
While resolving: eslint-plugin-react@7.24.0
Found: eslint@6.8.0
node_modules/eslint
dev eslint@"^3 || ^4 || ^5 || ^6 || ^7" from the root project
peer eslint@"^5.0.0 || ^6.0.0" from @typescript-eslint/parser@2.34.0
node_modules/@typescript-eslint/parser
dev @typescript-eslint/parser@"^2.34.0" from the root project
peer eslint@"^5.16.0 || ^6.8.0 || ^7.2.0" from eslint-config-airbnb-base@14.2.1
node_modules/eslint-config-airbnb-base
dev eslint-config-airbnb-base@"^14.2.1" from the root project
1 more (eslint-plugin-import)

Could not resolve dependency:
dev eslint-plugin-eslint-plugin@"^3.1.0" from the root project

Conflicting peer dependency: eslint@7.31.0
node_modules/eslint
peer eslint@"^7.0.0" from eslint-plugin-eslint-plugin@3.5.1
node_modules/eslint-plugin-eslint-plugin
dev eslint-plugin-eslint-plugin@"^3.1.0" from the root project
`

exports[`test/lib/utils/explain-eresolve.js TAP eslint-plugin case > report 1`] = `
# npm resolution error report

\${TIME}

While resolving: eslint-plugin-react@7.24.0
Found: eslint@6.8.0
node_modules/eslint
dev eslint@"^3 || ^4 || ^5 || ^6 || ^7" from the root project
peer eslint@"^5.0.0 || ^6.0.0" from @typescript-eslint/parser@2.34.0
node_modules/@typescript-eslint/parser
dev @typescript-eslint/parser@"^2.34.0" from the root project
peer eslint@"^5.16.0 || ^6.8.0 || ^7.2.0" from eslint-config-airbnb-base@14.2.1
node_modules/eslint-config-airbnb-base
dev eslint-config-airbnb-base@"^14.2.1" from the root project
peer eslint@"^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0" from eslint-plugin-import@2.23.4
node_modules/eslint-plugin-import
dev eslint-plugin-import@"^2.23.4" from the root project
peer eslint-plugin-import@"^2.22.1" from eslint-config-airbnb-base@14.2.1
node_modules/eslint-config-airbnb-base
dev eslint-config-airbnb-base@"^14.2.1" from the root project

Could not resolve dependency:
dev eslint-plugin-eslint-plugin@"^3.1.0" from the root project

Conflicting peer dependency: eslint@7.31.0
node_modules/eslint
peer eslint@"^7.0.0" from eslint-plugin-eslint-plugin@3.5.1
node_modules/eslint-plugin-eslint-plugin
dev eslint-plugin-eslint-plugin@"^3.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": "eslint-plugin case",
"json": true
}

`

exports[`test/lib/utils/explain-eresolve.js TAP eslint-plugin case > report with color 1`] = `
While resolving: eslint-plugin-react@7.24.0
Found: eslint@6.8.0
node_modules/eslint
dev eslint@"^3 || ^4 || ^5 || ^6 || ^7" from the root project
peer eslint@"^5.0.0 || ^6.0.0" from @typescript-eslint/parser@2.34.0
node_modules/@typescript-eslint/parser
dev @typescript-eslint/parser@"^2.34.0" from the root project
2 more (eslint-config-airbnb-base, eslint-plugin-import)

Could not resolve dependency:
dev eslint-plugin-eslint-plugin@"^3.1.0" from the root project

Conflicting peer dependency: eslint@7.31.0
node_modules/eslint
peer eslint@"^7.0.0" from eslint-plugin-eslint-plugin@3.5.1
node_modules/eslint-plugin-eslint-plugin
dev eslint-plugin-eslint-plugin@"^3.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 eslint-plugin case > report with no color 1`] = `
While resolving: eslint-plugin-react@7.24.0
Found: eslint@6.8.0
node_modules/eslint
dev eslint@"^3 || ^4 || ^5 || ^6 || ^7" from the root project
peer eslint@"^5.0.0 || ^6.0.0" from @typescript-eslint/parser@2.34.0
node_modules/@typescript-eslint/parser
dev @typescript-eslint/parser@"^2.34.0" from the root project
2 more (eslint-config-airbnb-base, eslint-plugin-import)

Could not resolve dependency:
dev eslint-plugin-eslint-plugin@"^3.1.0" from the root project

Conflicting peer dependency: eslint@7.31.0
node_modules/eslint
peer eslint@"^7.0.0" from eslint-plugin-eslint-plugin@3.5.1
node_modules/eslint-plugin-eslint-plugin
dev eslint-plugin-eslint-plugin@"^3.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 gatsby > explain with color, depth of 2 1`] = `
While resolving: gatsby-recipes@0.2.31
Found: ink@3.0.0-7
Expand Down Expand Up @@ -433,6 +569,9 @@ See \${REPORT} for a full report.

exports[`test/lib/utils/explain-eresolve.js TAP no current node, no current edge, idk > explain with color, depth of 2 1`] = `
While resolving: eslint@7.22.0
Found: 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

Could not resolve dependency:
peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0
Expand All @@ -442,6 +581,9 @@ Could not resolve dependency:

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
Found: 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

Could not resolve dependency:
peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0
Expand All @@ -455,6 +597,9 @@ exports[`test/lib/utils/explain-eresolve.js TAP no current node, no current edge
\${TIME}

While resolving: eslint@7.22.0
Found: 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

Could not resolve dependency:
peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0
Expand All @@ -476,6 +621,9 @@ Raw JSON explanation object:

exports[`test/lib/utils/explain-eresolve.js TAP no current node, no current edge, idk > report with color 1`] = `
While resolving: eslint@7.22.0
Found: 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

Could not resolve dependency:
peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0
Expand All @@ -491,6 +639,9 @@ 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 1`] = `
While resolving: eslint@7.22.0
Found: 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

Could not resolve dependency:
peer eslint@"^6.0.0" from eslint-plugin-jsdoc@22.2.0
Expand Down