From 32717a60eb55fcf8c7e5016223bfee78a6daba0e Mon Sep 17 00:00:00 2001 From: Gar Date: Tue, 30 Mar 2021 15:37:48 -0700 Subject: feat(view): add workspace support PR-URL: https://github.com/npm/cli/pull/3001 Credit: @wraithgar Close: #3001 Reviewed-by: @nlf --- .../test-lib-utils-npm-usage.js-TAP.test.js | 3 + tap-snapshots/test-lib-view.js-TAP.test.js | 257 +++++++++++++++++++++ 2 files changed, 260 insertions(+) (limited to 'tap-snapshots') 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 4f9c1b44e..66d274057 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 @@ -920,6 +920,9 @@ All commands: Usage: npm view [<@scope>/][@] [[.subfield]...] + Options: + [--json] [-w|--workspace |-w|--workspace ] [-ws|--workspaces] + aliases: v, info, show Run "npm help view" for more info diff --git a/tap-snapshots/test-lib-view.js-TAP.test.js b/tap-snapshots/test-lib-view.js-TAP.test.js index f8a9fe464..02810e31a 100644 --- a/tap-snapshots/test-lib-view.js-TAP.test.js +++ b/tap-snapshots/test-lib-view.js-TAP.test.js @@ -270,3 +270,260 @@ dist-tags: published a year ago ` + +exports[`test/lib/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/view.js TAP workspaces all workspaces > must match snapshot 1`] = ` + + +green@1.0.0 | ACME | deps: 2 | versions: 2 +green is a very important color + +DEPRECATED!! - true + +keywords:colors, green, crayola + +bin:green + +dist +.tarball:http://hm.green.com/1.0.0.tgz +.shasum:123 +.integrity:--- +.unpackedSize:1 B + +dependencies: +red: 1.0.0 +yellow: 1.0.0 + +maintainers: +-claudia <c@yellow.com> +-isaacs <i@yellow.com> + +dist-tags: +latest: 1.0.0 + +orange@1.0.0 | Proprietary | deps: none | versions: 2 +http://hm.orange.com + +dist +.tarball:http://hm.orange.com/1.0.0.tgz +.shasum:123 +.integrity:--- +.unpackedSize:1 B + +dist-tags: +latest: 1.0.0 +` + +exports[`test/lib/view.js TAP workspaces all workspaces nonexistent field --json > must match snapshot 1`] = ` + +` + +exports[`test/lib/view.js TAP workspaces all workspaces nonexistent field > must match snapshot 1`] = ` + +green: +orange: +` + +exports[`test/lib/view.js TAP workspaces all workspaces single field --json > must match snapshot 1`] = ` + +{ + "green": "green", + "orange": "orange" +} +` + +exports[`test/lib/view.js TAP workspaces all workspaces single field > must match snapshot 1`] = ` + +green: +green +orange: +orange +` + +exports[`test/lib/view.js TAP workspaces one specific workspace > must match snapshot 1`] = ` + + +green@1.0.0 | ACME | deps: 2 | versions: 2 +green is a very important color + +DEPRECATED!! - true + +keywords:colors, green, crayola + +bin:green + +dist +.tarball:http://hm.green.com/1.0.0.tgz +.shasum:123 +.integrity:--- +.unpackedSize:1 B + +dependencies: +red: 1.0.0 +yellow: 1.0.0 + +maintainers: +-claudia <c@yellow.com> +-isaacs <i@yellow.com> + +dist-tags: +latest: 1.0.0 +` + +exports[`test/lib/view.js TAP workspaces remote package name > must match snapshot 1`] = ` +Ignoring workspaces for remote package +` + +exports[`test/lib/view.js TAP workspaces remote package name > must match snapshot 2`] = ` + + +pink@1.0.0 | Proprietary | deps: none | versions: 2 + +dist +.tarball:http://hm.pink.com/1.0.0.tgz +.shasum:123 +.integrity:--- +.unpackedSize:1 B + +dist-tags: +latest: 1.0.0 +` + +exports[`test/lib/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 + } + } +} +` -- cgit v1.2.3