diff options
Diffstat (limited to 'tap-snapshots/test/lib')
-rw-r--r-- | tap-snapshots/test/lib/commands/completion.js.test.cjs | 1 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/query.js.test.cjs | 221 | ||||
-rw-r--r-- | tap-snapshots/test/lib/load-all-commands.js.test.cjs | 14 | ||||
-rw-r--r-- | tap-snapshots/test/lib/npm.js.test.cjs | 20 | ||||
-rw-r--r-- | tap-snapshots/test/lib/utils/cmd-list.js.test.cjs | 6 |
5 files changed, 258 insertions, 4 deletions
diff --git a/tap-snapshots/test/lib/commands/completion.js.test.cjs b/tap-snapshots/test/lib/commands/completion.js.test.cjs index 232cfec66..f08ef0f37 100644 --- a/tap-snapshots/test/lib/commands/completion.js.test.cjs +++ b/tap-snapshots/test/lib/commands/completion.js.test.cjs @@ -87,6 +87,7 @@ Array [ profile prune publish + query rebuild repo restart diff --git a/tap-snapshots/test/lib/commands/query.js.test.cjs b/tap-snapshots/test/lib/commands/query.js.test.cjs new file mode 100644 index 000000000..0a2aa769e --- /dev/null +++ b/tap-snapshots/test/lib/commands/query.js.test.cjs @@ -0,0 +1,221 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/commands/query.js TAP global > should return global package 1`] = ` +[ + { + "name": "lorem", + "version": "2.0.0", + "_id": "lorem@2.0.0", + "pkgid": "lorem@2.0.0", + "location": "node_modules/lorem", + "path": "{CWD}/test/lib/commands/tap-testdir-query-global/global/node_modules/lorem", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-global/global/node_modules/lorem", + "resolved": null, + "from": [ + "" + ], + "to": [], + "dev": false, + "inBundle": false, + "deduped": false + } +] +` + +exports[`test/lib/commands/query.js TAP include-workspace-root > should return workspace object and root object 1`] = ` +[ + { + "name": "project", + "workspaces": [ + "c" + ], + "dependencies": { + "a": "^1.0.0", + "b": "^1.0.0" + }, + "pkgid": "project@", + "location": "", + "path": "{CWD}/test/lib/commands/tap-testdir-query-include-workspace-root/prefix", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-include-workspace-root/prefix", + "resolved": null, + "from": [], + "to": [ + "node_modules/c", + "node_modules/a", + "node_modules/b" + ], + "dev": false, + "inBundle": false, + "deduped": false + }, + { + "name": "c", + "version": "1.0.0", + "_id": "c@1.0.0", + "pkgid": "c@1.0.0", + "location": "c", + "path": "{CWD}/test/lib/commands/tap-testdir-query-include-workspace-root/prefix/c", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-include-workspace-root/prefix/c", + "resolved": null, + "from": [], + "to": [], + "dev": false, + "inBundle": false, + "deduped": false + } +] +` + +exports[`test/lib/commands/query.js TAP linked node > should return linked node res 1`] = ` +[ + { + "name": "a", + "version": "1.0.0", + "_id": "a@1.0.0", + "pkgid": "a@1.0.0", + "location": "a", + "path": "{CWD}/test/lib/commands/tap-testdir-query-linked-node/prefix/a", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-linked-node/prefix/a", + "resolved": null, + "from": [], + "to": [], + "dev": false, + "inBundle": false, + "deduped": false + } +] +` + +exports[`test/lib/commands/query.js TAP recursive tree > should return everything in the tree, accounting for recursion 1`] = ` +[ + { + "name": "project", + "dependencies": { + "a": "^1.0.0", + "b": "^1.0.0" + }, + "pkgid": "project@", + "location": "", + "path": "{CWD}/test/lib/commands/tap-testdir-query-recursive-tree/prefix", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-recursive-tree/prefix", + "resolved": null, + "from": [], + "to": [ + "node_modules/a", + "node_modules/b" + ], + "dev": false, + "inBundle": false, + "deduped": false + }, + { + "pkgid": "a@", + "location": "node_modules/a", + "path": "{CWD}/test/lib/commands/tap-testdir-query-recursive-tree/prefix/node_modules/a", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-recursive-tree/prefix/node_modules/a", + "resolved": null, + "from": [ + "" + ], + "to": [], + "dev": false, + "inBundle": false, + "deduped": false + }, + { + "pkgid": "b@", + "location": "node_modules/b", + "path": "{CWD}/test/lib/commands/tap-testdir-query-recursive-tree/prefix/node_modules/b", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-recursive-tree/prefix/node_modules/b", + "resolved": null, + "from": [ + "" + ], + "to": [], + "dev": false, + "inBundle": false, + "deduped": false + } +] +` + +exports[`test/lib/commands/query.js TAP simple query > should return root object and direct children 1`] = ` +[ + { + "name": "project", + "dependencies": { + "a": "^1.0.0", + "b": "^1.0.0" + }, + "peerDependencies": { + "c": "1.0.0" + }, + "pkgid": "project@", + "location": "", + "path": "{CWD}/test/lib/commands/tap-testdir-query-simple-query/prefix", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-simple-query/prefix", + "resolved": null, + "from": [], + "to": [ + "node_modules/a", + "node_modules/b" + ], + "dev": false, + "inBundle": false, + "deduped": false + }, + { + "pkgid": "a@", + "location": "node_modules/a", + "path": "{CWD}/test/lib/commands/tap-testdir-query-simple-query/prefix/node_modules/a", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-simple-query/prefix/node_modules/a", + "resolved": null, + "from": [ + "" + ], + "to": [], + "dev": false, + "inBundle": false, + "deduped": false + }, + { + "pkgid": "b@", + "location": "node_modules/b", + "path": "{CWD}/test/lib/commands/tap-testdir-query-simple-query/prefix/node_modules/b", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-simple-query/prefix/node_modules/b", + "resolved": null, + "from": [ + "" + ], + "to": [], + "dev": false, + "inBundle": false, + "deduped": false + } +] +` + +exports[`test/lib/commands/query.js TAP workspace query > should return workspace object 1`] = ` +[ + { + "name": "c", + "version": "1.0.0", + "_id": "c@1.0.0", + "pkgid": "c@1.0.0", + "location": "c", + "path": "{CWD}/test/lib/commands/tap-testdir-query-workspace-query/prefix/c", + "realpath": "{CWD}/test/lib/commands/tap-testdir-query-workspace-query/prefix/c", + "resolved": null, + "from": [], + "to": [], + "dev": false, + "inBundle": false, + "deduped": false + } +] +` diff --git a/tap-snapshots/test/lib/load-all-commands.js.test.cjs b/tap-snapshots/test/lib/load-all-commands.js.test.cjs index 88b1d4955..eac037f4b 100644 --- a/tap-snapshots/test/lib/load-all-commands.js.test.cjs +++ b/tap-snapshots/test/lib/load-all-commands.js.test.cjs @@ -693,6 +693,20 @@ Options: Run "npm help publish" for more info ` +exports[`test/lib/load-all-commands.js TAP load each command query > must match snapshot 1`] = ` +Retrieve a filtered list of packages + +Usage: +npm query <selector> + +Options: +[-g|--global] +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] [--include-workspace-root] + +Run "npm help query" for more info +` + exports[`test/lib/load-all-commands.js TAP load each command rebuild > must match snapshot 1`] = ` Rebuild a package diff --git a/tap-snapshots/test/lib/npm.js.test.cjs b/tap-snapshots/test/lib/npm.js.test.cjs index ea7d2a7e1..094792afd 100644 --- a/tap-snapshots/test/lib/npm.js.test.cjs +++ b/tap-snapshots/test/lib/npm.js.test.cjs @@ -26,7 +26,7 @@ All commands: edit, exec, explain, explore, find-dupes, fund, get, help, hook, init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, outdated, owner, pack, ping, - pkg, prefix, profile, prune, publish, rebuild, repo, + pkg, prefix, profile, prune, publish, query, rebuild, repo, restart, root, run-script, search, set, set-script, shrinkwrap, star, stars, start, stop, team, test, token, uninstall, unpublish, unstar, update, version, view, whoami @@ -62,7 +62,7 @@ All commands: edit, exec, explain, explore, find-dupes, fund, get, help, hook, init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, outdated, owner, pack, ping, - pkg, prefix, profile, prune, publish, rebuild, repo, + pkg, prefix, profile, prune, publish, query, rebuild, repo, restart, root, run-script, search, set, set-script, shrinkwrap, star, stars, start, stop, team, test, token, uninstall, unpublish, unstar, update, version, view, whoami @@ -98,7 +98,7 @@ All commands: edit, exec, explain, explore, find-dupes, fund, get, help, hook, init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, outdated, owner, pack, ping, - pkg, prefix, profile, prune, publish, rebuild, repo, + pkg, prefix, profile, prune, publish, query, rebuild, repo, restart, root, run-script, search, set, set-script, shrinkwrap, star, stars, start, stop, team, test, token, uninstall, unpublish, unstar, update, version, view, whoami @@ -134,7 +134,7 @@ All commands: edit, exec, explain, explore, find-dupes, fund, get, help, hook, init, install, install-ci-test, install-test, link, ll, login, logout, ls, org, outdated, owner, pack, ping, - pkg, prefix, profile, prune, publish, rebuild, repo, + pkg, prefix, profile, prune, publish, query, rebuild, repo, restart, root, run-script, search, set, set-script, shrinkwrap, star, stars, start, stop, team, test, token, uninstall, unpublish, unstar, update, version, view, whoami @@ -746,6 +746,18 @@ All commands: Run "npm help publish" for more info + query Retrieve a filtered list of packages + + Usage: + npm query <selector> + + Options: + [-g|--global] + [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] + [-ws|--workspaces] [--include-workspace-root] + + Run "npm help query" for more info + rebuild Rebuild a package Usage: diff --git a/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs b/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs index 9413f8e9a..dd0df9b86 100644 --- a/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs +++ b/tap-snapshots/test/lib/utils/cmd-list.js.test.cjs @@ -218,6 +218,11 @@ Object { "publi": "publish", "publis": "publish", "publish": "publish", + "q": "query", + "qu": "query", + "que": "query", + "quer": "query", + "query": "query", "r": "r", "rb": "rb", "reb": "rebuild", @@ -453,6 +458,7 @@ Object { "profile", "prune", "publish", + "query", "rebuild", "repo", "restart", |