From 1f3e88ebaf4901d8f9f07b43404d824fef7e5ff5 Mon Sep 17 00:00:00 2001 From: nlf Date: Tue, 6 Apr 2021 07:33:52 -0700 Subject: feat(workspaces): implement workspace support for dist-tag PR-URL: https://github.com/npm/cli/pull/3032 Credit: @nlf Close: #3032 Reviewed-by: @wraithgar --- tap-snapshots/test-lib-dist-tag.js-TAP.test.js | 112 +++++++++++++++++++++ .../test-lib-utils-npm-usage.js-TAP.test.js | 3 + 2 files changed, 115 insertions(+) (limited to 'tap-snapshots') diff --git a/tap-snapshots/test-lib-dist-tag.js-TAP.test.js b/tap-snapshots/test-lib-dist-tag.js-TAP.test.js index 06936795b..ea25b568b 100644 --- a/tap-snapshots/test-lib-dist-tag.js-TAP.test.js +++ b/tap-snapshots/test-lib-dist-tag.js-TAP.test.js @@ -15,6 +15,9 @@ npm dist-tag add @ [] npm dist-tag rm npm dist-tag ls [] +Options: +[-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] + alias: dist-tags Run "npm help dist-tag" for more info @@ -30,6 +33,9 @@ npm dist-tag add @ [] npm dist-tag rm npm dist-tag ls [] +Options: +[-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] + alias: dist-tags Run "npm help dist-tag" for more info @@ -54,6 +60,9 @@ npm dist-tag add @ [] npm dist-tag rm npm dist-tag ls [] +Options: +[-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] + alias: dist-tags Run "npm help dist-tag" for more info @@ -75,6 +84,9 @@ npm dist-tag add @ [] npm dist-tag rm npm dist-tag ls [] +Options: +[-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] + alias: dist-tags Run "npm help dist-tag" for more info @@ -126,6 +138,9 @@ npm dist-tag add @ [] npm dist-tag rm npm dist-tag ls [] +Options: +[-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] + alias: dist-tags Run "npm help dist-tag" for more info @@ -142,3 +157,100 @@ 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/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/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/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/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/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/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/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/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/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-utils-npm-usage.js-TAP.test.js b/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js index 45863cdf4..19beaaa85 100644 --- a/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js +++ b/tap-snapshots/test-lib-utils-npm-usage.js-TAP.test.js @@ -323,6 +323,9 @@ All commands: npm dist-tag rm npm dist-tag ls [] + Options: + [-w|--workspace [-w|--workspace ...]] [-ws|--workspaces] + alias: dist-tags Run "npm help dist-tag" for more info -- cgit v1.2.3