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

[Fix] properly determine length of rootValids for engine in isSame comparison #23

Merged
merged 1 commit into from
Oct 17, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/ls-engines
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async function checkEngines(rootNode, rootValids, graphValids, displayRange, sho
const superset = [];
selectedEngines.forEach((engine) => {
const all = new Set(rootValids[engine].concat(graphValids[engine]));
const isSame = all.size === rootValids[engine.length] && all.size === graphValids[engine].length;
const isSame = all.size === rootValids[engine].length && all.size === graphValids[engine].length;
const rootIsSubsetOfGraph = isSubset(rootValids[engine], graphValids[engine]);
const graphIsSubsetOfRoot = isSubset(graphValids[engine], rootValids[engine]);
if (isSame) {
Expand Down
1 change: 1 addition & 0 deletions test/fixtures/graph-root-same/actual-code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUCCESS
1 change: 1 addition & 0 deletions test/fixtures/graph-root-same/actual-dev-code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INEXACT
6 changes: 6 additions & 0 deletions test/fixtures/graph-root-same/actual-dev-stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Your “engines” field allows more node versions than your dependency graph does.

If you want to narrow your support, you can run `ls-engines --save`, or manually add the following to your `package.json`:
"engines": {
"node": "^16 || ^15 || ^14.13 || ^12.20"
}
11 changes: 11 additions & 0 deletions test/fixtures/graph-root-same/actual-dev-stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
`node_modules` found, mode is “actual”; loading tree from disk...

Valid node version range: ^16 || ^15 || ^14.13 || ^12.20

Currently available latest releases of each valid node major version: <node versions for above semver range>

┌────────┬─────────────────┬─────────────────┬──────────────────────────┐
│ engine │ current version │ valid (package) │ valid (dependency graph) │
├────────┼─────────────────┼─────────────────┼──────────────────────────┤
│ node │ ${process.version} │ yes! │ yes! │
└────────┴─────────────────┴─────────────────┴──────────────────────────┘
1 change: 1 addition & 0 deletions test/fixtures/graph-root-same/actual-peer-code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUCCESS
Empty file.
13 changes: 13 additions & 0 deletions test/fixtures/graph-root-same/actual-peer-stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
`node_modules` found, mode is “actual”; loading tree from disk...

Valid node version range: ^16 || ^15 || ^14 || ^13 || ^12 || ^11 || ^10

Currently available latest releases of each valid node major version: <node versions for above semver range>

Your “engines” field exactly matches your dependency graph’s requirements!

┌────────┬─────────────────┬─────────────────┬──────────────────────────┐
│ engine │ current version │ valid (package) │ valid (dependency graph) │
├────────┼─────────────────┼─────────────────┼──────────────────────────┤
│ node │ ${process.version} │ yes! │ yes! │
└────────┴─────────────────┴─────────────────┴──────────────────────────┘
1 change: 1 addition & 0 deletions test/fixtures/graph-root-same/actual-production-code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUCCESS
Empty file.
13 changes: 13 additions & 0 deletions test/fixtures/graph-root-same/actual-production-stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
`node_modules` found, mode is “actual”; loading tree from disk...

Valid node version range: ^16 || ^15 || ^14 || ^13 || ^12 || ^11 || ^10

Currently available latest releases of each valid node major version: <node versions for above semver range>

Your “engines” field exactly matches your dependency graph’s requirements!

┌────────┬─────────────────┬─────────────────┬──────────────────────────┐
│ engine │ current version │ valid (package) │ valid (dependency graph) │
├────────┼─────────────────┼─────────────────┼──────────────────────────┤
│ node │ ${process.version} │ yes! │ yes! │
└────────┴─────────────────┴─────────────────┴──────────────────────────┘
Empty file.
13 changes: 13 additions & 0 deletions test/fixtures/graph-root-same/actual-stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
`node_modules` found, mode is “actual”; loading tree from disk...

Valid node version range: ^16 || ^15 || ^14 || ^13 || ^12 || ^11 || ^10

Currently available latest releases of each valid node major version: <node versions for above semver range>

Your “engines” field exactly matches your dependency graph’s requirements!

┌────────┬─────────────────┬─────────────────┬──────────────────────────┐
│ engine │ current version │ valid (package) │ valid (dependency graph) │
├────────┼─────────────────┼─────────────────┼──────────────────────────┤
│ node │ ${process.version} │ yes! │ yes! │
└────────┴─────────────────┴─────────────────┴──────────────────────────┘
1 change: 1 addition & 0 deletions test/fixtures/graph-root-same/ideal-code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUCCESS
1 change: 1 addition & 0 deletions test/fixtures/graph-root-same/ideal-dev-code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
INEXACT
6 changes: 6 additions & 0 deletions test/fixtures/graph-root-same/ideal-dev-stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Your “engines” field allows more node versions than your dependency graph does.

If you want to narrow your support, you can run `ls-engines --save`, or manually add the following to your `package.json`:
"engines": {
"node": "^16 || ^15 || ^14.13 || ^12.20"
}
11 changes: 11 additions & 0 deletions test/fixtures/graph-root-same/ideal-dev-stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
`package.json` found, mode is “ideal”; building ideal tree from `package.json`...

Valid node version range: ^16 || ^15 || ^14.13 || ^12.20

Currently available latest releases of each valid node major version: <node versions for above semver range>

┌────────┬─────────────────┬─────────────────┬──────────────────────────┐
│ engine │ current version │ valid (package) │ valid (dependency graph) │
├────────┼─────────────────┼─────────────────┼──────────────────────────┤
│ node │ ${process.version} │ yes! │ yes! │
└────────┴─────────────────┴─────────────────┴──────────────────────────┘
1 change: 1 addition & 0 deletions test/fixtures/graph-root-same/ideal-peer-code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUCCESS
Empty file.
13 changes: 13 additions & 0 deletions test/fixtures/graph-root-same/ideal-peer-stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
`package.json` found, mode is “ideal”; building ideal tree from `package.json`...

Valid node version range: ^16 || ^15 || ^14 || ^13 || ^12 || ^11 || ^10

Currently available latest releases of each valid node major version: <node versions for above semver range>

Your “engines” field exactly matches your dependency graph’s requirements!

┌────────┬─────────────────┬─────────────────┬──────────────────────────┐
│ engine │ current version │ valid (package) │ valid (dependency graph) │
├────────┼─────────────────┼─────────────────┼──────────────────────────┤
│ node │ ${process.version} │ yes! │ yes! │
└────────┴─────────────────┴─────────────────┴──────────────────────────┘
1 change: 1 addition & 0 deletions test/fixtures/graph-root-same/ideal-production-code
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
SUCCESS
Empty file.
13 changes: 13 additions & 0 deletions test/fixtures/graph-root-same/ideal-production-stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
`package.json` found, mode is “ideal”; building ideal tree from `package.json`...

Valid node version range: ^16 || ^15 || ^14 || ^13 || ^12 || ^11 || ^10

Currently available latest releases of each valid node major version: <node versions for above semver range>

Your “engines” field exactly matches your dependency graph’s requirements!

┌────────┬─────────────────┬─────────────────┬──────────────────────────┐
│ engine │ current version │ valid (package) │ valid (dependency graph) │
├────────┼─────────────────┼─────────────────┼──────────────────────────┤
│ node │ ${process.version} │ yes! │ yes! │
└────────┴─────────────────┴─────────────────┴──────────────────────────┘
Empty file.
13 changes: 13 additions & 0 deletions test/fixtures/graph-root-same/ideal-stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
`package.json` found, mode is “ideal”; building ideal tree from `package.json`...

Valid node version range: ^16 || ^15 || ^14 || ^13 || ^12 || ^11 || ^10

Currently available latest releases of each valid node major version: <node versions for above semver range>

Your “engines” field exactly matches your dependency graph’s requirements!

┌────────┬─────────────────┬─────────────────┬──────────────────────────┐
│ engine │ current version │ valid (package) │ valid (dependency graph) │
├────────┼─────────────────┼─────────────────┼──────────────────────────┤
│ node │ ${process.version} │ yes! │ yes! │
└────────┴─────────────────┴─────────────────┴──────────────────────────┘
Loading