diff options
Diffstat (limited to 'tap-snapshots/test/lib/commands')
-rw-r--r-- | tap-snapshots/test/lib/commands/config.js.test.cjs | 342 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/dist-tag.js.test.cjs | 298 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/fund.js.test.cjs | 114 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/init.js.test.cjs | 37 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/link.js.test.cjs | 45 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/ls.js.test.cjs | 710 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/outdated.js.test.cjs | 256 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/owner.js.test.cjs | 20 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/profile.js.test.cjs | 104 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/publish.js.test.cjs | 176 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/search.js.test.cjs | 20 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/stars.js.test.cjs | 15 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/team.js.test.cjs | 85 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/unpublish.js.test.cjs | 14 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/view.js.test.cjs | 593 |
15 files changed, 2829 insertions, 0 deletions
diff --git a/tap-snapshots/test/lib/commands/config.js.test.cjs b/tap-snapshots/test/lib/commands/config.js.test.cjs new file mode 100644 index 000000000..814f6de7c --- /dev/null +++ b/tap-snapshots/test/lib/commands/config.js.test.cjs @@ -0,0 +1,342 @@ +/* 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/config.js TAP config list --json > output matches snapshot 1`] = ` +{ + "prefix": "{LOCALPREFIX}", + "userconfig": "{HOME}/.npmrc", + "json": true, + "projectloaded": "yes", + "userloaded": "yes", + "globalloaded": "yes", + "access": null, + "all": false, + "allow-same-version": false, + "also": null, + "audit": true, + "audit-level": null, + "auth-type": "legacy", + "before": null, + "bin-links": true, + "browser": null, + "ca": null, + "cache": "{CACHE}", + "cache-max": null, + "cache-min": 0, + "cafile": null, + "call": "", + "cert": null, + "ci-name": null, + "cidr": null, + "color": true, + "commit-hooks": true, + "depth": null, + "description": true, + "dev": false, + "diff": [], + "diff-ignore-all-space": false, + "diff-name-only": false, + "diff-no-prefix": false, + "diff-dst-prefix": "b/", + "diff-src-prefix": "a/", + "diff-text": false, + "diff-unified": 3, + "dry-run": false, + "editor": "{EDITOR}", + "engine-strict": false, + "fetch-retries": 2, + "fetch-retry-factor": 10, + "fetch-retry-maxtimeout": 60000, + "fetch-retry-mintimeout": 10000, + "fetch-timeout": 300000, + "force": false, + "foreground-scripts": false, + "format-package-lock": true, + "fund": true, + "git": "git", + "git-tag-version": true, + "global": false, + "global-style": false, + "globalconfig": "{GLOBALPREFIX}/npmrc", + "heading": "npm", + "https-proxy": null, + "if-present": false, + "ignore-scripts": false, + "include": [], + "include-staged": false, + "include-workspace-root": false, + "init-author-email": "", + "init-author-name": "", + "init-author-url": "", + "init-license": "ISC", + "init-module": "{HOME}/.npm-init.js", + "init-version": "1.0.0", + "init.author.email": "", + "init.author.name": "", + "init.author.url": "", + "init.license": "ISC", + "init.module": "{HOME}/.npm-init.js", + "init.version": "1.0.0", + "key": null, + "legacy-bundling": false, + "legacy-peer-deps": false, + "link": false, + "local-address": null, + "location": "user", + "lockfile-version": null, + "loglevel": "notice", + "logs-max": 10, + "long": false, + "maxsockets": 15, + "message": "%s", + "node-options": null, + "node-version": "{NODE-VERSION}", + "noproxy": [ + "" + ], + "npm-version": "{NPM-VERSION}", + "offline": false, + "omit": [], + "only": null, + "optional": null, + "otp": null, + "package": [], + "package-lock": true, + "package-lock-only": false, + "pack-destination": ".", + "parseable": false, + "prefer-offline": false, + "prefer-online": false, + "preid": "", + "production": null, + "progress": true, + "proxy": null, + "read-only": false, + "rebuild-bundle": true, + "registry": "https://registry.npmjs.org/", + "save": true, + "save-bundle": false, + "save-dev": false, + "save-exact": false, + "save-optional": false, + "save-peer": false, + "save-prefix": "^", + "save-prod": false, + "scope": "", + "script-shell": null, + "searchexclude": "", + "searchlimit": 20, + "searchopts": "", + "searchstaleness": 900, + "shell": "{SHELL}", + "shrinkwrap": true, + "sign-git-commit": false, + "sign-git-tag": false, + "sso-poll-frequency": 500, + "sso-type": "oauth", + "strict-peer-deps": false, + "strict-ssl": true, + "tag": "latest", + "tag-version-prefix": "v", + "timing": false, + "tmp": "{TMP}", + "umask": 0, + "unicode": false, + "update-notifier": true, + "usage": false, + "user-agent": "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}", + "version": false, + "versions": false, + "viewer": "{VIEWER}", + "which": null, + "workspace": [], + "workspaces": null, + "yes": null, + "metrics-registry": "https://registry.npmjs.org/" +} +` + +exports[`test/lib/commands/config.js TAP config list --long > output matches snapshot 1`] = ` +; "default" config from default values + +_auth = (protected) +access = null +all = false +allow-same-version = false +also = null +audit = true +audit-level = null +auth-type = "legacy" +before = null +bin-links = true +browser = null +ca = null +cache = "{CACHE}" +cache-max = null +cache-min = 0 +cafile = null +call = "" +cert = null +ci-name = null +cidr = null +color = true +commit-hooks = true +depth = null +description = true +dev = false +diff = [] +diff-dst-prefix = "b/" +diff-ignore-all-space = false +diff-name-only = false +diff-no-prefix = false +diff-src-prefix = "a/" +diff-text = false +diff-unified = 3 +dry-run = false +editor = "{EDITOR}" +engine-strict = false +fetch-retries = 2 +fetch-retry-factor = 10 +fetch-retry-maxtimeout = 60000 +fetch-retry-mintimeout = 10000 +fetch-timeout = 300000 +force = false +foreground-scripts = false +format-package-lock = true +fund = true +git = "git" +git-tag-version = true +global = false +global-style = false +globalconfig = "{GLOBALPREFIX}/npmrc" +heading = "npm" +https-proxy = null +if-present = false +ignore-scripts = false +include = [] +include-staged = false +include-workspace-root = false +init-author-email = "" +init-author-name = "" +init-author-url = "" +init-license = "ISC" +init-module = "{HOME}/.npm-init.js" +init-version = "1.0.0" +init.author.email = "" +init.author.name = "" +init.author.url = "" +init.license = "ISC" +init.module = "{HOME}/.npm-init.js" +init.version = "1.0.0" +json = false +key = null +legacy-bundling = false +legacy-peer-deps = false +link = false +local-address = null +location = "user" +lockfile-version = null +loglevel = "notice" +logs-max = 10 +; long = false ; overridden by cli +maxsockets = 15 +message = "%s" +metrics-registry = "https://registry.npmjs.org/" +node-options = null +node-version = "{NODE-VERSION}" +noproxy = [""] +npm-version = "{NPM-VERSION}" +offline = false +omit = [] +only = null +optional = null +otp = null +pack-destination = "." +package = [] +package-lock = true +package-lock-only = false +parseable = false +prefer-offline = false +prefer-online = false +; prefix = "{REALGLOBALREFIX}" ; overridden by cli +preid = "" +production = null +progress = true +proxy = null +read-only = false +rebuild-bundle = true +registry = "https://registry.npmjs.org/" +save = true +save-bundle = false +save-dev = false +save-exact = false +save-optional = false +save-peer = false +save-prefix = "^" +save-prod = false +scope = "" +script-shell = null +searchexclude = "" +searchlimit = 20 +searchopts = "" +searchstaleness = 900 +shell = "{SHELL}" +shrinkwrap = true +sign-git-commit = false +sign-git-tag = false +sso-poll-frequency = 500 +sso-type = "oauth" +strict-peer-deps = false +strict-ssl = true +tag = "latest" +tag-version-prefix = "v" +timing = false +tmp = "{TMP}" +umask = 0 +unicode = false +update-notifier = true +usage = false +user-agent = "npm/{npm-version} node/{node-version} {platform} {arch} workspaces/{workspaces} {ci}" +; userconfig = "{HOME}/.npmrc" ; overridden by cli +version = false +versions = false +viewer = "{VIEWER}" +which = null +workspace = [] +workspaces = null +yes = null + +; "global" config from {GLOBALPREFIX}/npmrc + +globalloaded = "yes" + +; "user" config from {HOME}/.npmrc + +userloaded = "yes" + +; "project" config from {LOCALPREFIX}/.npmrc + +projectloaded = "yes" + +; "cli" config from command line options + +long = true +prefix = "{LOCALPREFIX}" +userconfig = "{HOME}/.npmrc" +` + +exports[`test/lib/commands/config.js TAP config list > output matches snapshot 1`] = ` +; "cli" config from command line options + +prefix = "{LOCALPREFIX}" +userconfig = "{HOME}/.npmrc" + +; node bin location = {EXECPATH} +; cwd = {NPMDIR} +; HOME = {HOME} +; Run \`npm config ls -l\` to show all defaults. +` diff --git a/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs b/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs new file mode 100644 index 000000000..53f296ac0 --- /dev/null +++ b/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs @@ -0,0 +1,298 @@ +/* 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/dist-tag.js TAP add missing args > should exit usage error message 1`] = ` +Error: +Usage: npm dist-tag + +Modify package distribution tags + +Usage: +npm dist-tag add <pkg>@<version> [<tag>] +npm dist-tag rm <pkg> <tag> +npm dist-tag ls [<pkg>] + +Options: +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] [--include-workspace-root] + +alias: dist-tags + +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} +` + +exports[`test/lib/commands/dist-tag.js TAP add missing pkg name > should exit usage error message 1`] = ` +Error: +Usage: npm dist-tag + +Modify package distribution tags + +Usage: +npm dist-tag add <pkg>@<version> [<tag>] +npm dist-tag rm <pkg> <tag> +npm dist-tag ls [<pkg>] + +Options: +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] [--include-workspace-root] + +alias: dist-tags + +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} +` + +exports[`test/lib/commands/dist-tag.js TAP add new tag > should return success msg 1`] = ` ++c: @scoped/another@7.7.7 +` + +exports[`test/lib/commands/dist-tag.js TAP add using valid semver range as name > should return success msg 1`] = ` +dist-tag add 1.0.0 to @scoped/another@7.7.7 + +` + +exports[`test/lib/commands/dist-tag.js TAP borked cmd usage > should show usage error 1`] = ` +Error: +Usage: npm dist-tag + +Modify package distribution tags + +Usage: +npm dist-tag add <pkg>@<version> [<tag>] +npm dist-tag rm <pkg> <tag> +npm dist-tag ls [<pkg>] + +Options: +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] [--include-workspace-root] + +alias: dist-tags + +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} +` + +exports[`test/lib/commands/dist-tag.js TAP ls global > should throw basic usage 1`] = ` +Error: +Usage: npm dist-tag + +Modify package distribution tags + +Usage: +npm dist-tag add <pkg>@<version> [<tag>] +npm dist-tag rm <pkg> <tag> +npm dist-tag ls [<pkg>] + +Options: +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] [--include-workspace-root] + +alias: dist-tags + +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} +` + +exports[`test/lib/commands/dist-tag.js TAP ls in current package > should list available tags for current package 1`] = ` +a: 0.0.1 +b: 0.5.0 +latest: 1.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP ls on missing name in current package > should throw usage error message 1`] = ` +Error: +Usage: npm dist-tag + +Modify package distribution tags + +Usage: +npm dist-tag add <pkg>@<version> [<tag>] +npm dist-tag rm <pkg> <tag> +npm dist-tag ls [<pkg>] + +Options: +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] [--include-workspace-root] + +alias: dist-tags + +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} +` + +exports[`test/lib/commands/dist-tag.js TAP ls on missing package > should log no dist-tag found msg 1`] = ` +dist-tag ls Couldn't get dist-tag data for foo@latest + +` + +exports[`test/lib/commands/dist-tag.js TAP ls on missing package > should throw error message 1`] = ` +Error: No dist-tags found for foo +` + +exports[`test/lib/commands/dist-tag.js TAP ls on named package > should list tags for the specified package 1`] = ` +a: 0.0.2 +b: 0.6.0 +latest: 2.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP no args in current package > should default to listing available tags for current package 1`] = ` +a: 0.0.1 +b: 0.5.0 +latest: 1.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP only named package arg > should default to listing tags for the specified package 1`] = ` +a: 0.0.2 +b: 0.6.0 +latest: 2.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP remove existing tag > should log remove info 1`] = ` +dist-tag del c from @scoped/another + +` + +exports[`test/lib/commands/dist-tag.js TAP remove existing tag > should return success msg 1`] = ` +-c: @scoped/another@7.7.7 +` + +exports[`test/lib/commands/dist-tag.js TAP remove missing pkg name > should exit usage error message 1`] = ` +Error: +Usage: npm dist-tag + +Modify package distribution tags + +Usage: +npm dist-tag add <pkg>@<version> [<tag>] +npm dist-tag rm <pkg> <tag> +npm dist-tag ls [<pkg>] + +Options: +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] [--include-workspace-root] + +alias: dist-tags + +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} +` + +exports[`test/lib/commands/dist-tag.js TAP remove non-existing tag > should log error msg 1`] = ` +dist-tag del nonexistent from @scoped/another +dist-tag del nonexistent is not a dist-tag on @scoped/another + +` + +exports[`test/lib/commands/dist-tag.js TAP set existing version > should log warn msg 1`] = ` +dist-tag add b to @scoped/another@0.6.0 +dist-tag add b is already set to version 0.6.0 + +` + +exports[`test/lib/commands/dist-tag.js TAP workspaces no args > printed the expected output 1`] = ` +workspace-a: +latest-a: 1.0.0 +latest: 1.0.0 +workspace-b: +latest-b: 2.0.0 +latest: 2.0.0 +workspace-c: +latest-c: 3.0.0 +latest: 3.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP workspaces no args, one failing workspace sets exitCode to 1 > printed the expected output 1`] = ` +workspace-a: +latest-a: 1.0.0 +latest: 1.0.0 +workspace-b: +latest-b: 2.0.0 +latest: 2.0.0 +workspace-c: +latest-c: 3.0.0 +latest: 3.0.0 +workspace-d: +` + +exports[`test/lib/commands/dist-tag.js TAP workspaces no args, one workspace > printed the expected output 1`] = ` +workspace-a: +latest-a: 1.0.0 +latest: 1.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP workspaces one arg -- . > printed the expected output 1`] = ` +workspace-a: +latest-a: 1.0.0 +latest: 1.0.0 +workspace-b: +latest-b: 2.0.0 +latest: 2.0.0 +workspace-c: +latest-c: 3.0.0 +latest: 3.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP workspaces one arg -- .@1, ignores version spec > printed the expected output 1`] = ` +workspace-a: +latest-a: 1.0.0 +latest: 1.0.0 +workspace-b: +latest-b: 2.0.0 +latest: 2.0.0 +workspace-c: +latest-c: 3.0.0 +latest: 3.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP workspaces one arg -- list > printed the expected output 1`] = ` +workspace-a: +latest-a: 1.0.0 +latest: 1.0.0 +workspace-b: +latest-b: 2.0.0 +latest: 2.0.0 +workspace-c: +latest-c: 3.0.0 +latest: 3.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP workspaces two args -- list, . > printed the expected output 1`] = ` +workspace-a: +latest-a: 1.0.0 +latest: 1.0.0 +workspace-b: +latest-b: 2.0.0 +latest: 2.0.0 +workspace-c: +latest-c: 3.0.0 +latest: 3.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP workspaces two args -- list, .@1, ignores version spec > printed the expected output 1`] = ` +workspace-a: +latest-a: 1.0.0 +latest: 1.0.0 +workspace-b: +latest-b: 2.0.0 +latest: 2.0.0 +workspace-c: +latest-c: 3.0.0 +latest: 3.0.0 +` + +exports[`test/lib/commands/dist-tag.js TAP workspaces two args -- list, @scoped/pkg, logs a warning and ignores workspaces > printed the expected output 1`] = ` +a: 0.0.1 +b: 0.5.0 +latest: 1.0.0 +` diff --git a/tap-snapshots/test/lib/commands/fund.js.test.cjs b/tap-snapshots/test/lib/commands/fund.js.test.cjs new file mode 100644 index 000000000..f0df1e1c5 --- /dev/null +++ b/tap-snapshots/test/lib/commands/fund.js.test.cjs @@ -0,0 +1,114 @@ +/* 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/fund.js TAP fund a package with type and multiple sources > should print prompt select message 1`] = ` +1: Foo funding available at the following URL: http://example.com/foo +2: Lorem funding available at the following URL: http://example.com/foo-lorem +Run \`npm fund [<@scope>/]<pkg> --which=1\`, for example, to open the first funding URL listed in that package + +` + +exports[`test/lib/commands/fund.js TAP fund colors > should print output with color info 1`] = ` +[0mtest-fund-colors@1.0.0[0m +[0m+-- [40m[37mhttp://example.com/a[39m[49m[0m +[0m| \`-- a@1.0.0[0m +[0m\`-- [40m[37mhttp://example.com/b[39m[49m[0m +[0m | \`-- b@1.0.0, c@1.0.0[0m +[0m +-- [40m[37mhttp://example.com/d[39m[49m[0m +[0m | \`-- d@1.0.0[0m +[0m \`-- [40m[37mhttp://example.com/e[39m[49m[0m +[0m \`-- e@1.0.0[0m +[0m[0m + +` + +exports[`test/lib/commands/fund.js TAP fund containing multi-level nested deps with no funding > should omit dependencies with no funding declared 1`] = ` +nested-no-funding-packages@1.0.0 ++-- https://example.com/lorem +| \`-- lorem@1.0.0 +\`-- http://example.com/donate + \`-- bar@1.0.0 + + +` + +exports[`test/lib/commands/fund.js TAP fund in which same maintainer owns all its deps > should print stack packages together 1`] = ` +http://example.com/donate + \`-- maintainer-owns-all-deps@1.0.0, dep-foo@1.0.0, dep-sub-foo@1.0.0, dep-bar@1.0.0 + + +` + +exports[`test/lib/commands/fund.js TAP fund pkg missing version number > should print name only 1`] = ` +http://example.com/foo + \`-- foo + + +` + +exports[`test/lib/commands/fund.js TAP fund using nested packages with multiple sources > should prompt with all available URLs 1`] = ` +1: Funding available at the following URL: https://one.example.com +2: Funding available at the following URL: https://two.example.com +Run \`npm fund [<@scope>/]<pkg> --which=1\`, for example, to open the first funding URL listed in that package + +` + +exports[`test/lib/commands/fund.js TAP fund using nested packages with multiple sources, with a source number > should open the numbered URL 1`] = ` +Funding available at the following URL: + https://one.example.com +` + +exports[`test/lib/commands/fund.js TAP fund using package argument > should open funding url 1`] = ` +individual funding available at the following URL: + http://example.com/donate +` + +exports[`test/lib/commands/fund.js TAP fund using pkg name while having conflicting versions > should open greatest version 1`] = ` +Funding available at the following URL: + http://example.com/2 +` + +exports[`test/lib/commands/fund.js TAP fund using string shorthand > should open string-only url 1`] = ` +Funding available at the following URL: + https://example.com/sponsor +` + +exports[`test/lib/commands/fund.js TAP fund with no package containing funding > should print empty funding info 1`] = ` +no-funding-package@0.0.0 + + +` + +exports[`test/lib/commands/fund.js TAP sub dep with fund info and a parent with no funding info > should nest sub dep as child of root 1`] = ` +test-multiple-funding-sources@1.0.0 ++-- http://example.com/b +| \`-- b@1.0.0 +\`-- http://example.com/c + \`-- c@1.0.0 + + +` + +exports[`test/lib/commands/fund.js TAP workspaces filter funding info by a specific workspace > should display only filtered workspace name and its deps 1`] = ` +workspaces-support@1.0.0 +\`-- https://example.com/a + | \`-- a@1.0.0 + \`-- http://example.com/c + \`-- c@1.0.0 + + +` + +exports[`test/lib/commands/fund.js TAP workspaces filter funding info by a specific workspace > should display only filtered workspace path and its deps 1`] = ` +workspaces-support@1.0.0 +\`-- https://example.com/a + | \`-- a@1.0.0 + \`-- http://example.com/c + \`-- c@1.0.0 + + +` diff --git a/tap-snapshots/test/lib/commands/init.js.test.cjs b/tap-snapshots/test/lib/commands/init.js.test.cjs new file mode 100644 index 000000000..3ca9d9317 --- /dev/null +++ b/tap-snapshots/test/lib/commands/init.js.test.cjs @@ -0,0 +1,37 @@ +/* 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/init.js TAP npm init workspces with root > does not print helper info 1`] = ` +Array [] +` + +exports[`test/lib/commands/init.js TAP workspaces no args > should print helper info 1`] = ` +Array [ + Array [ + String( + This utility will walk you through creating a package.json file. + It only covers the most common items, and tries to guess sensible defaults. + + See \`npm help init\` for definitive documentation on these fields + and exactly what they do. + + Use \`npm install <pkg>\` afterwards to install a package and + save it as a dependency in the package.json file. + + Press ^C at any time to quit. + ), + ], +] +` + +exports[`test/lib/commands/init.js TAP workspaces no args, existing folder > should print helper info 1`] = ` +Array [] +` + +exports[`test/lib/commands/init.js TAP workspaces with arg but missing workspace folder > should print helper info 1`] = ` +Array [] +` diff --git a/tap-snapshots/test/lib/commands/link.js.test.cjs b/tap-snapshots/test/lib/commands/link.js.test.cjs new file mode 100644 index 000000000..a9a10b20a --- /dev/null +++ b/tap-snapshots/test/lib/commands/link.js.test.cjs @@ -0,0 +1,45 @@ +/* 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/link.js TAP link global linked pkg to local nm when using args > should create a local symlink to global pkg 1`] = ` +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/@myscope/bar -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/global-prefix/lib/node_modules/@myscope/bar +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/scoped-linked +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/a -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/global-prefix/lib/node_modules/a +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/link-me-too -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/link-me-too +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/my-project/node_modules/test-pkg-link -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-nm-when-using-args/test-pkg-link + +` + +exports[`test/lib/commands/link.js TAP link global linked pkg to local workspace using args > should create a local symlink to global pkg 1`] = ` +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/@myscope/bar -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/global-prefix/lib/node_modules/@myscope/bar +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/scoped-linked +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/a -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/global-prefix/lib/node_modules/a +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/link-me-too -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/link-me-too +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/test-pkg-link -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/test-pkg-link +{CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/node_modules/x -> {CWD}/test/lib/commands/tap-testdir-link-link-global-linked-pkg-to-local-workspace-using-args/my-project/packages/x + +` + +exports[`test/lib/commands/link.js TAP link pkg already in global space > should create a local symlink to global pkg 1`] = ` +{CWD}/test/lib/commands/tap-testdir-link-link-pkg-already-in-global-space/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/commands/tap-testdir-link-link-pkg-already-in-global-space/scoped-linked + +` + +exports[`test/lib/commands/link.js TAP link pkg already in global space when prefix is a symlink > should create a local symlink to global pkg 1`] = ` +{CWD}/test/lib/commands/tap-testdir-link-link-pkg-already-in-global-space-when-prefix-is-a-symlink/my-project/node_modules/@myscope/linked -> {CWD}/test/lib/commands/tap-testdir-link-link-pkg-already-in-global-space-when-prefix-is-a-symlink/scoped-linked + +` + +exports[`test/lib/commands/link.js TAP link to globalDir when in current working dir of pkg and no args > should create a global link to current pkg 1`] = ` +{CWD}/test/lib/commands/tap-testdir-link-link-to-globalDir-when-in-current-working-dir-of-pkg-and-no-args/global-prefix/lib/node_modules/test-pkg-link -> {CWD}/test/lib/commands/tap-testdir-link-link-to-globalDir-when-in-current-working-dir-of-pkg-and-no-args/test-pkg-link + +` + +exports[`test/lib/commands/link.js TAP link ws to globalDir when workspace specified and no args > should create a global link to current pkg 1`] = ` +{CWD}/test/lib/commands/tap-testdir-link-link-ws-to-globalDir-when-workspace-specified-and-no-args/global-prefix/lib/node_modules/a -> {CWD}/test/lib/commands/tap-testdir-link-link-ws-to-globalDir-when-workspace-specified-and-no-args/test-pkg-link/packages/a + +` diff --git a/tap-snapshots/test/lib/commands/ls.js.test.cjs b/tap-snapshots/test/lib/commands/ls.js.test.cjs new file mode 100644 index 000000000..105b13b5e --- /dev/null +++ b/tap-snapshots/test/lib/commands/ls.js.test.cjs @@ -0,0 +1,710 @@ +/* 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/ls.js TAP ignore missing optional deps --json > ls --json problems 1`] = ` +Array [ + "invalid: optional-wrong@3.2.1 {project}/node_modules/optional-wrong", + "missing: peer-missing@1, required by test-npm-ls-ignore-missing-optional@1.2.3", + "invalid: peer-optional-wrong@3.2.1 {project}/node_modules/peer-optional-wrong", + "invalid: peer-wrong@3.2.1 {project}/node_modules/peer-wrong", + "missing: prod-missing@1, required by test-npm-ls-ignore-missing-optional@1.2.3", + "invalid: prod-wrong@3.2.1 {project}/node_modules/prod-wrong", +] +` + +exports[`test/lib/commands/ls.js TAP ignore missing optional deps --parseable > ls --parseable result 1`] = ` +{project} +{project}/node_modules/optional-ok +{project}/node_modules/optional-wrong +{project}/node_modules/peer-ok +{project}/node_modules/peer-optional-ok +{project}/node_modules/peer-optional-wrong +{project}/node_modules/peer-wrong +{project}/node_modules/prod-ok +{project}/node_modules/prod-wrong +` + +exports[`test/lib/commands/ls.js TAP ignore missing optional deps human output > ls result 1`] = ` +test-npm-ls-ignore-missing-optional@1.2.3 {project} ++-- unmet optional dependency optional-missing@1 ++-- optional-ok@1.2.3 ++-- optional-wrong@3.2.1 invalid: "1" from the root project ++-- unmet dependency peer-missing@1 ++-- peer-ok@1.2.3 ++-- unmet optional dependency peer-optional-missing@1 ++-- peer-optional-ok@1.2.3 ++-- peer-optional-wrong@3.2.1 invalid: "1" from the root project ++-- peer-wrong@3.2.1 invalid: "1" from the root project ++-- unmet dependency prod-missing@1 ++-- prod-ok@1.2.3 +\`-- prod-wrong@3.2.1 invalid: "1" from the root project + +` + +exports[`test/lib/commands/ls.js TAP ls --depth=0 > should output tree containing only top-level dependencies 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---depth-0 ++-- chai@1.0.0 +\`-- foo@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls --depth=1 > should output tree containing top-level deps and their deps only 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---depth-1 ++-- a@1.0.0 +| \`-- b@1.0.0 +\`-- e@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls --dev > should output tree containing dev deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---dev +\`-- dev-dep@1.0.0 + \`-- foo@1.0.0 + \`-- dog@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls --link > should output tree containing linked deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---link +\`-- linked-dep@1.0.0 -> ./linked-dep + +` + +exports[`test/lib/commands/ls.js TAP ls --long --depth=0 > should output tree containing top-level deps with descriptions 1`] = ` +test-npm-ls@1.0.0 +| {CWD}/tap-testdir-ls-ls---long---depth-0 +| ++-- chai@1.0.0 +| ++-- dev-dep@1.0.0 +| A DEV dep kind of dep ++-- optional-dep@1.0.0 +| Maybe a dep? ++-- peer-dep@1.0.0 +| Peer-dep description here +\`-- prod-dep@1.0.0 + A PROD dep kind of dep + +` + +exports[`test/lib/commands/ls.js TAP ls --long > should output tree info with descriptions 1`] = ` +test-npm-ls@1.0.0 +| {CWD}/tap-testdir-ls-ls---long +| ++-- chai@1.0.0 +| ++-- dev-dep@1.0.0 +| | A DEV dep kind of dep +| \`-- foo@1.0.0 +| | +| \`-- dog@1.0.0 +| ++-- optional-dep@1.0.0 +| Maybe a dep? ++-- peer-dep@1.0.0 +| Peer-dep description here +\`-- prod-dep@1.0.0 + | A PROD dep kind of dep + \`-- dog@2.0.0 + A dep that bars + +` + +exports[`test/lib/commands/ls.js TAP ls --only=development > should output tree containing only development deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---only-development +\`-- dev-dep@1.0.0 + \`-- foo@1.0.0 + \`-- dog@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls --only=prod > should output tree containing only prod deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---only-prod ++-- chai@1.0.0 ++-- optional-dep@1.0.0 +\`-- prod-dep@1.0.0 + \`-- dog@2.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --depth=0 > should output tree containing only top-level dependencies 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---depth-0 +{CWD}/tap-testdir-ls-ls---parseable---depth-0/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable---depth-0/node_modules/foo +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --depth=1 > should output parseable containing top-level deps and their deps only 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---depth-1 +{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable---depth-1/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --dev > should output tree containing dev deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---dev +{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/dev-dep +{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable---dev/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --link > should output tree containing linked deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---link +{CWD}/tap-testdir-ls-ls---parseable---link/node_modules/linked-dep +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --long --depth=0 > should output tree containing top-level deps with descriptions 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/chai:chai@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/dev-dep:dev-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/optional-dep:optional-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/peer-dep:peer-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long---depth-0/node_modules/prod-dep:prod-dep@1.0.0 +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --long > should output tree info with descriptions 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/chai:chai@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/dev-dep:dev-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/optional-dep:optional-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/peer-dep:peer-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/prod-dep:prod-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/foo:foo@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/prod-dep/node_modules/dog:dog@2.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long/node_modules/dog:dog@1.0.0 +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --long missing/invalid/extraneous > should output parseable result containing EXTRANEOUS/INVALID labels 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/chai:chai@1.0.0:EXTRANEOUS +{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/foo:foo@1.0.0:INVALID +{CWD}/tap-testdir-ls-ls---parseable---long-missing-invalid-extraneous/node_modules/dog:dog@1.0.0 +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --long print symlink target location > should output parseable results with symlink targets 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/chai:chai@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/dev-dep:dev-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/linked-dep:linked-dep@1.0.0:{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/linked-dep +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/optional-dep:optional-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/peer-dep:peer-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/prod-dep:prod-dep@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/foo:foo@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/prod-dep/node_modules/dog:dog@2.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-print-symlink-target-location/node_modules/dog:dog@1.0.0 +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --long with extraneous deps > should output long parseable output with extraneous info 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps:test-npm-ls@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/chai:chai@1.0.0:EXTRANEOUS +{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/foo:foo@1.0.0 +{CWD}/tap-testdir-ls-ls---parseable---long-with-extraneous-deps/node_modules/dog:dog@1.0.0 +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --only=development > should output tree containing only development deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---only-development +{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/dev-dep +{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable---only-development/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --only=prod > should output tree containing only prod deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---only-prod +{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/optional-dep +{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep +{CWD}/tap-testdir-ls-ls---parseable---only-prod/node_modules/prod-dep/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable --production > should output tree containing production deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable---production +{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/optional-dep +{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/prod-dep +{CWD}/tap-testdir-ls-ls---parseable---production/node_modules/prod-dep/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable cycle deps > should print tree output omitting deduped ref 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-cycle-deps +{CWD}/tap-testdir-ls-ls---parseable-cycle-deps/node_modules/a +{CWD}/tap-testdir-ls-ls---parseable-cycle-deps/node_modules/b +` + +exports[`test/lib/commands/ls.js TAP ls --parseable default --depth value should be 0 > should output parseable output containing only top-level dependencies 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0 +{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable-default---depth-value-should-be-0/node_modules/foo +` + +exports[`test/lib/commands/ls.js TAP ls --parseable empty location > should print empty result 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-empty-location +` + +exports[`test/lib/commands/ls.js TAP ls --parseable extraneous deps > should output containing problems info 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps +{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-extraneous-deps/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable from and resolved properties > should not be printed in tree output 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-from-and-resolved-properties +{CWD}/tap-testdir-ls-ls---parseable-from-and-resolved-properties/node_modules/simple-output +` + +exports[`test/lib/commands/ls.js TAP ls --parseable global > should print parseable output for global deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-global +{CWD}/tap-testdir-ls-ls---parseable-global/node_modules/a +{CWD}/tap-testdir-ls-ls---parseable-global/node_modules/b +{CWD}/tap-testdir-ls-ls---parseable-global/node_modules/b/node_modules/c +` + +exports[`test/lib/commands/ls.js TAP ls --parseable json read problems > should print empty result 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-json-read-problems +` + +exports[`test/lib/commands/ls.js TAP ls --parseable missing package.json > should output parseable missing name/version of top-level package 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-missing-package.json +{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/dog +{CWD}/tap-testdir-ls-ls---parseable-missing-package.json/node_modules/foo +` + +exports[`test/lib/commands/ls.js TAP ls --parseable missing/invalid/extraneous > should output parseable containing top-level deps and their deps only 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous +{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-missing-invalid-extraneous/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable no args > should output parseable representation of dependencies structure 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-no-args +{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-no-args/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable resolved points to git ref > should output tree containing git refs 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-resolved-points-to-git-ref +{CWD}/tap-testdir-ls-ls---parseable-resolved-points-to-git-ref/node_modules/abbrev +` + +exports[`test/lib/commands/ls.js TAP ls --parseable unmet optional dep > should output parseable with empty entry for missing optional deps 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/dev-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/optional-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/peer-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/prod-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/prod-dep/node_modules/dog +{CWD}/tap-testdir-ls-ls---parseable-unmet-optional-dep/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable unmet peer dep > should output parseable signaling missing peer dep in problems 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/dev-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/optional-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/peer-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/prod-dep +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/foo +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/prod-dep/node_modules/dog +{CWD}/tap-testdir-ls-ls---parseable-unmet-peer-dep/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable using aliases > should output tree containing aliases 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-using-aliases +{CWD}/tap-testdir-ls-ls---parseable-using-aliases/node_modules/a +` + +exports[`test/lib/commands/ls.js TAP ls --parseable with filter arg > should output parseable contaning only occurrences of filtered by package 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-with-filter-arg/node_modules/chai +` + +exports[`test/lib/commands/ls.js TAP ls --parseable with filter arg nested dep > should output parseable contaning only occurrences of filtered package 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-with-filter-arg-nested-dep/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --parseable with missing filter arg > should output parseable output containing no dependencies info 1`] = ` + +` + +exports[`test/lib/commands/ls.js TAP ls --parseable with multiple filter args > should output parseable contaning only occurrences of multiple filtered packages and their ancestors 1`] = ` +{CWD}/tap-testdir-ls-ls---parseable-with-multiple-filter-args/node_modules/chai +{CWD}/tap-testdir-ls-ls---parseable-with-multiple-filter-args/node_modules/dog +` + +exports[`test/lib/commands/ls.js TAP ls --production > should output tree containing production deps 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls---production ++-- chai@1.0.0 ++-- optional-dep@1.0.0 +\`-- prod-dep@1.0.0 + \`-- dog@2.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls broken resolved field > should NOT print git refs in output tree 1`] = ` +npm-broken-resolved-field-test@1.0.0 {CWD}/tap-testdir-ls-ls-broken-resolved-field +\`-- a@1.0.1 + +` + +exports[`test/lib/commands/ls.js TAP ls colored output > should output tree containing color info 1`] = ` +[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-colored-output[0m +[0m+-- chai@1.0.0 [32m[40mextraneous[49m[39m[0m +[0m+-- foo@1.0.0 [31m[40minvalid: "^2.0.0" from the root project[49m[39m[0m +[0m| \`-- dog@1.0.0[0m +[0m\`-- [31m[40mUNMET DEPENDENCY[49m[39m ipsum@^1.0.0[0m +[0m[0m +` + +exports[`test/lib/commands/ls.js TAP ls cycle deps > should print tree output containing deduped ref 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-cycle-deps +\`-- a@1.0.0 + \`-- b@1.0.0 + \`-- a@1.0.0 deduped + +` + +exports[`test/lib/commands/ls.js TAP ls cycle deps with filter args > should print tree output containing deduped ref 1`] = ` +[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-cycle-deps-with-filter-args[0m +[0m\`-- [33m[40ma@1.0.0[49m[39m[0m +[0m \`-- b@1.0.0[0m +[0m \`-- [33m[40ma@1.0.0[49m[39m [90mdeduped[39m[0m +[0m[0m +` + +exports[`test/lib/commands/ls.js TAP ls deduped missing dep > should output parseable signaling missing peer dep in problems 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-deduped-missing-dep ++-- a@1.0.0 +| \`-- UNMET DEPENDENCY b@^1.0.0 +\`-- UNMET DEPENDENCY b@^1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls default --depth value should be 0 > should output tree containing only top-level dependencies 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-default---depth-value-should-be-0 ++-- chai@1.0.0 +\`-- foo@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls empty location > should print empty result 1`] = ` +{CWD}/tap-testdir-ls-ls-empty-location +\`-- (empty) + +` + +exports[`test/lib/commands/ls.js TAP ls extraneous deps > should output containing problems info 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-extraneous-deps ++-- chai@1.0.0 extraneous +\`-- foo@1.0.0 + \`-- dog@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls filter pkg arg using depth option > should list a in top-level only 1`] = ` +test-pkg-arg-filter-with-depth-opt@1.0.0 {CWD}/tap-testdir-ls-ls-filter-pkg-arg-using-depth-option +\`-- a@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls filter pkg arg using depth option > should print empty results msg 1`] = ` +test-pkg-arg-filter-with-depth-opt@1.0.0 {CWD}/tap-testdir-ls-ls-filter-pkg-arg-using-depth-option +\`-- (empty) + +` + +exports[`test/lib/commands/ls.js TAP ls filter pkg arg using depth option > should print expected result 1`] = ` +test-pkg-arg-filter-with-depth-opt@1.0.0 {CWD}/tap-testdir-ls-ls-filter-pkg-arg-using-depth-option +\`-- b@1.0.0 + \`-- c@1.0.0 + \`-- d@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls filtering by child of missing dep > should print tree and not duplicate child of missing items 1`] = ` +filter-by-child-of-missing-dep@1.0.0 {CWD}/tap-testdir-ls-ls-filtering-by-child-of-missing-dep ++-- b@1.0.0 extraneous +| \`-- c@1.0.0 deduped ++-- c@1.0.0 extraneous +\`-- d@1.0.0 extraneous + \`-- c@2.0.0 extraneous + +` + +exports[`test/lib/commands/ls.js TAP ls from and resolved properties > should not be printed in tree output 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-from-and-resolved-properties +\`-- simple-output@2.1.1 + +` + +exports[`test/lib/commands/ls.js TAP ls global > should print tree and not mark top-level items extraneous 1`] = ` +{CWD}/tap-testdir-ls-ls-global ++-- a@1.0.0 +\`-- b@1.0.0 + \`-- c@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls invalid deduped dep > should output tree signaling mismatching peer dep in problems 1`] = ` +[0minvalid-deduped-dep@1.0.0 {CWD}/tap-testdir-ls-ls-invalid-deduped-dep[0m +[0m+-- a@1.0.0[0m +[0m| \`-- b@1.0.0 [90mdeduped[39m [31m[40minvalid: "^2.0.0" from the root project, "^2.0.0" from node_modules/a[49m[39m[0m +[0m\`-- b@1.0.0 [31m[40minvalid: "^2.0.0" from the root project, "^2.0.0" from node_modules/a[49m[39m[0m +[0m[0m +` + +exports[`test/lib/commands/ls.js TAP ls invalid peer dep > should output tree signaling mismatching peer dep in problems 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-invalid-peer-dep ++-- chai@1.0.0 ++-- dev-dep@1.0.0 +| \`-- foo@1.0.0 +| \`-- dog@1.0.0 ++-- optional-dep@1.0.0 ++-- peer-dep@1.0.0 invalid: "^2.0.0" from the root project +\`-- prod-dep@1.0.0 + \`-- dog@2.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls json read problems > should print empty result 1`] = ` +{CWD}/tap-testdir-ls-ls-json-read-problems +\`-- (empty) + +` + +exports[`test/lib/commands/ls.js TAP ls loading a tree containing workspaces > should filter by parent folder workspace config 1`] = ` +workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces ++-- e@1.0.0 -> ./group/e +\`-- f@1.0.0 -> ./group/f + +` + +exports[`test/lib/commands/ls.js TAP ls loading a tree containing workspaces > should filter single workspace 1`] = ` +workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces ++-- a@1.0.0 -> ./a +| \`-- d@1.0.0 deduped -> ./d +\`-- d@1.0.0 -> ./d + +` + +exports[`test/lib/commands/ls.js TAP ls loading a tree containing workspaces > should filter using workspace config 1`] = ` +workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces +\`-- a@1.0.0 -> ./a + +-- baz@1.0.0 + +-- c@1.0.0 + \`-- d@1.0.0 -> ./d + \`-- foo@1.1.1 + \`-- bar@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls loading a tree containing workspaces > should list --all workspaces properly 1`] = ` +workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces ++-- a@1.0.0 -> ./a +| +-- baz@1.0.0 +| +-- c@1.0.0 +| \`-- d@1.0.0 deduped -> ./d ++-- b@1.0.0 -> ./b ++-- d@1.0.0 -> ./d +| \`-- foo@1.1.1 +| \`-- bar@1.0.0 ++-- e@1.0.0 -> ./group/e +\`-- f@1.0.0 -> ./group/f + +` + +exports[`test/lib/commands/ls.js TAP ls loading a tree containing workspaces > should list only prod deps of workspaces 1`] = ` +workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces ++-- a@1.0.0 -> ./a +| +-- c@1.0.0 +| \`-- d@1.0.0 deduped -> ./d ++-- b@1.0.0 -> ./b ++-- d@1.0.0 -> ./d +| \`-- foo@1.1.1 +| \`-- bar@1.0.0 ++-- e@1.0.0 -> ./group/e +\`-- f@1.0.0 -> ./group/f + +` + +exports[`test/lib/commands/ls.js TAP ls loading a tree containing workspaces > should list workspaces properly with default configs 1`] = ` +[0mworkspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces[0m +[0m+-- [32ma@1.0.0[39m -> ./a[0m +[0m| +-- baz@1.0.0[0m +[0m| +-- c@1.0.0[0m +[0m| \`-- d@1.0.0 [90mdeduped[39m -> ./d[0m +[0m+-- [32mb@1.0.0[39m -> ./b[0m +[0m+-- [32md@1.0.0[39m -> ./d[0m +[0m| \`-- foo@1.1.1[0m +[0m+-- [32me@1.0.0[39m -> ./group/e[0m +[0m\`-- [32mf@1.0.0[39m -> ./group/f[0m +[0m[0m +` + +exports[`test/lib/commands/ls.js TAP ls loading a tree containing workspaces > should not list workspaces with --no-workspaces 1`] = ` +[0mworkspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces[0m +[0m\`-- (empty)[0m +[0m[0m +` + +exports[`test/lib/commands/ls.js TAP ls loading a tree containing workspaces > should print all tree and filter by dep within only the ws subtree 1`] = ` +workspaces-tree@1.0.0 {CWD}/tap-testdir-ls-ls-loading-a-tree-containing-workspaces +\`-- d@1.0.0 -> ./d + \`-- foo@1.1.1 + \`-- bar@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls missing package.json > should output tree missing name/version of top-level package 1`] = ` +{CWD}/tap-testdir-ls-ls-missing-package.json ++-- chai@1.0.0 extraneous ++-- dog@1.0.0 extraneous +\`-- foo@1.0.0 extraneous + \`-- dog@1.0.0 deduped + +` + +exports[`test/lib/commands/ls.js TAP ls missing/invalid/extraneous > should output tree containing missing, invalid, extraneous labels 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-missing-invalid-extraneous ++-- chai@1.0.0 extraneous ++-- foo@1.0.0 invalid: "^2.0.0" from the root project +| \`-- dog@1.0.0 +\`-- UNMET DEPENDENCY ipsum@^1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls no args > should output tree representation of dependencies structure 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-no-args ++-- chai@1.0.0 +\`-- foo@1.0.0 + \`-- dog@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls print deduped symlinks > should output tree containing linked deps 1`] = ` +print-deduped-symlinks@1.0.0 {CWD}/tap-testdir-ls-ls-print-deduped-symlinks ++-- a@1.0.0 +| \`-- b@1.0.0 deduped -> ./b +\`-- b@1.0.0 -> ./b + +` + +exports[`test/lib/commands/ls.js TAP ls resolved points to git ref > should output tree containing git refs 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-resolved-points-to-git-ref +\`-- abbrev@1.1.1 (git+ssh://git@github.com/isaacs/abbrev-js.git#b8f3a2fc0c3bb8ffd8b0d0072cc6b5a3667e963c) + +` + +exports[`test/lib/commands/ls.js TAP ls unmet optional dep > should output tree with empty entry for missing optional deps 1`] = ` +[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-unmet-optional-dep[0m +[0m+-- chai@1.0.0[0m +[0m+-- dev-dep@1.0.0[0m +[0m| \`-- foo@1.0.0[0m +[0m| \`-- dog@1.0.0[0m +[0m+-- [33m[40mUNMET OPTIONAL DEPENDENCY[49m[39m missing-optional-dep@^1.0.0[0m +[0m+-- optional-dep@1.0.0 [31m[40minvalid: "^2.0.0" from the root project[49m[39m[0m +[0m+-- peer-dep@1.0.0[0m +[0m\`-- prod-dep@1.0.0[0m +[0m \`-- dog@2.0.0[0m +[0m[0m +` + +exports[`test/lib/commands/ls.js TAP ls unmet peer dep > should output tree signaling missing peer dep in problems 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-unmet-peer-dep +\`-- UNMET DEPENDENCY peer-dep@* + +` + +exports[`test/lib/commands/ls.js TAP ls using aliases > should output tree containing aliases 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-using-aliases +\`-- a@npm:b@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls with args and dedupe entries > should print tree output containing deduped ref 1`] = ` +[0mdedupe-entries@1.0.0 {CWD}/tap-testdir-ls-ls-with-args-and-dedupe-entries[0m +[0m+-- @npmcli/a@1.0.0[0m +[0m| \`-- [33m[40m@npmcli/b@1.1.2[49m[39m [90mdeduped[39m[0m +[0m+-- [33m[40m@npmcli/b@1.1.2[49m[39m[0m +[0m\`-- @npmcli/c@1.0.0[0m +[0m \`-- [33m[40m@npmcli/b@1.1.2[49m[39m [90mdeduped[39m[0m +[0m[0m +` + +exports[`test/lib/commands/ls.js TAP ls with args and different order of items > should print tree output containing deduped ref 1`] = ` +dedupe-entries@1.0.0 {CWD}/tap-testdir-ls-ls-with-args-and-different-order-of-items ++-- @npmcli/a@1.0.0 +| \`-- @npmcli/c@1.0.0 deduped ++-- @npmcli/b@1.1.2 +| \`-- @npmcli/c@1.0.0 deduped +\`-- @npmcli/c@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls with dot filter arg > should output tree contaning only occurrences of filtered by package and colored output 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-dot-filter-arg +\`-- (empty) + +` + +exports[`test/lib/commands/ls.js TAP ls with filter arg > should output tree contaning only occurrences of filtered by package and colored output 1`] = ` +[0mtest-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-filter-arg[0m +[0m\`-- [33m[40mchai@1.0.0[49m[39m[0m +[0m[0m +` + +exports[`test/lib/commands/ls.js TAP ls with filter arg nested dep > should output tree contaning only occurrences of filtered package and its ancestors 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-filter-arg-nested-dep +\`-- foo@1.0.0 + \`-- dog@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls with missing filter arg > should output tree containing no dependencies info 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-missing-filter-arg +\`-- (empty) + +` + +exports[`test/lib/commands/ls.js TAP ls with multiple filter args > should output tree contaning only occurrences of multiple filtered packages and their ancestors 1`] = ` +test-npm-ls@1.0.0 {CWD}/tap-testdir-ls-ls-with-multiple-filter-args ++-- chai@1.0.0 +\`-- foo@1.0.0 + \`-- dog@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP ls with no args dedupe entries > should print tree output containing deduped ref 1`] = ` +dedupe-entries@1.0.0 {CWD}/tap-testdir-ls-ls-with-no-args-dedupe-entries ++-- @npmcli/a@1.0.0 +| \`-- @npmcli/b@1.1.2 deduped ++-- @npmcli/b@1.1.2 +\`-- @npmcli/c@1.0.0 + \`-- @npmcli/b@1.1.2 deduped + +` + +exports[`test/lib/commands/ls.js TAP ls with no args dedupe entries and not displaying all > should print tree output containing deduped ref 1`] = ` +dedupe-entries@1.0.0 {CWD}/tap-testdir-ls-ls-with-no-args-dedupe-entries-and-not-displaying-all ++-- @npmcli/a@1.0.0 ++-- @npmcli/b@1.1.2 +\`-- @npmcli/c@1.0.0 + +` + +exports[`test/lib/commands/ls.js TAP show multiple invalid reasons > ls result 1`] = ` +test-npm-ls@1.0.0 {cwd}/tap-testdir-ls-show-multiple-invalid-reasons ++-- cat@1.0.0 invalid: "^2.0.0" from the root project +| \`-- dog@1.0.0 deduped invalid: "^1.2.3" from the root project, "^2.0.0" from node_modules/cat ++-- chai@1.0.0 extraneous +| \`-- dog@1.0.0 deduped invalid: "^1.2.3" from the root project, "^2.0.0" from node_modules/cat, "2.x" from node_modules/chai +\`-- dog@1.0.0 invalid: "^1.2.3" from the root project, "^2.0.0" from node_modules/cat, "2.x" from node_modules/chai + \`-- cat@1.0.0 deduped invalid: "^2.0.0" from the root project + +` diff --git a/tap-snapshots/test/lib/commands/outdated.js.test.cjs b/tap-snapshots/test/lib/commands/outdated.js.test.cjs new file mode 100644 index 000000000..c286ad734 --- /dev/null +++ b/tap-snapshots/test/lib/commands/outdated.js.test.cjs @@ -0,0 +1,256 @@ +/* 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/outdated.js TAP should display outdated deps outdated --all > must match snapshot 1`] = ` + +Package Current Wanted Latest Location Depended by +cat 1.0.0 1.0.1 1.0.1 node_modules/cat tap-testdir-outdated-should-display-outdated-deps +chai 1.0.0 1.0.1 1.0.1 node_modules/chai tap-testdir-outdated-should-display-outdated-deps +dog 1.0.1 1.0.1 2.0.0 node_modules/dog tap-testdir-outdated-should-display-outdated-deps +theta MISSING 1.0.1 1.0.1 - tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --json --long > must match snapshot 1`] = ` + +{ + "cat": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/cat", + "type": "dependencies" + }, + "chai": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/chai", + "type": "peerDependencies" + }, + "dog": { + "current": "1.0.1", + "wanted": "1.0.1", + "latest": "2.0.0", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/dog", + "type": "dependencies" + }, + "theta": { + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "type": "dependencies" + } +} +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --json > must match snapshot 1`] = ` + +{ + "cat": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/cat" + }, + "chai": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/chai" + }, + "dog": { + "current": "1.0.1", + "wanted": "1.0.1", + "latest": "2.0.0", + "dependent": "tap-testdir-outdated-should-display-outdated-deps", + "location": "{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/dog" + }, + "theta": { + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "tap-testdir-outdated-should-display-outdated-deps" + } +} +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --long > must match snapshot 1`] = ` + +Package Current Wanted Latest Location Depended by Package Type Homepage +cat 1.0.0 1.0.1 1.0.1 node_modules/cat tap-testdir-outdated-should-display-outdated-deps dependencies +chai 1.0.0 1.0.1 1.0.1 node_modules/chai tap-testdir-outdated-should-display-outdated-deps peerDependencies +dog 1.0.1 1.0.1 2.0.0 node_modules/dog tap-testdir-outdated-should-display-outdated-deps dependencies +theta MISSING 1.0.1 1.0.1 - tap-testdir-outdated-should-display-outdated-deps dependencies +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --omit=dev --omit=peer > must match snapshot 1`] = ` + +[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m +[31mcat[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/cat tap-testdir-outdated-should-display-outdated-deps +[33mdog[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/dog tap-testdir-outdated-should-display-outdated-deps +[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --omit=dev > must match snapshot 1`] = ` + +[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m +[31mcat[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/cat tap-testdir-outdated-should-display-outdated-deps +[31mchai[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/chai tap-testdir-outdated-should-display-outdated-deps +[33mdog[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/dog tap-testdir-outdated-should-display-outdated-deps +[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --omit=prod > must match snapshot 1`] = ` + +[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m +[31mcat[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/cat tap-testdir-outdated-should-display-outdated-deps +[31mchai[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/chai tap-testdir-outdated-should-display-outdated-deps +[33mdog[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/dog tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --parseable --long > must match snapshot 1`] = ` + +{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/cat:cat@1.0.1:cat@1.0.0:cat@1.0.1:tap-testdir-outdated-should-display-outdated-deps:dependencies: +{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/chai:chai@1.0.1:chai@1.0.0:chai@1.0.1:tap-testdir-outdated-should-display-outdated-deps:peerDependencies: +{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/dog:dog@1.0.1:dog@1.0.1:dog@2.0.0:tap-testdir-outdated-should-display-outdated-deps:dependencies: +:theta@1.0.1:MISSING:theta@1.0.1:tap-testdir-outdated-should-display-outdated-deps:dependencies: +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated --parseable > must match snapshot 1`] = ` + +{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/cat:cat@1.0.1:cat@1.0.0:cat@1.0.1:tap-testdir-outdated-should-display-outdated-deps +{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/chai:chai@1.0.1:chai@1.0.0:chai@1.0.1:tap-testdir-outdated-should-display-outdated-deps +{CWD}/test/lib/commands/tap-testdir-outdated-should-display-outdated-deps/node_modules/dog:dog@1.0.1:dog@1.0.1:dog@2.0.0:tap-testdir-outdated-should-display-outdated-deps +:theta@1.0.1:MISSING:theta@1.0.1:tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated > must match snapshot 1`] = ` + +[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m +[31mcat[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/cat tap-testdir-outdated-should-display-outdated-deps +[31mchai[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/chai tap-testdir-outdated-should-display-outdated-deps +[33mdog[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/dog tap-testdir-outdated-should-display-outdated-deps +[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated global > must match snapshot 1`] = ` + +Package Current Wanted Latest Location Depended by +cat 1.0.0 1.0.1 1.0.1 node_modules/cat global +` + +exports[`test/lib/commands/outdated.js TAP should display outdated deps outdated specific dep > must match snapshot 1`] = ` + +Package Current Wanted Latest Location Depended by +cat 1.0.0 1.0.1 1.0.1 node_modules/cat tap-testdir-outdated-should-display-outdated-deps +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display all dependencies 1`] = ` + +Package Current Wanted Latest Location Depended by +cat 1.0.0 1.0.1 1.0.1 node_modules/cat a@1.0.0 +chai 1.0.0 1.0.1 1.0.1 node_modules/chai foo +dog 1.0.1 1.0.1 2.0.0 node_modules/dog tap-testdir-outdated-workspaces +theta MISSING 1.0.1 1.0.1 - c@1.0.0 +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display json results filtered by ws 1`] = ` + +{ + "cat": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "a", + "location": "{CWD}/test/lib/commands/tap-testdir-outdated-workspaces/node_modules/cat" + } +} +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display missing deps when filtering by ws 1`] = ` + +Package Current Wanted Latest Location Depended by +theta MISSING 1.0.1 1.0.1 - c@1.0.0 +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display nested deps when filtering by ws and using --all 1`] = ` + +Package Current Wanted Latest Location Depended by +cat 1.0.0 1.0.1 1.0.1 node_modules/cat a@1.0.0 +chai 1.0.0 1.0.1 1.0.1 node_modules/chai foo +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display no results if ws has no deps to display 1`] = ` + +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display only root outdated when ws disabled 1`] = ` + +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display parseable results filtered by ws 1`] = ` + +{CWD}/test/lib/commands/tap-testdir-outdated-workspaces/node_modules/cat:cat@1.0.1:cat@1.0.0:cat@1.0.1:a +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display results filtered by ws 1`] = ` + +Package Current Wanted Latest Location Depended by +cat 1.0.0 1.0.1 1.0.1 node_modules/cat a@1.0.0 +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display ws outdated deps human output 1`] = ` + +Package Current Wanted Latest Location Depended by +cat 1.0.0 1.0.1 1.0.1 node_modules/cat a@1.0.0 +dog 1.0.1 1.0.1 2.0.0 node_modules/dog tap-testdir-outdated-workspaces +theta MISSING 1.0.1 1.0.1 - c@1.0.0 +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display ws outdated deps json output 1`] = ` + +{ + "cat": { + "current": "1.0.0", + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "a", + "location": "{CWD}/test/lib/commands/tap-testdir-outdated-workspaces/node_modules/cat" + }, + "dog": { + "current": "1.0.1", + "wanted": "1.0.1", + "latest": "2.0.0", + "dependent": "tap-testdir-outdated-workspaces", + "location": "{CWD}/test/lib/commands/tap-testdir-outdated-workspaces/node_modules/dog" + }, + "theta": { + "wanted": "1.0.1", + "latest": "1.0.1", + "dependent": "c" + } +} +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should display ws outdated deps parseable output 1`] = ` + +{CWD}/test/lib/commands/tap-testdir-outdated-workspaces/node_modules/cat:cat@1.0.1:cat@1.0.0:cat@1.0.1:a +{CWD}/test/lib/commands/tap-testdir-outdated-workspaces/node_modules/dog:dog@1.0.1:dog@1.0.1:dog@2.0.0:tap-testdir-outdated-workspaces +:theta@1.0.1:MISSING:theta@1.0.1:c +` + +exports[`test/lib/commands/outdated.js TAP workspaces > should highlight ws in dependend by section 1`] = ` + +[4mPackage[24m [4mCurrent[24m [4mWanted[24m [4mLatest[24m [4mLocation[24m [4mDepended by[24m +[31mcat[39m 1.0.0 [32m1.0.1[39m [35m1.0.1[39m node_modules/cat [32ma@1.0.0[39m +[33mdog[39m 1.0.1 [32m1.0.1[39m [35m2.0.0[39m node_modules/dog tap-testdir-outdated-workspaces +[31mtheta[39m MISSING [32m1.0.1[39m [35m1.0.1[39m - [32mc@1.0.0[39m +` diff --git a/tap-snapshots/test/lib/commands/owner.js.test.cjs b/tap-snapshots/test/lib/commands/owner.js.test.cjs new file mode 100644 index 000000000..f3d7335e4 --- /dev/null +++ b/tap-snapshots/test/lib/commands/owner.js.test.cjs @@ -0,0 +1,20 @@ +/* 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/owner.js TAP owner ls <pkg> > should output owners of <pkg> 1`] = ` +nlf <quitlahok@gmail.com> +ruyadorno <ruyadorno@hotmail.com> +darcyclarke <darcy@darcyclarke.me> +isaacs <i@izs.me> +` + +exports[`test/lib/commands/owner.js TAP owner ls no args > should output owners of cwd package 1`] = ` +nlf <quitlahok@gmail.com> +ruyadorno <ruyadorno@hotmail.com> +darcyclarke <darcy@darcyclarke.me> +isaacs <i@izs.me> +` diff --git a/tap-snapshots/test/lib/commands/profile.js.test.cjs b/tap-snapshots/test/lib/commands/profile.js.test.cjs new file mode 100644 index 000000000..31205b7fe --- /dev/null +++ b/tap-snapshots/test/lib/commands/profile.js.test.cjs @@ -0,0 +1,104 @@ +/* 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/profile.js TAP enable-2fa from token and set otp, retries on pending and verifies with qrcode > should output 2fa enablement success msgs 1`] = ` +Scan into your authenticator app: +qrcode + Or enter code: +1234 +2FA successfully enabled. Below are your recovery codes, please print these out. +You will need these to recover access to your account if you lose your authentication device. + 123456 + 789101 +` + +exports[`test/lib/commands/profile.js TAP profile get <key> --parseable > should output parseable result value 1`] = ` +foo +` + +exports[`test/lib/commands/profile.js TAP profile get multiple args --parseable > should output parseable profile value results 1`] = ` +foo foo@github.com (verified) https://github.com/npm +` + +exports[`test/lib/commands/profile.js TAP profile get multiple args comma separated > should output all keys 1`] = ` +foo foo@github.com (verified) https://github.com/npm +` + +exports[`test/lib/commands/profile.js TAP profile get multiple args default output > should output all keys 1`] = ` +foo foo@github.com (verified) https://github.com/npm +` + +exports[`test/lib/commands/profile.js TAP profile get no args --parseable > should output all profile info as parseable result 1`] = ` +tfa auth-and-writes +name foo +email foo@github.com +email_verified true +created 2015-02-26T01:26:37.384Z +updated 2020-08-12T16:19:35.326Z +fullname Foo Bar +homepage https://github.com +freenode foobar +twitter https://twitter.com/npmjs +github https://github.com/npm +` + +exports[`test/lib/commands/profile.js TAP profile get no args default output > should output table with contents 1`] = ` +name: foo +email: foo@github.com (verified) +two-factor auth: auth-and-writes +fullname: Foo Bar +homepage: https://github.com +freenode: foobar +twitter: https://twitter.com/npmjs +github: https://github.com/npm +created: 2015-02-26T01:26:37.384Z +updated: 2020-08-12T16:19:35.326Z +` + +exports[`test/lib/commands/profile.js TAP profile get no args no tfa enabled > should output expected profile values 1`] = ` +name: foo +email: foo@github.com (verified) +two-factor auth: disabled +fullname: Foo Bar +homepage: https://github.com +freenode: foobar +twitter: https://twitter.com/npmjs +github: https://github.com/npm +created: 2015-02-26T01:26:37.384Z +updated: 2020-08-12T16:19:35.326Z +` + +exports[`test/lib/commands/profile.js TAP profile get no args profile has cidr_whitelist item > should output table with contents 1`] = ` +name: foo +email: foo@github.com (verified) +two-factor auth: auth-and-writes +fullname: Foo Bar +homepage: https://github.com +freenode: foobar +twitter: https://twitter.com/npmjs +github: https://github.com/npm +created: 2015-02-26T01:26:37.384Z +updated: 2020-08-12T16:19:35.326Z +cidr_whitelist: 192.168.1.1 +` + +exports[`test/lib/commands/profile.js TAP profile get no args unverified email > should output table with contents 1`] = ` +name: foo +email: foo@github.com(unverified) +two-factor auth: auth-and-writes +fullname: Foo Bar +homepage: https://github.com +freenode: foobar +twitter: https://twitter.com/npmjs +github: https://github.com/npm +created: 2015-02-26T01:26:37.384Z +updated: 2020-08-12T16:19:35.326Z +` + +exports[`test/lib/commands/profile.js TAP profile set <key> <value> writable key --parseable > should output parseable set key success msg 1`] = ` +fullname Lorem Ipsum +` diff --git a/tap-snapshots/test/lib/commands/publish.js.test.cjs b/tap-snapshots/test/lib/commands/publish.js.test.cjs new file mode 100644 index 000000000..0d0fa366b --- /dev/null +++ b/tap-snapshots/test/lib/commands/publish.js.test.cjs @@ -0,0 +1,176 @@ +/* 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/publish.js TAP private workspaces colorless > should output all publishes 1`] = ` +Array [ + "+ @npmcli/b@1.0.0", +] +` + +exports[`test/lib/commands/publish.js TAP private workspaces colorless > should publish all non-private workspaces 1`] = ` +Array [ + Object { + "_id": "@npmcli/b@1.0.0", + "name": "@npmcli/b", + "readme": "ERROR: No README data found!", + "version": "1.0.0", + }, +] +` + +exports[`test/lib/commands/publish.js TAP private workspaces with color > should output all publishes 1`] = ` +Array [ + "+ @npmcli/b@1.0.0", +] +` + +exports[`test/lib/commands/publish.js TAP private workspaces with color > should publish all non-private workspaces 1`] = ` +Array [ + Object { + "_id": "@npmcli/b@1.0.0", + "name": "@npmcli/b", + "readme": "ERROR: No README data found!", + "version": "1.0.0", + }, +] +` + +exports[`test/lib/commands/publish.js TAP shows usage with wrong set of arguments > should print usage 1`] = ` +Error: +Usage: npm publish + +Publish a package + +Usage: +npm publish [<folder>] + +Options: +[--tag <tag>] [--access <restricted|public>] [--dry-run] [--otp <otp>] +[-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]] +[-ws|--workspaces] [--include-workspace-root] + +Run "npm help publish" for more info { + "code": "EUSAGE", +} +` + +exports[`test/lib/commands/publish.js TAP workspaces all workspaces > should output all publishes 1`] = ` +Array [ + "+ workspace-a@1.2.3-a", + "+ workspace-b@1.2.3-n", + "+ workspace-n@1.2.3-n", +] +` + +exports[`test/lib/commands/publish.js TAP workspaces all workspaces > should publish all workspaces 1`] = ` +Array [ + Object { + "_id": "workspace-a@1.2.3-a", + "name": "workspace-a", + "readme": "ERROR: No README data found!", + "repository": Object { + "type": "git", + "url": "http://repo.workspace-a/", + }, + "version": "1.2.3-a", + }, + Object { + "_id": "workspace-b@1.2.3-n", + "bugs": Object { + "url": "https://github.com/npm/workspace-b/issues", + }, + "homepage": "https://github.com/npm/workspace-b#readme", + "name": "workspace-b", + "readme": "ERROR: No README data found!", + "repository": Object { + "type": "git", + "url": "git+https://github.com/npm/workspace-b.git", + }, + "version": "1.2.3-n", + }, + Object { + "_id": "workspace-n@1.2.3-n", + "name": "workspace-n", + "readme": "ERROR: No README data found!", + "version": "1.2.3-n", + }, +] +` + +exports[`test/lib/commands/publish.js TAP workspaces json > should output all publishes as json 1`] = ` +Array [ + String( + { + "workspace-a": { + "id": "workspace-a@1.2.3-a" + }, + "workspace-b": { + "id": "workspace-b@1.2.3-n" + }, + "workspace-n": { + "id": "workspace-n@1.2.3-n" + } + } + ), +] +` + +exports[`test/lib/commands/publish.js TAP workspaces json > should publish all workspaces 1`] = ` +Array [ + Object { + "_id": "workspace-a@1.2.3-a", + "name": "workspace-a", + "readme": "ERROR: No README data found!", + "repository": Object { + "type": "git", + "url": "http://repo.workspace-a/", + }, + "version": "1.2.3-a", + }, + Object { + "_id": "workspace-b@1.2.3-n", + "bugs": Object { + "url": "https://github.com/npm/workspace-b/issues", + }, + "homepage": "https://github.com/npm/workspace-b#readme", + "name": "workspace-b", + "readme": "ERROR: No README data found!", + "repository": Object { + "type": "git", + "url": "git+https://github.com/npm/workspace-b.git", + }, + "version": "1.2.3-n", + }, + Object { + "_id": "workspace-n@1.2.3-n", + "name": "workspace-n", + "readme": "ERROR: No README data found!", + "version": "1.2.3-n", + }, +] +` + +exports[`test/lib/commands/publish.js TAP workspaces one workspace > should output one publish 1`] = ` +Array [ + "+ workspace-a@1.2.3-a", +] +` + +exports[`test/lib/commands/publish.js TAP workspaces one workspace > should publish given workspace 1`] = ` +Array [ + Object { + "_id": "workspace-a@1.2.3-a", + "name": "workspace-a", + "readme": "ERROR: No README data found!", + "repository": Object { + "type": "git", + "url": "http://repo.workspace-a/", + }, + "version": "1.2.3-a", + }, +] +` diff --git a/tap-snapshots/test/lib/commands/search.js.test.cjs b/tap-snapshots/test/lib/commands/search.js.test.cjs new file mode 100644 index 000000000..139fca259 --- /dev/null +++ b/tap-snapshots/test/lib/commands/search.js.test.cjs @@ -0,0 +1,20 @@ +/* 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/search.js TAP empty search results > should have expected search results 1`] = ` +No matches found for "foo" +` + +exports[`test/lib/commands/search.js TAP search <name> --searchexclude --searchopts > should have filtered expected search results 1`] = ` +NAME | AUTHOR | DATE | VERSION | KEYWORDS +foo | =foo | prehistoric | 1.0.0 | +` + +exports[`test/lib/commands/search.js TAP search <name> > should have expected search results 1`] = ` +NAME | AUTHOR | DATE | VERSION | KEYWORDS +libnpm | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager liblibnpmaccess | =nlf… | 2020-11-03 | 4.0.1 | @evocateur/libnpmaccess | =evocateur | 2019-07-16 | 3.1.2 | @evocateur/libnpmpublish | =evocateur | 2019-07-16 | 1.2.2 | libnpmorg | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teamslibnpmsearch | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpmlibnpmteam | =nlf… | 2020-11-03 | 2.0.2 | libnpmhook | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm apilibnpmpublish | =nlf… | 2020-11-03 | 4.0.0 | libnpmfund | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund@npmcli/map-workspaces | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli libnpm cli workspaces map-workspaceslibnpmversion | =nlf… | 2020-11-04 | 1.0.7 | @types/libnpmsearch | =types | 2019-09-26 | 2.0.1 | +` diff --git a/tap-snapshots/test/lib/commands/stars.js.test.cjs b/tap-snapshots/test/lib/commands/stars.js.test.cjs new file mode 100644 index 000000000..fbf074f71 --- /dev/null +++ b/tap-snapshots/test/lib/commands/stars.js.test.cjs @@ -0,0 +1,15 @@ +/* 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/stars.js TAP no args > should output a list of starred packages 1`] = ` + +@npmcli/arborist +@npmcli/map-workspaces +libnpmfund +libnpmpublish +ipt +` diff --git a/tap-snapshots/test/lib/commands/team.js.test.cjs b/tap-snapshots/test/lib/commands/team.js.test.cjs new file mode 100644 index 000000000..6a93234f5 --- /dev/null +++ b/tap-snapshots/test/lib/commands/team.js.test.cjs @@ -0,0 +1,85 @@ +/* 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/team.js TAP team add <scope:team> <user> --parseable > should output success result for parseable add user 1`] = ` +foo npmcli:developers added +` + +exports[`test/lib/commands/team.js TAP team add <scope:team> <user> default output > should output success result for add user 1`] = ` +foo added to @npmcli:developers +` + +exports[`test/lib/commands/team.js TAP team create <scope:team> --parseable > should output parseable success result for create team 1`] = ` +npmcli:newteam created +` + +exports[`test/lib/commands/team.js TAP team create <scope:team> default output > should output success result for create team 1`] = ` ++@npmcli:newteam +` + +exports[`test/lib/commands/team.js TAP team destroy <scope:team> --parseable > should output parseable result for destroy team 1`] = ` +npmcli:newteam deleted +` + +exports[`test/lib/commands/team.js TAP team destroy <scope:team> default output > should output success result for destroy team 1`] = ` +-@npmcli:newteam +` + +exports[`test/lib/commands/team.js TAP team ls <scope:team> --parseable > should list users for a parseable scope:team 1`] = ` +darcyclarke +isaacs +nlf +ruyadorno +` + +exports[`test/lib/commands/team.js TAP team ls <scope:team> default output > should list users for a given scope:team 1`] = ` + +@npmcli:developers has 4 users: +darcyclarke isaacs nlf ruyadorno +` + +exports[`test/lib/commands/team.js TAP team ls <scope:team> no users > should list no users for a given scope 1`] = ` + +@npmcli:developers has 0 users +` + +exports[`test/lib/commands/team.js TAP team ls <scope:team> single user > should list single user for a given scope 1`] = ` + +@npmcli:developers has 1 user: +foo +` + +exports[`test/lib/commands/team.js TAP team ls <scope> --parseable > should list teams for a parseable scope 1`] = ` +npmcli:designers +npmcli:developers +npmcli:product +` + +exports[`test/lib/commands/team.js TAP team ls <scope> default output > should list teams for a given scope 1`] = ` + +@npmcli has 3 teams: +@npmcli:designers @npmcli:developers @npmcli:product +` + +exports[`test/lib/commands/team.js TAP team ls <scope> no teams > should list no teams for a given scope 1`] = ` + +@npmcli has 0 teams +` + +exports[`test/lib/commands/team.js TAP team ls <scope> single team > should list single team for a given scope 1`] = ` + +@npmcli has 1 team: +@npmcli:developers +` + +exports[`test/lib/commands/team.js TAP team rm <scope:team> <user> --parseable > should output parseable result for remove user 1`] = ` +foo npmcli:newteam removed +` + +exports[`test/lib/commands/team.js TAP team rm <scope:team> <user> default output > should output success result for remove user 1`] = ` +foo removed from @npmcli:newteam +` diff --git a/tap-snapshots/test/lib/commands/unpublish.js.test.cjs b/tap-snapshots/test/lib/commands/unpublish.js.test.cjs new file mode 100644 index 000000000..d84f26f29 --- /dev/null +++ b/tap-snapshots/test/lib/commands/unpublish.js.test.cjs @@ -0,0 +1,14 @@ +/* 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/unpublish.js TAP workspaces all workspaces --force > should output all workspaces 1`] = ` +- workspace-a- workspace-b- workspace-n +` + +exports[`test/lib/commands/unpublish.js TAP workspaces one workspace --force > should output one workspaces 1`] = ` +- workspace-a +` diff --git a/tap-snapshots/test/lib/commands/view.js.test.cjs b/tap-snapshots/test/lib/commands/view.js.test.cjs new file mode 100644 index 000000000..10d38cb3f --- /dev/null +++ b/tap-snapshots/test/lib/commands/view.js.test.cjs @@ -0,0 +1,593 @@ +/* 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/view.js TAP should log info by field name array field - 1 element > must match snapshot 1`] = ` + +claudia +` + +exports[`test/lib/commands/view.js TAP should log info by field name array field - 2 elements > must match snapshot 1`] = ` + +maintainers[0].name = 'claudia' +maintainers[1].name = 'isaacs' +` + +exports[`test/lib/commands/view.js TAP should log info by field name maintainers with email > must match snapshot 1`] = ` + +{ + "maintainers": [ + { + "name": "claudia", + "email": "c@yellow.com", + "twitter": "cyellow" + }, + { + "name": "isaacs", + "email": "i@yellow.com", + "twitter": "iyellow" + } + ], + "name": "yellow" +} +` + +exports[`test/lib/commands/view.js TAP should log info by field name maintainers with url > must match snapshot 1`] = ` + +[ + "claudia (http://c.pink.com)", + "isaacs (http://i.pink.com)" +] +` + +exports[`test/lib/commands/view.js TAP should log info by field name nested field with brackets > must match snapshot 1`] = ` + +"123" +` + +exports[`test/lib/commands/view.js TAP should log info by field name readme > must match snapshot 1`] = ` + +a very useful readme +` + +exports[`test/lib/commands/view.js TAP should log info by field name several fields > must match snapshot 1`] = ` + +{ + "name": "yellow", + "version": "1.0.0" +} +` + +exports[`test/lib/commands/view.js TAP should log info by field name several fields with several versions > must match snapshot 1`] = ` + +yellow@1.0.0 'claudia' +yellow@1.0.1 'claudia' +yellow@1.0.2 'claudia' +` + +exports[`test/lib/commands/view.js TAP should log info of package in current working dir non-specific version > must match snapshot 1`] = ` + + +[4m[1m[32mblue[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m + +dist +.tarball:[36mhttp://hm.blue.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 + +published [33myesterday[39m +` + +exports[`test/lib/commands/view.js TAP should log info of package in current working dir specific version > must match snapshot 1`] = ` + + +[4m[1m[32mblue[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m + +dist +.tarball:[36mhttp://hm.blue.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 + +published [33myesterday[39m +` + +exports[`test/lib/commands/view.js TAP should log package info package from git > must match snapshot 1`] = ` + + +[4m[1m[32mgreen[39m@[32m1.0.0[39m[22m[24m | [32mACME[39m | deps: [36m2[39m | versions: [33m2[39m +green is a very important color + +[1m[31mDEPRECATED[39m[22m!! - true + +keywords:[33mcolors[39m, [33mgreen[39m, [33mcrayola[39m + +bin:[33mgreen[39m + +dist +.tarball:[36mhttp://hm.green.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dependencies: +[33mred[39m: 1.0.0 +[33myellow[39m: 1.0.0 + +maintainers: +-[33mclaudia[39m <[36mc@yellow.com[39m> +-[33misaacs[39m <[36mi@yellow.com[39m> + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 +` + +exports[`test/lib/commands/view.js TAP should log package info package with --json and semver range > must match snapshot 1`] = ` + +[ + { + "_npmUser": "claudia <claudia@cyan.com>", + "name": "cyan", + "dist-tags": { + "latest": "1.0.0" + }, + "versions": [ + "1.0.0", + "1.0.1" + ], + "version": "1.0.0", + "dist": { + "shasum": "123", + "tarball": "http://hm.cyan.com/1.0.0.tgz", + "integrity": "---", + "fileCount": 1, + "unpackedSize": 1 + } + }, + { + "_npmUser": "claudia <claudia@cyan.com>", + "name": "cyan", + "dist-tags": { + "latest": "1.0.0" + }, + "versions": [ + "1.0.0", + "1.0.1" + ] + } +] +` + +exports[`test/lib/commands/view.js TAP should log package info package with homepage > must match snapshot 1`] = ` + + +[4m[1m[32morange[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m +[36mhttp://hm.orange.com[39m + +dist +.tarball:[36mhttp://hm.orange.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 +` + +exports[`test/lib/commands/view.js TAP should log package info package with license, bugs, repository and other fields > must match snapshot 1`] = ` + + +[4m[1m[32mgreen[39m@[32m1.0.0[39m[22m[24m | [32mACME[39m | deps: [36m2[39m | versions: [33m2[39m +green is a very important color + +[1m[31mDEPRECATED[39m[22m!! - true + +keywords:[33mcolors[39m, [33mgreen[39m, [33mcrayola[39m + +bin:[33mgreen[39m + +dist +.tarball:[36mhttp://hm.green.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dependencies: +[33mred[39m: 1.0.0 +[33myellow[39m: 1.0.0 + +maintainers: +-[33mclaudia[39m <[36mc@yellow.com[39m> +-[33misaacs[39m <[36mi@yellow.com[39m> + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 +` + +exports[`test/lib/commands/view.js TAP should log package info package with maintainers info as object > must match snapshot 1`] = ` + + +[4m[1m[32mpink[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m + +dist +.tarball:[36mhttp://hm.pink.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 +` + +exports[`test/lib/commands/view.js TAP should log package info package with more than 25 deps > must match snapshot 1`] = ` + + +[4m[1m[32mblack[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [36m25[39m | versions: [33m2[39m + +dist +.tarball:[36mhttp://hm.black.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dependencies: +[33m0[39m: 1.0.0 +[33m10[39m: 1.0.0 +[33m11[39m: 1.0.0 +[33m12[39m: 1.0.0 +[33m13[39m: 1.0.0 +[33m14[39m: 1.0.0 +[33m15[39m: 1.0.0 +[33m16[39m: 1.0.0 +[33m17[39m: 1.0.0 +[33m18[39m: 1.0.0 +[33m19[39m: 1.0.0 +[33m1[39m: 1.0.0 +[33m20[39m: 1.0.0 +[33m21[39m: 1.0.0 +[33m22[39m: 1.0.0 +[33m23[39m: 1.0.0 +[33m2[39m: 1.0.0 +[33m3[39m: 1.0.0 +[33m4[39m: 1.0.0 +[33m5[39m: 1.0.0 +[33m6[39m: 1.0.0 +[33m7[39m: 1.0.0 +[33m8[39m: 1.0.0 +[33m9[39m: 1.0.0 +(...and 1 more.) + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 +` + +exports[`test/lib/commands/view.js TAP should log package info package with no modified time > must match snapshot 1`] = ` + + +[4m[1m[32mcyan[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m + +dist +.tarball:[36mhttp://hm.cyan.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 + +published by [33mclaudia[39m <[36mclaudia@cyan.com[39m> +` + +exports[`test/lib/commands/view.js TAP should log package info package with no repo or homepage > must match snapshot 1`] = ` + + +[4m[1m[32mblue[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m + +dist +.tarball:[36mhttp://hm.blue.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 + +published [33myesterday[39m +` + +exports[`test/lib/commands/view.js TAP should log package info package with semver range > must match snapshot 1`] = ` + + +[4m[1m[32mblue[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m + +dist +.tarball:[36mhttp://hm.blue.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 + +published [33myesterday[39m + +[4m[1m[32mblue[39m@[32m1.0.1[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m + +dist +.tarball:[36mhttp://hm.blue.com/1.0.1.tgz[39m +.shasum:[33m124[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 + +published [33mover a year from now[39m +` + +exports[`test/lib/commands/view.js TAP workspaces all workspaces --json > must match snapshot 1`] = ` + +{ + "green": { + "_id": "green", + "name": "green", + "dist-tags": { + "latest": "1.0.0" + }, + "maintainers": [ + { + "name": "claudia", + "email": "c@yellow.com", + "twitter": "cyellow" + }, + { + "name": "isaacs", + "email": "i@yellow.com", + "twitter": "iyellow" + } + ], + "keywords": [ + "colors", + "green", + "crayola" + ], + "versions": [ + "1.0.0", + "1.0.1" + ], + "version": "1.0.0", + "description": "green is a very important color", + "bugs": { + "url": "http://bugs.green.com" + }, + "deprecated": true, + "repository": { + "url": "http://repository.green.com" + }, + "license": { + "type": "ACME" + }, + "bin": { + "green": "bin/green.js" + }, + "dependencies": { + "red": "1.0.0", + "yellow": "1.0.0" + }, + "dist": { + "shasum": "123", + "tarball": "http://hm.green.com/1.0.0.tgz", + "integrity": "---", + "fileCount": 1, + "unpackedSize": 1 + } + }, + "orange": { + "name": "orange", + "dist-tags": { + "latest": "1.0.0" + }, + "versions": [ + "1.0.0", + "1.0.1" + ], + "version": "1.0.0", + "homepage": "http://hm.orange.com", + "license": {}, + "dist": { + "shasum": "123", + "tarball": "http://hm.orange.com/1.0.0.tgz", + "integrity": "---", + "fileCount": 1, + "unpackedSize": 1 + } + } +} +` + +exports[`test/lib/commands/view.js TAP workspaces all workspaces > must match snapshot 1`] = ` + + +[4m[1m[32mgreen[39m@[32m1.0.0[39m[22m[24m | [32mACME[39m | deps: [36m2[39m | versions: [33m2[39m +green is a very important color + +[1m[31mDEPRECATED[39m[22m!! - true + +keywords:[33mcolors[39m, [33mgreen[39m, [33mcrayola[39m + +bin:[33mgreen[39m + +dist +.tarball:[36mhttp://hm.green.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dependencies: +[33mred[39m: 1.0.0 +[33myellow[39m: 1.0.0 + +maintainers: +-[33mclaudia[39m <[36mc@yellow.com[39m> +-[33misaacs[39m <[36mi@yellow.com[39m> + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 + +[4m[1m[32morange[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m +[36mhttp://hm.orange.com[39m + +dist +.tarball:[36mhttp://hm.orange.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 +` + +exports[`test/lib/commands/view.js TAP workspaces all workspaces nonexistent field --json > must match snapshot 1`] = ` + +` + +exports[`test/lib/commands/view.js TAP workspaces all workspaces nonexistent field > must match snapshot 1`] = ` + +green: +orange: +` + +exports[`test/lib/commands/view.js TAP workspaces all workspaces single field --json > must match snapshot 1`] = ` + +{ + "green": "green", + "orange": "orange" +} +` + +exports[`test/lib/commands/view.js TAP workspaces all workspaces single field > must match snapshot 1`] = ` + +green: +green +orange: +orange +` + +exports[`test/lib/commands/view.js TAP workspaces one specific workspace > must match snapshot 1`] = ` + + +[4m[1m[32mgreen[39m@[32m1.0.0[39m[22m[24m | [32mACME[39m | deps: [36m2[39m | versions: [33m2[39m +green is a very important color + +[1m[31mDEPRECATED[39m[22m!! - true + +keywords:[33mcolors[39m, [33mgreen[39m, [33mcrayola[39m + +bin:[33mgreen[39m + +dist +.tarball:[36mhttp://hm.green.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dependencies: +[33mred[39m: 1.0.0 +[33myellow[39m: 1.0.0 + +maintainers: +-[33mclaudia[39m <[36mc@yellow.com[39m> +-[33misaacs[39m <[36mi@yellow.com[39m> + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 +` + +exports[`test/lib/commands/view.js TAP workspaces remote package name > must match snapshot 1`] = ` +Ignoring workspaces for specified package(s) +` + +exports[`test/lib/commands/view.js TAP workspaces remote package name > must match snapshot 2`] = ` + + +[4m[1m[32mpink[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m + +dist +.tarball:[36mhttp://hm.pink.com/1.0.0.tgz[39m +.shasum:[33m123[39m +.integrity:[33m---[39m +.unpackedSize:[33m1 B[39m + +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 +` + +exports[`test/lib/commands/view.js TAP workspaces single workspace --json > must match snapshot 1`] = ` + +{ + "green": { + "_id": "green", + "name": "green", + "dist-tags": { + "latest": "1.0.0" + }, + "maintainers": [ + { + "name": "claudia", + "email": "c@yellow.com", + "twitter": "cyellow" + }, + { + "name": "isaacs", + "email": "i@yellow.com", + "twitter": "iyellow" + } + ], + "keywords": [ + "colors", + "green", + "crayola" + ], + "versions": [ + "1.0.0", + "1.0.1" + ], + "version": "1.0.0", + "description": "green is a very important color", + "bugs": { + "url": "http://bugs.green.com" + }, + "deprecated": true, + "repository": { + "url": "http://repository.green.com" + }, + "license": { + "type": "ACME" + }, + "bin": { + "green": "bin/green.js" + }, + "dependencies": { + "red": "1.0.0", + "yellow": "1.0.0" + }, + "dist": { + "shasum": "123", + "tarball": "http://hm.green.com/1.0.0.tgz", + "integrity": "---", + "fileCount": 1, + "unpackedSize": 1 + } + } +} +` |