From 5fbc6012861f7f124d85427292c3620f31e70ce4 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Tue, 23 Apr 2024 13:46:00 -0700 Subject: [PATCH 1/2] chore: run fixture tests sequentially --- workspaces/arborist/package.json | 1 + .../test/arborist/load-actual.js.test.cjs | 100 +++++------ .../tap-snapshots/test/shrinkwrap.js.test.cjs | 164 +++++++++--------- workspaces/arborist/test/arborist/audit.js | 2 +- .../test/arborist/build-ideal-tree.js | 38 ++-- workspaces/arborist/test/arborist/index.js | 6 +- .../arborist/test/arborist/load-virtual.js | 48 ++--- workspaces/arborist/test/arborist/rebuild.js | 2 +- workspaces/arborist/test/arborist/reify.js | 7 +- workspaces/arborist/test/audit-report.js | 5 +- workspaces/arborist/test/fixtures/.gitignore | 2 +- workspaces/arborist/test/fixtures/README.md | 15 +- workspaces/arborist/test/fixtures/cleanup.js | 31 +--- workspaces/arborist/test/fixtures/index.js | 71 ++++++-- workspaces/arborist/test/fixtures/setup.js | 1 + .../arborist/test/get-workspace-nodes.js | 3 +- .../load-actual-ctor-throw.js | 9 +- .../test/{arborist => serial}/load-actual.js | 43 +++-- .../arborist/test/{ => serial}/shrinkwrap.js | 45 +++-- .../arborist/test/serial/tap-parallel-not-ok | 0 workspaces/arborist/test/yarn-lock.js | 11 +- 21 files changed, 315 insertions(+), 289 deletions(-) create mode 100644 workspaces/arborist/test/fixtures/setup.js rename workspaces/arborist/test/{arborist => serial}/load-actual-ctor-throw.js (90%) rename workspaces/arborist/test/{arborist => serial}/load-actual.js (95%) rename workspaces/arborist/test/{ => serial}/shrinkwrap.js (98%) create mode 100644 workspaces/arborist/test/serial/tap-parallel-not-ok diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index 9350e16352b6c..8acedefdc99aa 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -76,6 +76,7 @@ "arborist": "bin/index.js" }, "tap": { + "before": "test/fixtures/setup.js", "after": "test/fixtures/cleanup.js", "test-env": [ "LC_ALL=sk" diff --git a/workspaces/arborist/tap-snapshots/test/arborist/load-actual.js.test.cjs b/workspaces/arborist/tap-snapshots/test/arborist/load-actual.js.test.cjs index 35ba9f7cafa84..72fd5a66472a0 100644 --- a/workspaces/arborist/tap-snapshots/test/arborist/load-actual.js.test.cjs +++ b/workspaces/arborist/tap-snapshots/test/arborist/load-actual.js.test.cjs @@ -5,7 +5,7 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/arborist/load-actual.js TAP bundle > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP bundle > loaded tree 1`] = ` ArboristNode { "bundleDependencies": Array [ "dep", @@ -41,7 +41,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP cwd is default root > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP cwd is default root > loaded tree 1`] = ` ArboristNode { "children": Map { "@scope/x" => ArboristNode { @@ -369,7 +369,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP deepmixedloop > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP deepmixedloop > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristNode { @@ -623,7 +623,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP deeproot/root > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP deeproot/root > loaded tree 1`] = ` ArboristLink { "isProjectRoot": true, "location": "../deeproot/root", @@ -960,7 +960,7 @@ ArboristLink { } ` -exports[`test/arborist/load-actual.js TAP devloop > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP devloop > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristNode { @@ -1084,7 +1084,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP do not load from a hidden lockfile when forceActual is set > must match snapshot 1`] = ` +exports[`test/serial/load-actual.js TAP do not load from a hidden lockfile when forceActual is set > must match snapshot 1`] = ` ArboristNode { "children": Map { "abbrev" => ArboristNode { @@ -1117,7 +1117,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP external-dep/root > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP external-dep/root > loaded tree 1`] = ` ArboristNode { "edgesOut": Map { "dep" => EdgeOut { @@ -1136,7 +1136,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP external-link-cached-dummy-dep/root > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP external-link-cached-dummy-dep/root > loaded tree 1`] = ` ArboristNode { "children": Map { "x" => ArboristLink { @@ -1229,7 +1229,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP external-link/root > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP external-link/root > loaded tree 1`] = ` ArboristNode { "children": Map { "j" => ArboristLink { @@ -1411,7 +1411,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP install-types > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP install-types > loaded tree 1`] = ` ArboristNode { "children": Map { "abbrev" => ArboristNode { @@ -2080,7 +2080,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP link-dep-cycle > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP link-dep-cycle > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristLink { @@ -2209,7 +2209,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP link-dep-nested > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP link-dep-nested > loaded tree 1`] = ` ArboristNode { "children": Map { "foo" => ArboristLink { @@ -2314,7 +2314,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP link-dep-nested/root > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP link-dep-nested/root > loaded tree 1`] = ` ArboristNode { "children": Map { "bork" => ArboristLink { @@ -2452,7 +2452,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP linkedroot > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP linkedroot > loaded tree 1`] = ` ArboristLink { "isProjectRoot": true, "location": "../linkedroot", @@ -2790,7 +2790,7 @@ ArboristLink { } ` -exports[`test/arborist/load-actual.js TAP links-all-over > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP links-all-over > loaded tree 1`] = ` ArboristNode { "children": Map { "link-deep" => ArboristLink { @@ -3106,7 +3106,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP load a global space > expect resolving Promise 1`] = ` +exports[`test/serial/load-actual.js TAP load a global space > expect resolving Promise 1`] = ` ArboristNode { "children": Map { "rimraf" => ArboristNode { @@ -3441,7 +3441,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP load a global space symlink > expect resolving Promise 1`] = ` +exports[`test/serial/load-actual.js TAP load a global space symlink > expect resolving Promise 1`] = ` ArboristLink { "isProjectRoot": true, "location": "../lib-link", @@ -3784,7 +3784,7 @@ ArboristLink { } ` -exports[`test/arborist/load-actual.js TAP load a global space with a filter > expect resolving Promise 1`] = ` +exports[`test/serial/load-actual.js TAP load a global space with a filter > expect resolving Promise 1`] = ` ArboristNode { "isProjectRoot": true, "location": "", @@ -3793,7 +3793,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP load from a hidden lockfile > must match snapshot 1`] = ` +exports[`test/serial/load-actual.js TAP load from a hidden lockfile > must match snapshot 1`] = ` ArboristNode { "children": Map { "abbrev" => ArboristNode { @@ -3827,27 +3827,27 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP load workspace targets, even if links not present > must match snapshot 1`] = ` +exports[`test/serial/load-actual.js TAP load workspace targets, even if links not present > must match snapshot 1`] = ` ArboristNode { "edgesOut": Map { "a" => EdgeOut { "error": "MISSING", "name": "a", - "spec": "file:{CWD}/test/arborist/tap-testdir-load-actual-load-workspace-targets-even-if-links-not-present/packages/a", + "spec": "file:{CWD}/test/serial/tap-testdir-load-actual-load-workspace-targets-even-if-links-not-present/packages/a", "to": null, "type": "workspace", }, "b" => EdgeOut { "error": "MISSING", "name": "b", - "spec": "file:{CWD}/test/arborist/tap-testdir-load-actual-load-workspace-targets-even-if-links-not-present/packages/b", + "spec": "file:{CWD}/test/serial/tap-testdir-load-actual-load-workspace-targets-even-if-links-not-present/packages/b", "to": null, "type": "workspace", }, "c" => EdgeOut { "error": "MISSING", "name": "c", - "spec": "file:{CWD}/test/arborist/tap-testdir-load-actual-load-workspace-targets-even-if-links-not-present/packages/c", + "spec": "file:{CWD}/test/serial/tap-testdir-load-actual-load-workspace-targets-even-if-links-not-present/packages/c", "to": null, "type": "workspace", }, @@ -3903,7 +3903,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP load workspaces when loading from hidding lockfile > actual tree 1`] = ` +exports[`test/serial/load-actual.js TAP load workspaces when loading from hidding lockfile > actual tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristLink { @@ -3911,7 +3911,7 @@ ArboristNode { EdgeIn { "from": "", "name": "a", - "spec": "file:{CWD}/test/arborist/tap-testdir-load-actual-load-workspaces-when-loading-from-hidding-lockfile/packages/a", + "spec": "file:{CWD}/test/serial/tap-testdir-load-actual-load-workspaces-when-loading-from-hidding-lockfile/packages/a", "type": "workspace", }, }, @@ -3931,7 +3931,7 @@ ArboristNode { EdgeIn { "from": "", "name": "b", - "spec": "file:{CWD}/test/arborist/tap-testdir-load-actual-load-workspaces-when-loading-from-hidding-lockfile/packages/b", + "spec": "file:{CWD}/test/serial/tap-testdir-load-actual-load-workspaces-when-loading-from-hidding-lockfile/packages/b", "type": "workspace", }, }, @@ -3950,13 +3950,13 @@ ArboristNode { "edgesOut": Map { "a" => EdgeOut { "name": "a", - "spec": "file:{CWD}/test/arborist/tap-testdir-load-actual-load-workspaces-when-loading-from-hidding-lockfile/packages/a", + "spec": "file:{CWD}/test/serial/tap-testdir-load-actual-load-workspaces-when-loading-from-hidding-lockfile/packages/a", "to": "node_modules/a", "type": "workspace", }, "b" => EdgeOut { "name": "b", - "spec": "file:{CWD}/test/arborist/tap-testdir-load-actual-load-workspaces-when-loading-from-hidding-lockfile/packages/b", + "spec": "file:{CWD}/test/serial/tap-testdir-load-actual-load-workspaces-when-loading-from-hidding-lockfile/packages/b", "to": "node_modules/b", "type": "workspace", }, @@ -3988,7 +3988,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP look for missing deps by default external-dep/root > "dep" should have missing deps, "link" should not 1`] = ` +exports[`test/serial/load-actual.js TAP look for missing deps by default external-dep/root > "dep" should have missing deps, "link" should not 1`] = ` ArboristNode { "edgesOut": Map { "dep" => EdgeOut { @@ -4007,7 +4007,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP look for missing deps by default external-link/root > "dep" should have missing deps, "link" should not 1`] = ` +exports[`test/serial/load-actual.js TAP look for missing deps by default external-link/root > "dep" should have missing deps, "link" should not 1`] = ` ArboristNode { "children": Map { "j" => ArboristLink { @@ -4189,7 +4189,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP looking outside of cwd > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP looking outside of cwd > loaded tree 1`] = ` ArboristNode { "children": Map { "@scope/x" => ArboristNode { @@ -4517,7 +4517,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP mixedloop > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP mixedloop > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristNode { @@ -4656,7 +4656,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP mixedmidway > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP mixedmidway > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristNode { @@ -5037,7 +5037,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP noname > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP noname > loaded tree 1`] = ` ArboristNode { "children": Map { "foo" => ArboristNode { @@ -5069,7 +5069,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP optionalloop > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP optionalloop > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristNode { @@ -5193,7 +5193,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP optofdev > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP optofdev > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristNode { @@ -5328,7 +5328,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP other > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP other > loaded tree 1`] = ` ArboristNode { "children": Map { "glob" => ArboristLink { @@ -5531,7 +5531,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP pnpm > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP pnpm > loaded tree 1`] = ` ArboristNode { "children": Map { "@scope/x" => ArboristLink { @@ -5833,7 +5833,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP root > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP root > loaded tree 1`] = ` ArboristNode { "children": Map { "@scope/x" => ArboristNode { @@ -6161,7 +6161,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP selflink > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP selflink > loaded tree 1`] = ` ArboristNode { "children": Map { "@scope/y" => ArboristNode { @@ -6392,7 +6392,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP shake out Link target timing issue > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP shake out Link target timing issue > loaded tree 1`] = ` ArboristNode { "children": Map { "@scope/y" => ArboristNode { @@ -6623,7 +6623,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP symlinked-node-modules/example > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP symlinked-node-modules/example > loaded tree 1`] = ` ArboristNode { "children": Map { "bar" => ArboristLink { @@ -6679,7 +6679,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP transplant workspace targets, even if links not present > do not transplant node named "a" 1`] = ` +exports[`test/serial/load-actual.js TAP transplant workspace targets, even if links not present > do not transplant node named "a" 1`] = ` ArboristNode { "dev": true, "edgesOut": Map { @@ -6732,7 +6732,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP transplant workspace targets, even if links not present > transplant everything 1`] = ` +exports[`test/serial/load-actual.js TAP transplant workspace targets, even if links not present > transplant everything 1`] = ` ArboristNode { "dev": true, "edgesOut": Map { @@ -6785,7 +6785,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP workspace > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP workspace > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristLink { @@ -7043,7 +7043,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP workspace2 > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP workspace2 > loaded tree 1`] = ` ArboristNode { "children": Map { "b" => ArboristNode { @@ -7212,7 +7212,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP workspace3 > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP workspace3 > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristLink { @@ -7551,7 +7551,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP workspaces load a simple install tree containing workspaces > expect resolving Promise 1`] = ` +exports[`test/serial/load-actual.js TAP workspaces load a simple install tree containing workspaces > expect resolving Promise 1`] = ` ArboristNode { "children": Map { "a" => ArboristLink { @@ -7651,7 +7651,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP workspaces-simple > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP workspaces-simple > loaded tree 1`] = ` ArboristNode { "children": Map { "a" => ArboristLink { @@ -7751,7 +7751,7 @@ ArboristNode { } ` -exports[`test/arborist/load-actual.js TAP yarn-lock-mkdirp-file-dep > loaded tree 1`] = ` +exports[`test/serial/load-actual.js TAP yarn-lock-mkdirp-file-dep > loaded tree 1`] = ` ArboristNode { "children": Map { "mkdirp" => ArboristNode { diff --git a/workspaces/arborist/tap-snapshots/test/shrinkwrap.js.test.cjs b/workspaces/arborist/tap-snapshots/test/shrinkwrap.js.test.cjs index 1b5a393f8846d..b52521d060731 100644 --- a/workspaces/arborist/tap-snapshots/test/shrinkwrap.js.test.cjs +++ b/workspaces/arborist/tap-snapshots/test/shrinkwrap.js.test.cjs @@ -5,7 +5,7 @@ * Make sure to inspect the output below. Do not ignore changes! */ 'use strict' -exports[`test/shrinkwrap.js TAP a yarn.lock entry with file: resolved > lockfile 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with file: resolved > lockfile 1`] = ` Object { "dependencies": Object { "mkdirp": Object { @@ -36,7 +36,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP a yarn.lock entry with file: resolved > yarn.lock 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with file: resolved > yarn.lock 1`] = ` # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 @@ -48,7 +48,7 @@ exports[`test/shrinkwrap.js TAP a yarn.lock entry with file: resolved > yarn.loc ` -exports[`test/shrinkwrap.js TAP a yarn.lock entry with integrity mismatch > lockfile 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with integrity mismatch > lockfile 1`] = ` Object { "dependencies": Object { "mkdirp": Object { @@ -78,7 +78,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP a yarn.lock entry with integrity mismatch > yarn.lock 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with integrity mismatch > yarn.lock 1`] = ` # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 @@ -90,7 +90,7 @@ mkdirp@^1.0.2: ` -exports[`test/shrinkwrap.js TAP a yarn.lock entry with no integrity > lockfile 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with no integrity > lockfile 1`] = ` Object { "dependencies": Object { "mkdirp": Object { @@ -118,7 +118,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP a yarn.lock entry with no integrity > yarn.lock 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with no integrity > yarn.lock 1`] = ` # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 @@ -129,7 +129,7 @@ mkdirp@^1.0.2: ` -exports[`test/shrinkwrap.js TAP a yarn.lock entry with no resolved > lockfile 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with no resolved > lockfile 1`] = ` Object { "dependencies": Object { "mkdirp": Object { @@ -157,7 +157,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP a yarn.lock entry with no resolved > yarn.lock 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with no resolved > yarn.lock 1`] = ` # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 @@ -168,7 +168,7 @@ mkdirp@^1.0.2: ` -exports[`test/shrinkwrap.js TAP a yarn.lock entry with version mismatch > lockfile 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with version mismatch > lockfile 1`] = ` Object { "dependencies": Object { "mkdirp": Object { @@ -194,7 +194,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP a yarn.lock entry with version mismatch > yarn.lock 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock entry with version mismatch > yarn.lock 1`] = ` # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 @@ -204,7 +204,7 @@ mkdirp@^1.0.2: ` -exports[`test/shrinkwrap.js TAP a yarn.lock with no entries > lockfile 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock with no entries > lockfile 1`] = ` Object { "dependencies": Object { "mkdirp": Object { @@ -230,7 +230,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP a yarn.lock with no entries > yarn.lock 1`] = ` +exports[`test/serial/shrinkwrap.js TAP a yarn.lock with no entries > yarn.lock 1`] = ` # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 @@ -240,7 +240,7 @@ mkdirp@^1.0.2: ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > a peer dep 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > a peer dep 1`] = ` Object { "dependencies": Object { "peerdep": "", @@ -252,7 +252,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > a peer meta-dep 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > a peer meta-dep 1`] = ` Object { "integrity": "sha512-peerdeppeerdep", "peer": true, @@ -261,7 +261,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > bundled pkg metadata 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > bundled pkg metadata 1`] = ` Object { "dev": true, "inBundle": true, @@ -270,7 +270,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > data calculated from nodes themselves 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > data calculated from nodes themselves 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -415,7 +415,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > dep a metadata 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > dep a metadata 1`] = ` Object { "integrity": "sha512-helloyesthisisdog", "resolved": "https://example.com/a.tgz", @@ -423,7 +423,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > dep d metadata 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > dep d metadata 1`] = ` Object { "bundleDependencies": Array [ "bundled", @@ -438,7 +438,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > dep e metadata 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > dep e metadata 1`] = ` Object { "dependencies": Object { "tgz": "", @@ -451,7 +451,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > git dep metadata 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > git dep metadata 1`] = ` Object { "dev": true, "resolved": "git+ssh://git@github.com/foo/bar.git#0000000000000000000000000000000000000000", @@ -459,14 +459,14 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > link metadata 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > link metadata 1`] = ` Object { "link": true, "resolved": "target", } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > link target metadata 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > link target metadata 1`] = ` Object { "funding": Object { "url": "https://example.com/payme", @@ -477,7 +477,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > meta for dev dep 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > meta for dev dep 1`] = ` Object { "dependencies": Object { "devo": "", @@ -487,14 +487,14 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > meta for devOptional dep 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > meta for devOptional dep 1`] = ` Object { "devOptional": true, "version": "1.2.3", } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > meta for optional dep 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > meta for optional dep 1`] = ` Object { "dependencies": Object { "devo": "", @@ -504,7 +504,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > metadata for tarball file pkg 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > metadata for tarball file pkg 1`] = ` Object { "cpu": Array [ "x64", @@ -525,7 +525,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > metadata for tarball file pkg with _resolved value 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > metadata for tarball file pkg with _resolved value 1`] = ` Object { "dev": true, "funding": Object { @@ -537,13 +537,13 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > node without a package 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > node without a package 1`] = ` Object { "extraneous": true, } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > root metadata, no package version 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > root metadata, no package version 1`] = ` Object { "dependencies": Object { "a": "", @@ -566,7 +566,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP construct metadata from node and package data > root metadata, with package version 1`] = ` +exports[`test/serial/shrinkwrap.js TAP construct metadata from node and package data > root metadata, with package version 1`] = ` Object { "dependencies": Object { "a": "", @@ -590,7 +590,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP handle missing dependencies object without borking > must match snapshot 1`] = ` +exports[`test/serial/shrinkwrap.js TAP handle missing dependencies object without borking > must match snapshot 1`] = ` Object { "lockfileVersion": 3, "packages": Object { @@ -599,7 +599,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP load a hidden lockfile > must match snapshot 1`] = ` +exports[`test/serial/shrinkwrap.js TAP load a hidden lockfile > must match snapshot 1`] = ` Object { "dependencies": Object {}, "lockfileVersion": 3, @@ -621,7 +621,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP load a legacy shrinkwrap without a package.json > did our best with what we had 1`] = ` +exports[`test/serial/shrinkwrap.js TAP load a legacy shrinkwrap without a package.json > did our best with what we had 1`] = ` Object { "dependencies": Object { "abbrev": Object { @@ -1034,7 +1034,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP load a shrinkwrap with some dev and optional flags > got expected dependency types 1`] = ` +exports[`test/serial/shrinkwrap.js TAP load a shrinkwrap with some dev and optional flags > got expected dependency types 1`] = ` Object { "dependencies": Object { "diff-frag": Object { @@ -1134,7 +1134,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests bundle > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests bundle > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "bundle", @@ -1156,7 +1156,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests deepmixedloop > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests deepmixedloop > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -1237,7 +1237,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests deeproot/root > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests deeproot/root > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -1328,7 +1328,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests devloop > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests devloop > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "devloop", @@ -1370,7 +1370,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests external-dep/root > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests external-dep/root > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -1388,7 +1388,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests external-link-cached-dummy-dep/root > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests external-link-cached-dummy-dep/root > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -1435,7 +1435,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests external-link/root > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests external-link/root > shrinkwrap data 1`] = ` Object { "dependencies": Object { "j": Object { @@ -1548,7 +1548,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests install-types > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests install-types > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "a", @@ -1806,7 +1806,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests link-dep-cycle > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests link-dep-cycle > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "link-dep-cycle", @@ -1848,7 +1848,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests link-dep-nested > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests link-dep-nested > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "nested-thingies", @@ -1889,7 +1889,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests link-dep-nested/root > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests link-dep-nested/root > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -1941,7 +1941,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests linkedroot > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests linkedroot > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -2032,7 +2032,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests links-all-over > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests links-all-over > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "links-all-over", @@ -2116,7 +2116,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests mixedloop > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests mixedloop > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -2167,7 +2167,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests mixedmidway > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests mixedmidway > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -2260,7 +2260,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests noname > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests noname > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "noname", @@ -2273,7 +2273,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests optionalloop > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests optionalloop > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "optionalloop", @@ -2315,7 +2315,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests optofdev > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests optofdev > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "optofdev", @@ -2363,7 +2363,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests other > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests other > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "other", @@ -2416,7 +2416,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests pnpm > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests pnpm > shrinkwrap data 1`] = ` Object { "dependencies": Object { "@scope/x": Object { @@ -2519,7 +2519,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests root > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests root > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "root", @@ -2611,7 +2611,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests selflink > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests selflink > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "selflink", @@ -2686,7 +2686,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests symlinked-node-modules/example > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests symlinked-node-modules/example > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "example", @@ -2717,7 +2717,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests tap-with-yarn-lock > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests tap-with-yarn-lock > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "tap", @@ -6957,7 +6957,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests tap-with-yarn-lock > yarn.lock data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests tap-with-yarn-lock > yarn.lock data 1`] = ` # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 @@ -9584,7 +9584,7 @@ yoga-layout-prebuilt@^1.9.3: ` -exports[`test/shrinkwrap.js TAP loadActual tests workspace > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests workspace > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "workspace", @@ -9656,7 +9656,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests workspace2 > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests workspace2 > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "a", @@ -9708,7 +9708,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests workspace3 > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests workspace3 > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "workspace3", @@ -9790,7 +9790,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests workspaces-simple > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests workspaces-simple > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "workspace-simple", @@ -9824,7 +9824,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests yarn-lock-mkdirp-file-dep > shrinkwrap data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests yarn-lock-mkdirp-file-dep > shrinkwrap data 1`] = ` Object { "lockfileVersion": 3, "name": "yarn-lock-mkdirp-file-dep", @@ -9849,7 +9849,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP loadActual tests yarn-lock-mkdirp-file-dep > yarn.lock data 1`] = ` +exports[`test/serial/shrinkwrap.js TAP loadActual tests yarn-lock-mkdirp-file-dep > yarn.lock data 1`] = ` # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 @@ -9859,7 +9859,7 @@ exports[`test/shrinkwrap.js TAP loadActual tests yarn-lock-mkdirp-file-dep > yar ` -exports[`test/shrinkwrap.js TAP look up from locks and such > basic package 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such > basic package 1`] = ` Object { "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -9867,22 +9867,22 @@ Object { } ` -exports[`test/shrinkwrap.js TAP look up from locks and such > fall off the dep tree 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such > fall off the dep tree 1`] = ` Object {} ` -exports[`test/shrinkwrap.js TAP look up from locks and such > must match snapshot 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such > must match snapshot 1`] = ` Object { "integrity": "the integrity is not valid, clearly", "resolved": "fake resolved value", } ` -exports[`test/shrinkwrap.js TAP look up from locks and such > not found 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such > not found 1`] = ` Object {} ` -exports[`test/shrinkwrap.js TAP look up from locks and such lockfile > basic pkg, from lock 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such lockfile > basic pkg, from lock 1`] = ` Object { "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", @@ -9890,24 +9890,24 @@ Object { } ` -exports[`test/shrinkwrap.js TAP look up from locks and such lockfile > full git 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such lockfile > full git 1`] = ` Object { "resolved": "git+ssh://git@github.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb", } ` -exports[`test/shrinkwrap.js TAP look up from locks and such lockfile > must match snapshot 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such lockfile > must match snapshot 1`] = ` Object { "integrity": "the integrity is not valid, clearly", "resolved": "fake resolved value", } ` -exports[`test/shrinkwrap.js TAP look up from locks and such lockfile > not found 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such lockfile > not found 1`] = ` Object {} ` -exports[`test/shrinkwrap.js TAP look up from locks and such lockfile > saved fetched metadata back to packages section 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such lockfile > saved fetched metadata back to packages section 1`] = ` Object { "node_modules/abbrev": Object { "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", @@ -9917,20 +9917,20 @@ Object { } ` -exports[`test/shrinkwrap.js TAP look up from locks and such lockfile > symlink 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such lockfile > symlink 1`] = ` Object { "link": true, "resolved": "abbrev-link-target", } ` -exports[`test/shrinkwrap.js TAP look up from locks and such lockfile > unhosted git 1`] = ` +exports[`test/serial/shrinkwrap.js TAP look up from locks and such lockfile > unhosted git 1`] = ` Object { "resolved": "git+https://mygit.com/isaacs/abbrev-js.git#a9ee72ebc8fe3975f1b0c7aeb3a8f2a806a432eb", } ` -exports[`test/shrinkwrap.js TAP saving dependency-free shrinkwrap object load file, and save it with a custom format > custom indented json output 1`] = ` +exports[`test/serial/shrinkwrap.js TAP saving dependency-free shrinkwrap object load file, and save it with a custom format > custom indented json output 1`] = ` { "lockfileVersion": 3, "requires": true, @@ -9939,7 +9939,7 @@ exports[`test/shrinkwrap.js TAP saving dependency-free shrinkwrap object load fi ` -exports[`test/shrinkwrap.js TAP saving dependency-free shrinkwrap object load the unindented file, and generate expected contents > indented json object output 1`] = ` +exports[`test/serial/shrinkwrap.js TAP saving dependency-free shrinkwrap object load the unindented file, and generate expected contents > indented json object output 1`] = ` Object { "lockfileVersion": 3, "packages": Object {}, @@ -9947,7 +9947,7 @@ Object { } ` -exports[`test/shrinkwrap.js TAP saving dependency-free shrinkwrap object load the unindented file, and generate expected contents > indented json string output 1`] = ` +exports[`test/serial/shrinkwrap.js TAP saving dependency-free shrinkwrap object load the unindented file, and generate expected contents > indented json string output 1`] = ` { "lockfileVersion": 3, "requires": true, @@ -9956,7 +9956,7 @@ exports[`test/shrinkwrap.js TAP saving dependency-free shrinkwrap object load th ` -exports[`test/shrinkwrap.js TAP saving dependency-free shrinkwrap object load the unindented file, and save it back default > indented json output 1`] = ` +exports[`test/serial/shrinkwrap.js TAP saving dependency-free shrinkwrap object load the unindented file, and save it back default > indented json output 1`] = ` { "lockfileVersion": 3, "requires": true, @@ -9965,11 +9965,11 @@ exports[`test/shrinkwrap.js TAP saving dependency-free shrinkwrap object load th ` -exports[`test/shrinkwrap.js TAP saving dependency-free shrinkwrap object save lockfile to root directory > no indent json output 1`] = ` +exports[`test/serial/shrinkwrap.js TAP saving dependency-free shrinkwrap object save lockfile to root directory > no indent json output 1`] = ` {"lockfileVersion":3,"requires":true,"packages":{}} ` -exports[`test/shrinkwrap.js TAP shrinkwrap key order > must match snapshot 1`] = ` +exports[`test/serial/shrinkwrap.js TAP shrinkwrap key order > must match snapshot 1`] = ` Array [ "name", "version", diff --git a/workspaces/arborist/test/arborist/audit.js b/workspaces/arborist/test/arborist/audit.js index bf301eb62d11f..e7306b47f4896 100644 --- a/workspaces/arborist/test/arborist/audit.js +++ b/workspaces/arborist/test/arborist/audit.js @@ -3,8 +3,8 @@ const { resolve } = require('path') const Arborist = require('../../lib/arborist/index.js') const { normalizePath, printTree } = require('../fixtures/utils.js') const { auditResponse, advisoryBulkResponse, ...mockRegistry } = require('../fixtures/server.js') +const { fixtures } = require('../fixtures/index.js') -const fixtures = resolve(__dirname, '../fixtures') const fixture = (t, p) => require(fixtures + '/reify-cases/' + p)(t) t.before(mockRegistry.start) diff --git a/workspaces/arborist/test/arborist/build-ideal-tree.js b/workspaces/arborist/test/arborist/build-ideal-tree.js index 0e9264b849879..cd55a84d79d2b 100644 --- a/workspaces/arborist/test/arborist/build-ideal-tree.js +++ b/workspaces/arborist/test/arborist/build-ideal-tree.js @@ -8,9 +8,7 @@ const { basename, resolve, relative } = require('path') const pacote = require('pacote') const t = require('tap') const Arborist = require('../..') -const fixtures = resolve(__dirname, '../fixtures') -// load the symbolic links that we depend on -require(fixtures) +const { fixtures } = require('../fixtures/index.js') const { start, stop, registry, auditResponse } = require('../fixtures/server.js') const npa = require('npm-package-arg') const fs = require('fs') @@ -762,68 +760,68 @@ t.test('no fix available, linked top package', async t => { t.test('workspaces', t => { t.test('should install a simple example', t => { - const path = resolve(__dirname, '../fixtures/workspaces-simple') + const path = resolve(fixtures, 'workspaces-simple') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should update a simple example', t => { - const path = resolve(__dirname, '../fixtures/workspaces-simple') + const path = resolve(fixtures, 'workspaces-simple') return t.resolveMatchSnapshot(printIdeal(path, { update: { all: true } })) }) t.test('should install a simple scoped pkg example', t => { - const path = resolve(__dirname, '../fixtures/workspaces-scoped-pkg') + const path = resolve(fixtures, 'workspaces-scoped-pkg') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should not work with duplicate names', t => { - const path = resolve(__dirname, '../fixtures/workspaces-duplicate') + const path = resolve(fixtures, 'workspaces-duplicate') return t.rejects(printIdeal(path), { code: 'EDUPLICATEWORKSPACE' }, 'throws EDUPLICATEWORKSPACE error') }) t.test('should install shared dependencies into root folder', t => { - const path = resolve(__dirname, '../fixtures/workspaces-shared-deps') + const path = resolve(fixtures, 'workspaces-shared-deps') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should install conflicting dep versions', t => { - const path = resolve(__dirname, '../fixtures/workspaces-conflicting-versions') + const path = resolve(fixtures, 'workspaces-conflicting-versions') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should prefer linking nested workspaces', t => { - const path = resolve(__dirname, '../fixtures/workspaces-prefer-linking') + const path = resolve(fixtures, 'workspaces-prefer-linking') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should install from registry on version not satisfied', t => { - const path = resolve(__dirname, '../fixtures/workspaces-version-unsatisfied') + const path = resolve(fixtures, 'workspaces-version-unsatisfied') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should link top level nested workspaces', t => { - const path = resolve(__dirname, '../fixtures/workspaces-top-level-link') + const path = resolve(fixtures, 'workspaces-top-level-link') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should install workspace transitive dependencies', t => { - const path = resolve(__dirname, '../fixtures/workspaces-transitive-deps') + const path = resolve(fixtures, 'workspaces-transitive-deps') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should ignore nested node_modules folders', t => { // packages/a/node_modules/nested-workspaces should not be installed - const path = resolve(__dirname, '../fixtures/workspaces-ignore-nm') + const path = resolve(fixtures, 'workspaces-ignore-nm') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should work with files spec', t => { - const path = resolve(__dirname, '../fixtures/workspaces-with-files-spec') + const path = resolve(fixtures, 'workspaces-with-files-spec') return t.resolveMatchSnapshot(printIdeal(path)) }) t.test('should handle conflicting peer deps ranges', t => { - const path = resolve(__dirname, '../fixtures/workspaces-peer-ranges') + const path = resolve(fixtures, 'workspaces-peer-ranges') return t.rejects( printIdeal(path), { @@ -1039,7 +1037,7 @@ t.test('adding tarball to global prefix that is a symlink at a different path de ...OPT, }) - const tarballpath = resolve(__dirname, '../fixtures/registry-mocks/content/mkdirp/-/mkdirp-1.0.2.tgz') + const tarballpath = resolve(fixtures, 'registry-mocks/content/mkdirp/-/mkdirp-1.0.2.tgz') const tree = await arb.buildIdealTree({ path, global: true, @@ -2694,7 +2692,7 @@ t.test('cannot do workspaces in global mode', t => { }) t.test('add packages to workspaces, not root', async t => { - const path = resolve(__dirname, '../fixtures/workspaces-not-root') + const path = resolve(fixtures, 'workspaces-not-root') const addTree = await buildIdeal(path, { add: ['wrappy@1.0.1'], @@ -2721,7 +2719,7 @@ t.test('add packages to workspaces, not root', async t => { }) t.test('add one workspace to another', async t => { - const path = resolve(__dirname, '../fixtures/workspaces-not-root') + const path = resolve(fixtures, 'workspaces-not-root') const packageA = resolve(path, 'packages/a') const addTree = await buildIdeal(path, { @@ -3970,7 +3968,7 @@ t.test('overrides', t => { t.test('store files with a custom indenting', async t => { const tabIndentedPackageJson = fs.readFileSync( - resolve(__dirname, '../fixtures/tab-indented-package-json/package.json'), + resolve(fixtures, 'tab-indented-package-json/package.json'), 'utf8' ).replace(/\r\n/g, '\n') const path = t.testdir({ diff --git a/workspaces/arborist/test/arborist/index.js b/workspaces/arborist/test/arborist/index.js index 88da04b94ffed..df492fd8d9c21 100644 --- a/workspaces/arborist/test/arborist/index.js +++ b/workspaces/arborist/test/arborist/index.js @@ -1,10 +1,10 @@ const t = require('tap') - const Edge = require('../../lib/edge.js') const Node = require('../../lib/node.js') const Link = require('../../lib/link.js') - const Arborist = require('../../lib/arborist/index.js') +const { fixtures } = require('../fixtures/index.js') + const normalizePath = path => path.replace(/[A-Z]:/, '').replace(/\\/g, '/') const a = new Arborist({ path: '/some/kind/of/path' }) @@ -28,7 +28,7 @@ t.throws(() => { t.test('workspace nodes and deps', async t => { const { resolve } = require('path') - const fixture = resolve(__dirname, '../fixtures/workspaces-shared-deps-virtual') + const fixture = resolve(fixtures, 'workspaces-shared-deps-virtual') const arb = new Arborist({ path: fixture }) const tree = await arb.loadVirtual() const wsNodes = arb.workspaceNodes(tree, ['b']) diff --git a/workspaces/arborist/test/arborist/load-virtual.js b/workspaces/arborist/test/arborist/load-virtual.js index ff6dd26ccdea3..e22f01f1e8d1f 100644 --- a/workspaces/arborist/test/arborist/load-virtual.js +++ b/workspaces/arborist/test/arborist/load-virtual.js @@ -1,18 +1,20 @@ const Arborist = require('../../lib/arborist') const t = require('tap') const { resolve } = require('path') -const fixture = resolve(__dirname, '../fixtures/install-types') -const swonlyfixture = resolve(__dirname, '../fixtures/install-types-sw-only') -const badfixture = resolve(__dirname, '../fixtures/root') -const pnpmFixture = resolve(__dirname, '../fixtures/pnpm') -const depTypesFixture = resolve(__dirname, '../fixtures/dev-deps') -const bundleFixture = resolve(__dirname, '../fixtures/two-bundled-deps') -const emptyFixture = resolve(__dirname, '../fixtures/empty-with-shrinkwrap') -const emptyFixtureNoPJ = resolve(__dirname, '../fixtures/empty-with-shrinkwrap-no-pj') -const linkedMeta = resolve(__dirname, '../fixtures/cli-750') -const oldMeta = resolve(__dirname, '../fixtures/old-package-lock') -const tapAndFlow = resolve(__dirname, '../fixtures/tap-and-flow') -const editFixture = resolve(__dirname, '../fixtures/edit-package-json') +const { fixtures } = require('../fixtures/index.js') + +const fixture = resolve(fixtures, 'install-types') +const swonlyfixture = resolve(fixtures, 'install-types-sw-only') +const badfixture = resolve(fixtures, 'root') +const pnpmFixture = resolve(fixtures, 'pnpm') +const depTypesFixture = resolve(fixtures, 'dev-deps') +const bundleFixture = resolve(fixtures, 'two-bundled-deps') +const emptyFixture = resolve(fixtures, 'empty-with-shrinkwrap') +const emptyFixtureNoPJ = resolve(fixtures, 'empty-with-shrinkwrap-no-pj') +const linkedMeta = resolve(fixtures, 'cli-750') +const oldMeta = resolve(fixtures, 'old-package-lock') +const tapAndFlow = resolve(fixtures, 'tap-and-flow') +const editFixture = resolve(fixtures, 'edit-package-json') const Shrinkwrap = require('../../lib/shrinkwrap.js') const Node = require('../../lib/node.js') @@ -118,7 +120,7 @@ t.test('load a tree where package.json edited', async t => { const removed = resolve(editFixture, 'removed') const changed = resolve(editFixture, 'changed') const wsChanged = resolve(editFixture, 'workspaces-changed') - const ws = resolve(__dirname, '../fixtures/workspaces-simple-virtual') + const ws = resolve(fixtures, 'workspaces-simple-virtual') const kFlagsSuspect = Symbol.for('flagsSuspect') const okArb = new Arborist({ path: ok }) @@ -158,49 +160,49 @@ t.test('load a tree where package.json edited', async t => { t.test('workspaces', t => { t.test('load a simple example', t => loadVirtual( - resolve(__dirname, '../fixtures/workspaces-simple-virtual') + resolve(fixtures, 'workspaces-simple-virtual') ).then(tree => t.matchSnapshot(printTree(tree), 'virtual tree with multiple bundles'))) t.test('load shared dependencies example', t => loadVirtual( - resolve(__dirname, '../fixtures/workspaces-shared-deps-virtual') + resolve(fixtures, 'workspaces-shared-deps-virtual') ).then(tree => t.matchSnapshot(printTree(tree), 'virtual tree with shared dependencies'))) t.test('load conflicting dep versions example', t => loadVirtual( - resolve(__dirname, '../fixtures/workspaces-conflicting-versions-virtual') + resolve(fixtures, 'workspaces-conflicting-versions-virtual') ).then(tree => t.matchSnapshot(printTree(tree), 'virtual tree with resolved conflicting dependencies'))) t.test('load prefer linking nested workspaces', t => loadVirtual( - resolve(__dirname, '../fixtures/workspaces-prefer-linking-virtual') + resolve(fixtures, 'workspaces-prefer-linking-virtual') ).then(tree => t.matchSnapshot(printTree(tree), 'virtual tree linking to local workspaces'))) t.test('load installed from registry on version not satisfied', t => loadVirtual( - resolve(__dirname, '../fixtures/workspaces-version-unsatisfied-virtual') + resolve(fixtures, 'workspaces-version-unsatisfied-virtual') ).then(tree => t.matchSnapshot(printTree(tree), 'virtual tree with deduped dep'))) t.test('load linked top level nested workspaces', t => loadVirtual( - resolve(__dirname, '../fixtures/workspaces-top-level-link-virtual') + resolve(fixtures, 'workspaces-top-level-link-virtual') ).then(tree => t.matchSnapshot(printTree(tree), 'virtual tree top level dep'))) t.test('load installed workspace with transitive dependencies', t => loadVirtual( - resolve(__dirname, '../fixtures/workspaces-transitive-deps-virtual') + resolve(fixtures, 'workspaces-transitive-deps-virtual') ).then(tree => t.matchSnapshot(printTree(tree), 'virtual tree with transitive deps'))) t.test('load installed tree with ignored nested node_modules folders', t => loadVirtual( - resolve(__dirname, '../fixtures/workspaces-ignore-nm-virtual') + resolve(fixtures, 'workspaces-ignore-nm-virtual') ).then(tree => t.matchSnapshot(printTree(tree), 'virtual tree ignoring nested node_modules'))) @@ -208,7 +210,7 @@ t.test('workspaces', t => { }) t.test('do not reset flags on supplied root option', async t => { - const path = resolve(__dirname, '../fixtures/test-package-with-shrinkwrap') + const path = resolve(fixtures, 'test-package-with-shrinkwrap') const root = new Node({ path, pkg: require(path + '/package.json'), @@ -225,7 +227,7 @@ t.test('do not reset flags on supplied root option', async t => { }) t.test('do not bundle the entire universe', async t => { - const path = resolve(__dirname, '../fixtures/tap-old-lockfile') + const path = resolve(fixtures, 'tap-old-lockfile') const tree = await loadVirtual(path) t.same(tree.children.get('tap').package.bundleDependencies.sort(), [ 'ink', diff --git a/workspaces/arborist/test/arborist/rebuild.js b/workspaces/arborist/test/arborist/rebuild.js index df383c6ce772c..2c1aa098a1920 100644 --- a/workspaces/arborist/test/arborist/rebuild.js +++ b/workspaces/arborist/test/arborist/rebuild.js @@ -4,7 +4,7 @@ const Arborist = require('../../lib/arborist/index.js') const { resolve, dirname } = require('path') const os = require('os') const fs = require('fs') -const fixtures = resolve(__dirname, '../fixtures') +const { fixtures } = require('../fixtures/index.js') const relpath = require('../../lib/relpath.js') const localeCompare = require('@isaacs/string-locale-compare')('en') diff --git a/workspaces/arborist/test/arborist/reify.js b/workspaces/arborist/test/arborist/reify.js index d0615add3540a..e72fa90af2823 100644 --- a/workspaces/arborist/test/arborist/reify.js +++ b/workspaces/arborist/test/arborist/reify.js @@ -6,6 +6,7 @@ const tnock = require('../fixtures/tnock') const fs = require('fs') const fsp = require('fs/promises') const npmFs = require('@npmcli/fs') +const { fixtures } = require('../fixtures/index.js') let failRm = false let failRename = null @@ -1361,7 +1362,7 @@ t.test('add a dep present in the tree, with v1 shrinkwrap', async t => { t.test('store files with a custom indenting', async t => { const tabIndentedPackageJson = fs.readFileSync( - resolve(__dirname, '../fixtures/tab-indented-package-json/package.json'), + resolve(fixtures, 'tab-indented-package-json/package.json'), 'utf8' ).replace(/\r\n/g, '\n') const path = t.testdir({ @@ -1421,7 +1422,7 @@ t.test('add a new pkg to a prefix that needs to be mkdirpd', async t => { t.test('do not delete root-bundled deps in global update', async t => { const path = t.testdir() - const file = resolve(__dirname, '../fixtures/bundle.tgz') + const file = resolve(fixtures, 'bundle.tgz') await reify(path, { global: true, add: [`file:${file}`] }) const depPJ = resolve(path, 'node_modules/bundle/node_modules/dep/package.json') t.matchSnapshot(fs.readFileSync(depPJ, 'utf8'), 'after first install') @@ -2159,7 +2160,7 @@ t.test('add deps to workspaces', async t => { }) t.test('reify audit only workspace deps when reifying workspace', async t => { - const auditFile = resolve(__dirname, '../fixtures/audit-nyc-mkdirp/advisory-bulk.json') + const auditFile = resolve(fixtures, 'audit-nyc-mkdirp/advisory-bulk.json') t.teardown(advisoryBulkResponse(auditFile)) const path = t.testdir({ 'package.json': JSON.stringify({ diff --git a/workspaces/arborist/test/audit-report.js b/workspaces/arborist/test/audit-report.js index de2cd429c96cc..2a0b5dcf91825 100644 --- a/workspaces/arborist/test/audit-report.js +++ b/workspaces/arborist/test/audit-report.js @@ -4,6 +4,8 @@ const AuditReport = require('../lib/audit-report.js') const { auditToBulk } = AuditReport const Node = require('../lib/node.js') const Arborist = require('../') +const { resolve } = require('path') +const { fixtures } = require('./fixtures/index.js') const { start, @@ -16,9 +18,6 @@ const { t.before(start) t.teardown(stop) -const { resolve } = require('path') -const fixtures = resolve(__dirname, 'fixtures') - const cache = t.testdir() const newArb = (path, opts = {}) => new Arborist({ path, registry, cache, ...opts }) diff --git a/workspaces/arborist/test/fixtures/.gitignore b/workspaces/arborist/test/fixtures/.gitignore index 701d6e2be9a7b..37dc7ceb3e18e 100644 --- a/workspaces/arborist/test/fixtures/.gitignore +++ b/workspaces/arborist/test/fixtures/.gitignore @@ -1,6 +1,6 @@ ### BEGIN IGNORED SYMLINKS ### ### this list is generated automatically, do not edit directly -### update it by running `node test/fixtures/index.js` +### update it by running `node test/fixtures/index.js setup` /badlink/node_modules/bar /badlink/node_modules/foo /cli-750/node_modules/app diff --git a/workspaces/arborist/test/fixtures/README.md b/workspaces/arborist/test/fixtures/README.md index 639be471a021d..2fd8ef1b56363 100644 --- a/workspaces/arborist/test/fixtures/README.md +++ b/workspaces/arborist/test/fixtures/README.md @@ -18,17 +18,26 @@ Several of these are in fact published to the npm registry under the `@isaacs/...` scope, but when used in tests, they should always be fetched from the mock registry. +Any test running `test/fixtures/` should be placed in `test/serial/` to ensure +it is not run in parallel since in `test/fixtures/` are directories that will +have `new Arborist({ path: fixturePath })` run on them. If two tests are +operating on the same fixture it can create race conditions and flaky tests. + +In the future `test/fixtures/` could be setup to copy the fixture to `t.testdir` +and run it from there and then it would be safe to run all tests in parallel. + ### Symbolic Links Several of these project folder examples involve symbolic links. The -symlinks are created the first time `test/fixtures/index.js` is loaded, and -are all ignored in the `.gitignore` file. +symlinks are created by running `require('./fixtures/index.js').setup(t)` +which will setup the fixtures and tear them down when the `t` tap test +is finished. The symlinks all ignored in the `.gitignore` file. To create all the symlinks and add them to the `.gitignore` file automatically: ``` -node test/fixtures/index.js +node test/fixtures/index.js setup ``` To remove them all: diff --git a/workspaces/arborist/test/fixtures/cleanup.js b/workspaces/arborist/test/fixtures/cleanup.js index 2758b7222433f..cbff4a8f1d66e 100644 --- a/workspaces/arborist/test/fixtures/cleanup.js +++ b/workspaces/arborist/test/fixtures/cleanup.js @@ -1,30 +1 @@ -const { resolve } = require('path') -const { readdirSync, lstatSync } = require('fs') - -process.env.ARBORIST_FIXTURE_CLEANUP = '1' -require('./index.js') - -// now make sure it actually did clean up everything -const readdir = (path, opt) => { - const ents = readdirSync(path, opt) - if (typeof ents[0] === 'string') { - return ents.map(ent => { - return Object.assign(lstatSync(path + '/' + ent), { name: ent }) - }) - } - return ents -} - -const walk = dir => { - for (const entry of readdir(dir, { withFileTypes: true })) { - if (entry.isDirectory()) { - walk(resolve(dir, entry.name)) - } else if (entry.isSymbolicLink()) { - throw Object.assign(new Error('symlink left in fixtures dir'), { - path: resolve(dir, entry.name), - }) - } - } -} - -walk(__dirname) +require('./index.js').cleanup() diff --git a/workspaces/arborist/test/fixtures/index.js b/workspaces/arborist/test/fixtures/index.js index fdc5592c7dd8d..f6d6671795e1b 100644 --- a/workspaces/arborist/test/fixtures/index.js +++ b/workspaces/arborist/test/fixtures/index.js @@ -1,9 +1,33 @@ const { mkdirSync } = require('fs') const localeCompare = require('@isaacs/string-locale-compare')('en') -const { unlinkSync, symlinkSync, readFileSync, writeFileSync } = require('fs') +const { unlinkSync, symlinkSync, readFileSync, writeFileSync, readdirSync, lstatSync } = require('fs') const { relative, resolve, dirname } = require('path') + const mkdirp = (p) => mkdirSync(p, { recursive: true }) +// now make sure it actually did clean up everything +const readdir = (path, opt) => { + const ents = readdirSync(path, opt) + if (typeof ents[0] === 'string') { + return ents.map(ent => { + return Object.assign(lstatSync(path + '/' + ent), { name: ent }) + }) + } + return ents +} + +const walk = dir => { + for (const entry of readdir(dir, { withFileTypes: true })) { + if (entry.isDirectory()) { + walk(resolve(dir, entry.name)) + } else if (entry.isSymbolicLink()) { + throw Object.assign(new Error('symlink left in fixtures dir'), { + path: resolve(dir, entry.name), + }) + } + } +} + const fixtures = __dirname const roots = [ @@ -139,21 +163,24 @@ const symlinks = { 'testing-bundledeps-link': './testing-bundledeps-2', } -const cleanup = () => Object.keys(symlinks).forEach(s => { - try { - unlinkSync(resolve(__dirname, s)) - } catch { +const cleanup = () => { + Object.keys(symlinks).forEach(s => { + try { + unlinkSync(resolve(fixtures, s)) + } catch { // ok if cleanup fails - } -}) + } + }) + walk(fixtures) +} const setup = () => { const links = [] let didSomething = false Object.keys(symlinks).forEach(s => { - const p = resolve(__dirname, s) + const p = resolve(fixtures, s) mkdirp(dirname(p)) - const rel = relative(resolve(__dirname), p) + const rel = relative(resolve(fixtures), p) links.push('/' + rel.replace(/\\/g, '/')) try { @@ -167,12 +194,12 @@ const setup = () => { if (didSomething) { const start = '### BEGIN IGNORED SYMLINKS ###' const end = '### END IGNORED SYMLINKS ###' - const gifile = resolve(__dirname, './.gitignore') + const gifile = resolve(fixtures, './.gitignore') const gitignore = readFileSync(gifile, 'utf8') .replace(new RegExp(`${start}[\\s\\S]*${end}`), [ start, '### this list is generated automatically, do not edit directly', - '### update it by running `node test/fixtures/index.js`', + '### update it by running `node test/fixtures/index.js setup`', ...links.sort(localeCompare), end, ].join('\n')) @@ -180,17 +207,25 @@ const setup = () => { } } -const doCleanup = process.argv[2] === 'cleanup' && require.main === module || - process.env.ARBORIST_FIXTURE_CLEANUP === '1' - -if (doCleanup) { - cleanup() -} else { - setup() +// Run directly from node so run either cleanup or setup +if (require.main === module && process.argv[2]) { + if (process.argv[2] === 'cleanup') { + cleanup() + } else if (process.argv[2] === 'setup') { + setup() + } } module.exports = { roots, symlinks, fixtures, + setup: (t) => { + cleanup() + setup() + if (t) { + t.teardown(() => cleanup()) + } + }, + cleanup, } diff --git a/workspaces/arborist/test/fixtures/setup.js b/workspaces/arborist/test/fixtures/setup.js new file mode 100644 index 0000000000000..a9afb36c79c38 --- /dev/null +++ b/workspaces/arborist/test/fixtures/setup.js @@ -0,0 +1 @@ +require('./index.js').setup() diff --git a/workspaces/arborist/test/get-workspace-nodes.js b/workspaces/arborist/test/get-workspace-nodes.js index 851b12061cdef..e40af8c922c55 100644 --- a/workspaces/arborist/test/get-workspace-nodes.js +++ b/workspaces/arborist/test/get-workspace-nodes.js @@ -1,7 +1,8 @@ const t = require('tap') const Arborist = require('../lib/arborist/index.js') const { resolve } = require('path') -const path = resolve(__dirname, './fixtures/workspaces-shared-deps-virtual') +const { fixtures } = require('./fixtures/index.js') +const path = resolve(fixtures, 'workspaces-shared-deps-virtual') const arb = new Arborist({ path }) const warningTracker = () => { diff --git a/workspaces/arborist/test/arborist/load-actual-ctor-throw.js b/workspaces/arborist/test/serial/load-actual-ctor-throw.js similarity index 90% rename from workspaces/arborist/test/arborist/load-actual-ctor-throw.js rename to workspaces/arborist/test/serial/load-actual-ctor-throw.js index 812b1667fa753..513139c72138d 100644 --- a/workspaces/arborist/test/arborist/load-actual-ctor-throw.js +++ b/workspaces/arborist/test/serial/load-actual-ctor-throw.js @@ -1,18 +1,21 @@ const rpj = require('read-package-json-fast') const t = require('tap') +const { resolve } = require('path') +const { fixtures, setup } = require('../fixtures/index.js') + +setup(t) + const rpjMock = Object.assign((...args) => rpj(...args), { ...rpj, normalize: (...args) => { throw new Error('boom') }, }) + const Arborist = t.mock('../../lib/arborist', { 'read-package-json-fast': rpjMock, }) -const { resolve } = require('path') -const { fixtures } = require('../fixtures/index.js') - t.test('blow up and catch error if Node ctor blows up', t => { // mock rpj so that we can blow up on the 'normalize' method called // in the Node constructor, because it's (by design) extremely hard diff --git a/workspaces/arborist/test/arborist/load-actual.js b/workspaces/arborist/test/serial/load-actual.js similarity index 95% rename from workspaces/arborist/test/arborist/load-actual.js rename to workspaces/arborist/test/serial/load-actual.js index 9c2c8bf1cd4b8..bd8415400459d 100644 --- a/workspaces/arborist/test/arborist/load-actual.js +++ b/workspaces/arborist/test/serial/load-actual.js @@ -1,20 +1,34 @@ const t = require('tap') const { format } = require('tcompare') const Arborist = require('../../lib/arborist') - const { resolve } = require('path') const Node = require('../../lib/node.js') const Shrinkwrap = require('../../lib/shrinkwrap.js') const fs = require('fs') +const { fixtures, roots, setup } = require('../fixtures/index.js') +const { normalizePath, printTree } = require('../fixtures/utils.js') -const { - fixtures, - roots, -} = require('../fixtures/index.js') +setup(t) +t.snapshotFile = resolve(__dirname, '../../tap-snapshots/test/arborist/load-actual.js.test.cjs') // strip the fixtures path off of the trees in snapshots -const pp = path => path && - normalizePath(path).slice(normalizePath(fixtures).length + 1) +const stripPaths = [ + normalizePath(fixtures), + normalizePath(fixtures).replace(/[a-z]/gi, 'X'), + normalizePath(__dirname), +] +const pp = path => { + if (!path) { + return + } + for (const p of stripPaths) { + if (path.startsWith(p)) { + return path.slice(p.length + 1) + } + } + return path +} + const defixture = obj => { if (obj instanceof Set) { return new Set([...obj].map(defixture)) @@ -34,11 +48,6 @@ const defixture = obj => { return obj } -const { - normalizePath, - printTree, -} = require('../fixtures/utils.js') - const cwd = normalizePath(process.cwd()) t.cleanSnapshot = s => s.split(cwd).join('{CWD}') @@ -58,7 +67,7 @@ t.test('look for missing deps by default', t => { t.plan(paths.length) for (const p of paths) { t.test(p, async t => { - const path = resolve(__dirname, '../fixtures', p) + const path = resolve(fixtures, p) const arb = new Arborist({ path }) const tree = await arb.loadActual() t.matchSnapshot(tree, '"dep" should have missing deps, "link" should not') @@ -67,15 +76,15 @@ t.test('look for missing deps by default', t => { }) t.test('already loaded', t => new Arborist({ - path: resolve(__dirname, '../fixtures/selflink'), + path: resolve(fixtures, 'selflink'), }).loadActual({ ignoreMissing: true }).then(actualTree => new Arborist({ - path: resolve(__dirname, '../fixtures/selflink'), + path: resolve(fixtures, 'selflink'), actualTree, }).loadActual().then(tree2 => t.equal(tree2, actualTree)))) t.test('already loading', t => { const arb = new Arborist({ - path: resolve(__dirname, '../fixtures/selflink'), + path: resolve(fixtures, 'selflink'), }) // try repeatedly to get at the actual tree, but it's not there until // the end of the process and the promise resolves @@ -148,7 +157,7 @@ t.test('load a tree rooted on a different node', async t => { t.test('looking outside of cwd', t => { const cwd = process.cwd() t.teardown(() => process.chdir(cwd)) - process.chdir(resolve(__dirname, '../fixtures/selflink')) + process.chdir(resolve(fixtures, 'selflink')) const dir = '../root' return loadActual(dir).then(tree => t.matchSnapshot(tree, 'loaded tree')) diff --git a/workspaces/arborist/test/shrinkwrap.js b/workspaces/arborist/test/serial/shrinkwrap.js similarity index 98% rename from workspaces/arborist/test/shrinkwrap.js rename to workspaces/arborist/test/serial/shrinkwrap.js index 7ec5d28c6f627..351c60ece8dd1 100644 --- a/workspaces/arborist/test/shrinkwrap.js +++ b/workspaces/arborist/test/serial/shrinkwrap.js @@ -1,26 +1,30 @@ -const Shrinkwrap = require('../lib/shrinkwrap.js') -const Node = require('../lib/node.js') -const Link = require('../lib/link.js') -const calcDepFlags = require('../lib/calc-dep-flags.js') +const Shrinkwrap = require('../../lib/shrinkwrap.js') +const Node = require('../../lib/node.js') +const Link = require('../../lib/link.js') +const calcDepFlags = require('../../lib/calc-dep-flags.js') const fs = require('fs') -const Arborist = require('../lib/arborist/index.js') - +const Arborist = require('../../lib/arborist/index.js') +const YarnLock = require('../../lib/yarn-lock.js') +const { resolve } = require('path') +const { fixtures, roots, setup } = require('../fixtures/index.js') const t = require('tap') const normalizePath = path => path.replace(/[A-Z]:/, '').replace(/\\/g, '/') t.cleanSnapshot = s => s.split(process.cwd()).join('{CWD}') -const { resolve } = require('path') -const fixture = resolve(__dirname, 'fixtures/install-types') -const swonlyFixture = resolve(__dirname, 'fixtures/install-types-sw-only') -const YarnLock = require('../lib/yarn-lock.js') -const yarnFixture = resolve(__dirname, 'fixtures/yarn-stuff') -const emptyFixture = resolve(__dirname, 'fixtures/empty') -const depTypesFixture = resolve(__dirname, 'fixtures/dev-deps') -const badJsonFixture = resolve(__dirname, 'fixtures/testing-peer-deps-bad-sw') -const hiddenLockfileFixture = resolve(__dirname, 'fixtures/hidden-lockfile') +const fixture = resolve(fixtures, 'install-types') +const swonlyFixture = resolve(fixtures, 'install-types-sw-only') +const yarnFixture = resolve(fixtures, 'yarn-stuff') +const emptyFixture = resolve(fixtures, 'empty') +const depTypesFixture = resolve(fixtures, 'dev-deps') +const badJsonFixture = resolve(fixtures, 'testing-peer-deps-bad-sw') +const hiddenLockfileFixture = resolve(fixtures, 'hidden-lockfile') +const saxFixture = resolve(fixtures, 'sax') + const hidden = 'node_modules/.package-lock.json' -const saxFixture = resolve(__dirname, 'fixtures/sax') + +setup(t) +t.snapshotFile = resolve(__dirname, '../../tap-snapshots/test/shrinkwrap.js.test.cjs') // start out with the file being fresh const later = Date.now() + 10000 @@ -1178,14 +1182,7 @@ t.test('a yarn.lock with no entries', async t => { // basically just reproduce the loadActual and loadVirtual tests with // a closer eye on the shrinkwrap results. t.test('loadActual tests', t => { - const { - fixtures, - roots, - } = require('./fixtures/index.js') - - roots.push('tap-with-yarn-lock') - - for (const root of roots) { + for (const root of [...roots, 'tap-with-yarn-lock']) { const path = resolve(fixtures, root) t.test(root, async t => { const tree = await new Arborist({ path }).loadActual() diff --git a/workspaces/arborist/test/serial/tap-parallel-not-ok b/workspaces/arborist/test/serial/tap-parallel-not-ok new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/workspaces/arborist/test/yarn-lock.js b/workspaces/arborist/test/yarn-lock.js index 1227237bf95f8..ee4ce0348725b 100644 --- a/workspaces/arborist/test/yarn-lock.js +++ b/workspaces/arborist/test/yarn-lock.js @@ -1,12 +1,13 @@ const YarnLock = require('../lib/yarn-lock.js') const Arborist = require('../lib/arborist') const Node = require('../lib/node.js') +const { fixtures: fixturesPath } = require('./fixtures/index.js') const t = require('tap') const { resolve, basename } = require('path') const fixtures = [ - resolve(__dirname, 'fixtures/tap-with-yarn-lock'), - resolve(__dirname, 'fixtures/yarn-stuff'), + resolve(fixturesPath, 'tap-with-yarn-lock'), + resolve(fixturesPath, 'yarn-stuff'), ] const { readFileSync } = require('fs') @@ -80,11 +81,9 @@ t.test('exports YarnLockEntry class', t => { }) t.test('load a yarn lock from an actual tree', t => { - // make sure the symlinks are loaded - require('./fixtures/index.js') const fixtures = [ - resolve(__dirname, 'fixtures/install-types'), - resolve(__dirname, 'fixtures/links-all-over'), + resolve(fixturesPath, 'install-types'), + resolve(fixturesPath, 'links-all-over'), ] for (const fixture of fixtures) { t.test(basename(fixture), async t => { From 0e1d575d9e3abab4e2dde7102dff8c86d1919139 Mon Sep 17 00:00:00 2001 From: Luke Karrys Date: Tue, 23 Apr 2024 16:59:30 -0700 Subject: [PATCH 2/2] stuff --- workspaces/arborist/package.json | 2 - workspaces/arborist/test/fixtures/index.js | 9 ++++- ...-parallel-not-ok => __tap-parallel-not-ok} | 0 .../arborist/test/serial/load-actual.js | 40 +++++++++++++++---- workspaces/arborist/test/serial/shrinkwrap.js | 5 +-- 5 files changed, 42 insertions(+), 14 deletions(-) rename workspaces/arborist/test/serial/{tap-parallel-not-ok => __tap-parallel-not-ok} (100%) diff --git a/workspaces/arborist/package.json b/workspaces/arborist/package.json index 8acedefdc99aa..3136b9832ba15 100644 --- a/workspaces/arborist/package.json +++ b/workspaces/arborist/package.json @@ -76,8 +76,6 @@ "arborist": "bin/index.js" }, "tap": { - "before": "test/fixtures/setup.js", - "after": "test/fixtures/cleanup.js", "test-env": [ "LC_ALL=sk" ], diff --git a/workspaces/arborist/test/fixtures/index.js b/workspaces/arborist/test/fixtures/index.js index f6d6671795e1b..db1b8fcd82465 100644 --- a/workspaces/arborist/test/fixtures/index.js +++ b/workspaces/arborist/test/fixtures/index.js @@ -221,10 +221,15 @@ module.exports = { symlinks, fixtures, setup: (t) => { - cleanup() - setup() if (t) { + t.before(() => { + cleanup() + setup() + }) t.teardown(() => cleanup()) + } else { + cleanup() + setup() } }, cleanup, diff --git a/workspaces/arborist/test/serial/tap-parallel-not-ok b/workspaces/arborist/test/serial/__tap-parallel-not-ok similarity index 100% rename from workspaces/arborist/test/serial/tap-parallel-not-ok rename to workspaces/arborist/test/serial/__tap-parallel-not-ok diff --git a/workspaces/arborist/test/serial/load-actual.js b/workspaces/arborist/test/serial/load-actual.js index bd8415400459d..14539856ae3c0 100644 --- a/workspaces/arborist/test/serial/load-actual.js +++ b/workspaces/arborist/test/serial/load-actual.js @@ -8,7 +8,7 @@ const fs = require('fs') const { fixtures, roots, setup } = require('../fixtures/index.js') const { normalizePath, printTree } = require('../fixtures/utils.js') -setup(t) +// setup(t) t.snapshotFile = resolve(__dirname, '../../tap-snapshots/test/arborist/load-actual.js.test.cjs') // strip the fixtures path off of the trees in snapshots @@ -56,10 +56,36 @@ t.formatSnapshot = tree => format(defixture(printTree(tree)), { sort: true }) const loadActual = (path, opts) => new Arborist({ path, ...opts }).loadActual(opts) +const walk = (dir, res = []) => { + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + if (entry.isDirectory()) { + entry.type = 'directory' + res.push(entry) + walk(resolve(dir, entry.name), res) + } else { + entry.type = entry.isSymbolicLink() ? 'symlink' : 'file' + res.push(entry) + } + } + return res +} + roots.forEach(path => { const dir = resolve(fixtures, path) - t.test(path, t => loadActual(dir).then(tree => - t.matchSnapshot(tree, 'loaded tree'))) + + t.test(path, async t => { + t.comment(dir) + t.comment(JSON.stringify(walk(dir), null, 2)) + + const tree = await loadActual(dir) + + t.comment(dir) + t.comment(JSON.stringify(walk(dir), null, 2)) + + t.comment(format(defixture(printTree(tree)), { sort: true })) + + t.matchSnapshot(tree, 'loaded tree') + }) }) t.test('look for missing deps by default', t => { @@ -75,14 +101,14 @@ t.test('look for missing deps by default', t => { } }) -t.test('already loaded', t => new Arborist({ +t.test('already loaded', async t => new Arborist({ path: resolve(fixtures, 'selflink'), }).loadActual({ ignoreMissing: true }).then(actualTree => new Arborist({ path: resolve(fixtures, 'selflink'), actualTree, }).loadActual().then(tree2 => t.equal(tree2, actualTree)))) -t.test('already loading', t => { +t.test('already loading', async t => { const arb = new Arborist({ path: resolve(fixtures, 'selflink'), }) @@ -154,7 +180,7 @@ t.test('load a tree rooted on a different node', async t => { t.equal(transpFilter.children.get('c').realpath, resolve(other, 'packages/c')) }) -t.test('looking outside of cwd', t => { +t.test('looking outside of cwd', async t => { const cwd = process.cwd() t.teardown(() => process.chdir(cwd)) process.chdir(resolve(fixtures, 'selflink')) @@ -171,7 +197,7 @@ t.test('cwd is default root', t => { t.matchSnapshot(tree, 'loaded tree')) }) -t.test('shake out Link target timing issue', t => { +t.test('shake out Link target timing issue', async t => { process.env._TEST_ARBORIST_SLOW_LINK_TARGET_ = '1' t.teardown(() => process.env._TEST_ARBORIST_SLOW_LINK_TARGET_ = '') const dir = resolve(fixtures, 'selflink') diff --git a/workspaces/arborist/test/serial/shrinkwrap.js b/workspaces/arborist/test/serial/shrinkwrap.js index 351c60ece8dd1..4086b6bd1266a 100644 --- a/workspaces/arborist/test/serial/shrinkwrap.js +++ b/workspaces/arborist/test/serial/shrinkwrap.js @@ -1181,10 +1181,10 @@ t.test('a yarn.lock with no entries', async t => { // basically just reproduce the loadActual and loadVirtual tests with // a closer eye on the shrinkwrap results. -t.test('loadActual tests', t => { +t.test('loadActual tests', async t => { for (const root of [...roots, 'tap-with-yarn-lock']) { const path = resolve(fixtures, root) - t.test(root, async t => { + await t.test(root, async t => { const tree = await new Arborist({ path }).loadActual() const shrinkwrap = tree.meta.commit() t.matchSnapshot(shrinkwrap, 'shrinkwrap data') @@ -1194,7 +1194,6 @@ t.test('loadActual tests', t => { } }) } - t.end() }) t.test('set integrity because location and resolved match', async t => {