diff options
author | Gar <gar+gh@danger.computer> | 2021-05-27 01:39:59 +0300 |
---|---|---|
committer | Ruy Adorno <ruyadorno@hotmail.com> | 2021-06-01 01:21:04 +0300 |
commit | cf82ea7c0aca1a516c1315c04ea0931b743fe94f (patch) | |
tree | 741b79652a43e82d1ba6df80809d0e688cfe6ca4 /tap-snapshots/test/lib/dist-tag.js.test.cjs | |
parent | 598a17a2671c9e3bc204dddd6488169c9a72c6a1 (diff) |
fix: refactor get package name
renames read-local-package to read-package-name
The global check needed to be moved outside this function, because it
was handled differently (and will be even moreso when we implement diff
workspaces) in each function. This allowed us to now pass in the prefix
itself instead of the npm object, so we can reuse this function to look
up package names when we refactor npm diff for workspaces.
PR-URL: https://github.com/npm/cli/pull/3331
Credit: @wraithgar
Close: #3331
Reviewed-by: @ruyadorno
Diffstat (limited to 'tap-snapshots/test/lib/dist-tag.js.test.cjs')
-rw-r--r-- | tap-snapshots/test/lib/dist-tag.js.test.cjs | 57 |
1 files changed, 47 insertions, 10 deletions
diff --git a/tap-snapshots/test/lib/dist-tag.js.test.cjs b/tap-snapshots/test/lib/dist-tag.js.test.cjs index 86a9c84eb..21d9331db 100644 --- a/tap-snapshots/test/lib/dist-tag.js.test.cjs +++ b/tap-snapshots/test/lib/dist-tag.js.test.cjs @@ -6,7 +6,8 @@ */ 'use strict' exports[`test/lib/dist-tag.js TAP add missing args > should exit usage error message 1`] = ` -npm dist-tag +Error: +Usage: npm dist-tag Modify package distribution tags @@ -21,11 +22,14 @@ Options: alias: dist-tags -Run "npm help dist-tag" for more info +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} ` exports[`test/lib/dist-tag.js TAP add missing pkg name > should exit usage error message 1`] = ` -npm dist-tag +Error: +Usage: npm dist-tag Modify package distribution tags @@ -40,7 +44,9 @@ Options: alias: dist-tags -Run "npm help dist-tag" for more info +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} ` exports[`test/lib/dist-tag.js TAP add new tag > should return success msg 1`] = ` @@ -53,7 +59,8 @@ dist-tag add 1.0.0 to @scoped/another@7.7.7 ` exports[`test/lib/dist-tag.js TAP borked cmd usage > should show usage error 1`] = ` -npm dist-tag +Error: +Usage: npm dist-tag Modify package distribution tags @@ -68,7 +75,31 @@ Options: alias: dist-tags -Run "npm help dist-tag" for more info +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} +` + +exports[`test/lib/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] + +alias: dist-tags + +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} ` exports[`test/lib/dist-tag.js TAP ls in current package > should list available tags for current package 1`] = ` @@ -78,7 +109,8 @@ latest: 1.0.0 ` exports[`test/lib/dist-tag.js TAP ls on missing name in current package > should throw usage error message 1`] = ` -npm dist-tag +Error: +Usage: npm dist-tag Modify package distribution tags @@ -93,7 +125,9 @@ Options: alias: dist-tags -Run "npm help dist-tag" for more info +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} ` exports[`test/lib/dist-tag.js TAP ls on missing package > should log no dist-tag found msg 1`] = ` @@ -133,7 +167,8 @@ exports[`test/lib/dist-tag.js TAP remove existing tag > should return success ms ` exports[`test/lib/dist-tag.js TAP remove missing pkg name > should exit usage error message 1`] = ` -npm dist-tag +Error: +Usage: npm dist-tag Modify package distribution tags @@ -148,7 +183,9 @@ Options: alias: dist-tags -Run "npm help dist-tag" for more info +Run "npm help dist-tag" for more info { + "code": "EUSAGE", +} ` exports[`test/lib/dist-tag.js TAP remove non-existing tag > should log error msg 1`] = ` |