diff --git a/lib/cli-entry.js b/lib/cli-entry.js index aad06e0690385..dd8e18add7ebc 100644 --- a/lib/cli-entry.js +++ b/lib/cli-entry.js @@ -18,7 +18,7 @@ module.exports = async (process, validateEngines) => { exitHandler.setNpm(npm) // only log node and npm paths in argv initially since argv can contain sensitive info. a cleaned version will be logged later - const log = require('./utils/log-shim.js') + const log = require('proc-log') log.verbose('cli', process.argv.slice(0, 2).join(' ')) log.info('using', 'npm@%s', npm.version) log.info('using', 'node@%s', process.version) diff --git a/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs b/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs index bf873277e31a2..854f93ff1e5f2 100644 --- a/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs +++ b/tap-snapshots/test/lib/commands/dist-tag.js.test.cjs @@ -10,7 +10,7 @@ exports[`test/lib/commands/dist-tag.js TAP add new tag > should return success m ` exports[`test/lib/commands/dist-tag.js TAP add using valid semver range as name > should return success msg 1`] = ` -add 1.0.0 to @scoped/another@7.7.7 +dist-tag add 1.0.0 to @scoped/another@7.7.7 ` exports[`test/lib/commands/dist-tag.js TAP ls in current package > should list available tags for current package 1`] = ` @@ -20,22 +20,22 @@ latest: 1.0.0 ` exports[`test/lib/commands/dist-tag.js TAP ls on missing package > should log no dist-tag found msg 1`] = ` -ls Couldn't get dist-tag data for Result { -ls type: 'range', -ls registry: true, -ls where: undefined, -ls raw: 'foo', -ls name: 'foo', -ls escapedName: 'foo', -ls scope: undefined, -ls rawSpec: '*', -ls saveSpec: null, -ls fetchSpec: '*', -ls gitRange: undefined, -ls gitCommittish: undefined, -ls gitSubdir: undefined, -ls hosted: undefined -ls } +dist-tag ls Couldn't get dist-tag data for Result { +dist-tag ls type: 'range', +dist-tag ls registry: true, +dist-tag ls where: undefined, +dist-tag ls raw: 'foo', +dist-tag ls name: 'foo', +dist-tag ls escapedName: 'foo', +dist-tag ls scope: undefined, +dist-tag ls rawSpec: '*', +dist-tag ls saveSpec: null, +dist-tag ls fetchSpec: '*', +dist-tag ls gitRange: undefined, +dist-tag ls gitCommittish: undefined, +dist-tag ls gitSubdir: undefined, +dist-tag ls hosted: undefined +dist-tag ls } ` exports[`test/lib/commands/dist-tag.js TAP ls on named package > should list tags for the specified package 1`] = ` @@ -57,7 +57,7 @@ latest: 2.0.0 ` exports[`test/lib/commands/dist-tag.js TAP remove existing tag > should log remove info 1`] = ` -del c from @scoped/another +dist-tag del c from @scoped/another ` exports[`test/lib/commands/dist-tag.js TAP remove existing tag > should return success msg 1`] = ` @@ -65,13 +65,13 @@ exports[`test/lib/commands/dist-tag.js TAP remove existing tag > should return s ` exports[`test/lib/commands/dist-tag.js TAP remove non-existing tag > should log error msg 1`] = ` -del nonexistent from @scoped/another -del nonexistent is not a dist-tag on @scoped/another +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`] = ` -add b to @scoped/another@0.6.0 -add b is already set to version 0.6.0 +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`] = ` diff --git a/tap-snapshots/test/lib/commands/doctor.js.test.cjs b/tap-snapshots/test/lib/commands/doctor.js.test.cjs index 69da946ec7f50..7157e5311ac26 100644 --- a/tap-snapshots/test/lib/commands/doctor.js.test.cjs +++ b/tap-snapshots/test/lib/commands/doctor.js.test.cjs @@ -31,33 +31,33 @@ Object { exports[`test/lib/commands/doctor.js TAP all clear > output 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` exports[`test/lib/commands/doctor.js TAP all clear in color > everything is ok in color 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -101,27 +101,27 @@ node -v not ok Error: Invalid protocol \`ssh:\` con npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` exports[`test/lib/commands/doctor.js TAP cacache badContent > corrupted cache content 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 2 tarballs ` @@ -181,33 +181,33 @@ Object { exports[`test/lib/commands/doctor.js TAP cacache missingContent > missing content 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 2 tarballs ` exports[`test/lib/commands/doctor.js TAP cacache reclaimedCount > content garbage collected 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 2 tarballs ` @@ -259,7 +259,7 @@ Object { exports[`test/lib/commands/doctor.js TAP discrete checks cache > output 1`] = ` Check Value Recommendation/Notes -Perms check on cached files ok +Perms check on cached files ok Verify cache contents ok verified 0 tarballs ` @@ -307,11 +307,11 @@ Object { exports[`test/lib/commands/doctor.js TAP discrete checks permissions - not windows > output 1`] = ` Check Value Recommendation/Notes -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok ` exports[`test/lib/commands/doctor.js TAP discrete checks permissions - windows > logs 1`] = ` @@ -341,7 +341,7 @@ Object { exports[`test/lib/commands/doctor.js TAP discrete checks ping > output 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok ` exports[`test/lib/commands/doctor.js TAP discrete checks registry > logs 1`] = ` @@ -357,7 +357,7 @@ Object { exports[`test/lib/commands/doctor.js TAP discrete checks registry > output 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm config get registry ok using default registry (https://registry.npmjs.org/) ` @@ -411,7 +411,7 @@ Object { exports[`test/lib/commands/doctor.js TAP error reading directory > readdir error 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) @@ -427,17 +427,17 @@ Verify cache contents ok verified 0 tarballs exports[`test/lib/commands/doctor.js TAP incorrect owner > incorrect owner 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin Perms check on cached files not ok Check the permissions of files in {CWD}/cache (should be owned by current user) -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -469,7 +469,7 @@ Object { exports[`test/lib/commands/doctor.js TAP incorrect permissions > incorrect owner 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) @@ -548,17 +548,17 @@ Object { exports[`test/lib/commands/doctor.js TAP missing git > missing git 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH not ok Error: Install git and ensure it's in your PATH. global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -591,16 +591,16 @@ Object { exports[`test/lib/commands/doctor.js TAP missing global directories > missing global directories 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok +Perms check on cached files ok +Perms check on local node_modules ok Perms check on global node_modules not ok Check the permissions of files in {CWD}/global/node_modules -Perms check on local bin folder ok +Perms check on local bin folder ok Perms check on global bin folder not ok Check the permissions of files in {CWD}/global/bin Verify cache contents ok verified 0 tarballs ` @@ -631,17 +631,17 @@ Object { exports[`test/lib/commands/doctor.js TAP missing local node_modules > missing local node_modules 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -671,17 +671,17 @@ Object { exports[`test/lib/commands/doctor.js TAP node out of date - current > node is out of date 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v not ok Use node v2.0.1 (current: v2.0.0) npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -711,17 +711,17 @@ Object { exports[`test/lib/commands/doctor.js TAP node out of date - lts > node is out of date 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v not ok Use node v1.0.0 (current: v0.0.1) npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -751,17 +751,17 @@ Object { exports[`test/lib/commands/doctor.js TAP non-default registry > non default registry 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry not ok Try \`npm config set registry=https://registry.npmjs.org/\` git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -791,17 +791,17 @@ Object { exports[`test/lib/commands/doctor.js TAP npm out of date > npm is out of date 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v not ok Use npm v2.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -837,11 +837,11 @@ node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -861,11 +861,11 @@ node -v ok current: v1.0.0, recommend npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -901,11 +901,11 @@ node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -941,11 +941,11 @@ node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) git executable in PATH ok /path/to/git global bin folder in PATH ok {CWD}/global/bin -Perms check on cached files ok -Perms check on local node_modules ok -Perms check on global node_modules ok -Perms check on local bin folder ok -Perms check on global bin folder ok +Perms check on cached files ok +Perms check on local node_modules ok +Perms check on global node_modules ok +Perms check on local bin folder ok +Perms check on global bin folder ok Verify cache contents ok verified 0 tarballs ` @@ -990,7 +990,7 @@ Object { exports[`test/lib/commands/doctor.js TAP windows skips permissions checks > no permissions checks 1`] = ` Check Value Recommendation/Notes -npm ping ok +npm ping ok npm -v ok current: v1.0.0, latest: v1.0.0 node -v ok current: v1.0.0, recommended: v1.0.0 npm config get registry ok using default registry (https://registry.npmjs.org/) diff --git a/tap-snapshots/test/lib/commands/pack.js.test.cjs b/tap-snapshots/test/lib/commands/pack.js.test.cjs index 154912c2f9eb5..d78bac7a1626e 100644 --- a/tap-snapshots/test/lib/commands/pack.js.test.cjs +++ b/tap-snapshots/test/lib/commands/pack.js.test.cjs @@ -19,7 +19,7 @@ Array [ unpacked size: 41 B shasum: {sha} integrity: {integrity} - total files: 1 + total files: 1 ), ] ` @@ -38,7 +38,7 @@ Array [ unpacked size: 110 B shasum: {sha} integrity: {integrity} - total files: 1 + total files: 1 ), ] ` @@ -57,7 +57,7 @@ Array [ unpacked size: 110 B shasum: {sha} integrity: {integrity} - total files: 1 + total files: 1 ), ] ` @@ -136,7 +136,7 @@ Array [ unpacked size: 41 B shasum: {sha} integrity: {integrity} - total files: 1 + total files: 1 ), ] ` diff --git a/tap-snapshots/test/lib/commands/publish.js.test.cjs b/tap-snapshots/test/lib/commands/publish.js.test.cjs index 78440123473f9..9fa510d92235d 100644 --- a/tap-snapshots/test/lib/commands/publish.js.test.cjs +++ b/tap-snapshots/test/lib/commands/publish.js.test.cjs @@ -27,7 +27,7 @@ Array [ unpacked size: 87 B shasum: {sha} integrity: {integrity} - total files: 1 + total files: 1 ), "Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run)", ] @@ -47,7 +47,7 @@ Array [ unpacked size: 110 B shasum: {sha} integrity: {integrity} - total files: 1 + total files: 1 ), "Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run)", ] @@ -67,7 +67,7 @@ Array [ unpacked size: 110 B shasum: {sha} integrity: {integrity} - total files: 1 + total files: 1 ), "Publishing to https://registry.npmjs.org/ with tag latest and default access (dry-run)", ] @@ -283,7 +283,7 @@ Array [ unpacked size: 55 B shasum: {sha} integrity: {integrity} - total files: 1 + total files: 1 ), "Publishing to https://registry.npmjs.org/ with tag latest and public access", ] @@ -315,7 +315,7 @@ Array [ unpacked size: 55 B shasum: {sha} integrity: {integrity} - total files: 1 + total files: 1 ), "Publishing to https://registry.npmjs.org/ with tag latest and restricted access", ] @@ -346,7 +346,7 @@ Array [ unpacked size: 124 B shasum: {sha} integrity: {integrity} - total files: 2 + total files: 2 ), "Publishing to https://registry.npmjs.org/ with tag latest and default access", ] diff --git a/tap-snapshots/test/lib/commands/search.js.test.cjs b/tap-snapshots/test/lib/commands/search.js.test.cjs index 7b41b23f68f8c..33d4a0533b93c 100644 --- a/tap-snapshots/test/lib/commands/search.js.test.cjs +++ b/tap-snapshots/test/lib/commands/search.js.test.cjs @@ -48,99 +48,99 @@ pkg-no-desc | | =lukekarrys | 2019-09-26 exports[`test/lib/commands/search.js TAP search --parseable > should have expected search results as parseable 1`] = ` libnpm Collection of programmatic APIs for the npm CLI =nlf =ruyadorno =darcyclarke =isaacs 2019-07-16 3.0.1 npm api package manager lib libnpmaccess programmatic library for \`npm access\` commands =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 4.0.1 libnpmaccess -@evocateur/libnpmaccess programmatic library for \`npm access\` commands =evocateur 2019-07-16 3.1.2 -@evocateur/libnpmpublish Programmatic API for the bits behind npm publish and unpublish =evocateur 2019-07-16 1.2.2 +@evocateur/libnpmaccess programmatic library for \`npm access\` commands =evocateur 2019-07-16 3.1.2 +@evocateur/libnpmpublish Programmatic API for the bits behind npm publish and unpublish =evocateur 2019-07-16 1.2.2 libnpmorg Programmatic api for \`npm org\` commands =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 2.0.1 libnpm npm package manager api orgs teams libnpmsearch Programmatic API for searching in npm and compatible registries. =nlf =ruyadorno =darcyclarke =isaacs 2020-12-08 3.1.0 npm search api libnpm -libnpmteam npm Team management APIs =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 2.0.2 +libnpmteam npm Team management APIs =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 2.0.2 libnpmhook programmatic API for managing npm registry hooks =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 6.0.1 npm hooks registry npm api -libnpmpublish Programmatic API for the bits behind npm publish and unpublish =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 4.0.0 +libnpmpublish Programmatic API for the bits behind npm publish and unpublish =nlf =ruyadorno =darcyclarke =isaacs 2020-11-03 4.0.0 libnpmfund Programmatic API for npm fund =nlf =ruyadorno =darcyclarke =isaacs 2020-12-08 1.0.2 npm npmcli libnpm cli git fund gitfund @npmcli/map-workspaces Retrieves a name:pathname Map for a given workspaces config =nlf =ruyadorno =darcyclarke =isaacs 2020-09-30 1.0.1 npm bad map npmcli libnpm cli workspaces map-workspaces -libnpmversion library to do the things that 'npm version' does =nlf =ruyadorno =darcyclarke =isaacs 2020-11-04 1.0.7 -@types/libnpmsearch TypeScript definitions for libnpmsearch =types 2019-09-26 2.0.1 -pkg-no-desc =lukekarrys 2019-09-26 1.0.0 +libnpmversion library to do the things that 'npm version' does =nlf =ruyadorno =darcyclarke =isaacs 2020-11-04 1.0.7 +@types/libnpmsearch TypeScript definitions for libnpmsearch =types 2019-09-26 2.0.1 +pkg-no-desc =lukekarrys 2019-09-26 1.0.0 ` exports[`test/lib/commands/search.js TAP search > should have filtered expected search results 1`] = ` NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS -foo | | =foo | prehistoric | 1.0.0 | -libnpmversion | | =foo | prehistoric | 1.0.0 | +foo | | =foo | prehistoric | 1.0.0 | +libnpmversion | | =foo | prehistoric | 1.0.0 | ` exports[`test/lib/commands/search.js TAP search text > should have expected search results 1`] = ` NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess -@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | -@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm -libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api -libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund @npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm bad map npmcli libnpm cli workspaces map-workspaces -libnpmversion | library to do the… | =nlf… | 2020-11-04 | 1.0.7 | -@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | -pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | +libnpmversion | library to do the… | =nlf… | 2020-11-04 | 1.0.7 | +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | ` exports[`test/lib/commands/search.js TAP search exclude forward slash > results should not have libnpmversion 1`] = ` NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess -@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | -@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm -libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api -libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund @npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm bad map npmcli libnpm cli workspaces map-workspaces -@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | -pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | ` exports[`test/lib/commands/search.js TAP search exclude regex > results should not have libnpmversion 1`] = ` NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess -@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | -@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm -libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api -libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund @npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm bad map npmcli libnpm cli workspaces map-workspaces -@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | -pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | ` exports[`test/lib/commands/search.js TAP search exclude string > results should not have libnpmversion 1`] = ` NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS libnpm | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib libnpmaccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | libnpmaccess -@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | -@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | libnpmorg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | libnpm npm package manager api orgs teams libnpmsearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api libnpm -libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +libnpmteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | libnpmhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api -libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +libnpmpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | libnpmfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli libnpm cli git fund gitfund @npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm bad map npmcli libnpm cli workspaces map-workspaces -@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | -pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | ` exports[`test/lib/commands/search.js TAP search exclude username with upper case letters > results should not have nlf 1`] = ` NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS -@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | -@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | -@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | -pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | +@evocateur/libnpmaccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/libnpmpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +pkg-no-desc | | =lukekarrys | 2019-09-26 | 1.0.0 | ` diff --git a/tap-snapshots/test/lib/utils/reify-output.js.test.cjs b/tap-snapshots/test/lib/utils/reify-output.js.test.cjs index b4d2188a2735d..5983ac224e26e 100644 --- a/tap-snapshots/test/lib/utils/reify-output.js.test.cjs +++ b/tap-snapshots/test/lib/utils/reify-output.js.test.cjs @@ -1637,7 +1637,7 @@ exports[`test/lib/utils/reify-output.js TAP prints dedupe difference on dry-run change bar 1.0.0 -> 2.1.0 remove bar 1.0.0 -add foo 1.0.0 +add foo 1.0.0 removed 1 package, and changed 1 package in {TIME} ` @@ -1646,7 +1646,7 @@ exports[`test/lib/utils/reify-output.js TAP prints dedupe difference on long > d change bar 1.0.0 -> 2.1.0 remove bar 1.0.0 -add foo 1.0.0 +add foo 1.0.0 removed 1 package, and changed 1 package in {TIME} ` diff --git a/test/fixtures/mock-logs.js b/test/fixtures/mock-logs.js index 78e118b9b5a95..a65a21e26584f 100644 --- a/test/fixtures/mock-logs.js +++ b/test/fixtures/mock-logs.js @@ -11,20 +11,17 @@ const LABELS = new Map([ const LOG_PREFIX = new RegExp(`^npm (${LEVELS.map(l => LABELS.get(l) ?? l).join('|')}) `, 'm') const GLOBAL_LOG_PREFIX = new RegExp(LOG_PREFIX.source, 'gm') -function longestCommonPrefix (words) { - // check border cases size 1 array and empty first word) - if (words.length === 1) { - return words[0].split(' ')[0] - } +// We only strip trailing newlines since some output will +// have significant tabs and spaces +const trimTrailingNewline = (str) => str.replace(/\n$/, '') - let i = 0 - // while all words have the same character at position i, increment i - while (words[0][i] && words.every(w => w[i] === words[0][i])) { - i++ - } +const joinAndTrimTrailingNewlines = (arr) => + trimTrailingNewline(arr.map(trimTrailingNewline).join('\n')) - // prefix is the substring from the beginning to the last successfully checked i - return words[0].substr(0, i) +const logsByTitle = (logs) => (title) => { + return logs + .filter((l) => l.messageNoLevel.startsWith(title + ' ')) + .map((l) => l.messageNoLevel) } module.exports = () => { @@ -33,34 +30,23 @@ module.exports = () => { const RAW_LOGS = [] - const logs = Object.defineProperties( - [], - LEVELS.reduce((acc, level) => { + const logs = Object.defineProperties([], { + byTitle: { + value: logsByTitle(RAW_LOGS), + }, + ...LEVELS.reduce((acc, level) => { acc[level] = { get () { const byLevel = RAW_LOGS.filter((l) => l.level === level) - return Object.defineProperty( - byLevel.map((l) => l.titleMessage), - 'byTitle', - { - value: (title) => byLevel - .filter((l) => l.titleMessage.startsWith(title)) - .map((l) => l.titleMessage.replace(new RegExp(`^${title} `, 'gm'), '')), - } - ) + const messagesForLevel = byLevel.map((l) => l.messageNoLevel) + return Object.defineProperty(messagesForLevel, 'byTitle', { + value: logsByTitle(byLevel), + }) }, } return acc - }, { - byTitle: { - value: (title) => { - return RAW_LOGS - .filter((l) => l.titleMessage.startsWith(title)) - .map((l) => l.titleMessage.replace(new RegExp(`^${title} `, 'gm'), '')) - }, - }, - }) - ) + }, {}), + }) const streams = { stderr: { @@ -72,31 +58,33 @@ module.exports = () => { // in the future if/when we refactor what logs look like. const logMatch = str.match(LOG_PREFIX) if (logMatch) { - str = str.trimEnd() + // This is the message including the `npm` heading on each line. + // This is not really used in tests since we know every single + // line will have this prefix and it makes it a pain to assert + // stuff about each log line. + const fullMessage = trimTrailingNewline(str) const [, label] = logMatch const level = LABELS.get(label) ?? label - const fullMessage = str.replace(GLOBAL_LOG_PREFIX, `${level} `) - const titleMessage = str.replace(GLOBAL_LOG_PREFIX, '') - const title = longestCommonPrefix(titleMessage.split('\n')) - const message = titleMessage.replace(new RegExp(`^${title} `, 'gm'), '') + const messageNoHeading = fullMessage.replace(GLOBAL_LOG_PREFIX, `${level} `) + const messageNoLevel = fullMessage.replace(GLOBAL_LOG_PREFIX, '') RAW_LOGS.push({ level, fullMessage, - titleMessage, - title, - message, + messageNoHeading, + messageNoLevel, }) - logs.push(fullMessage) + // The message without the heading is what is used throughout the tests + logs.push(messageNoHeading) } else { - outputErrors.push(str.replace(/\n$/, '')) + outputErrors.push(trimTrailingNewline(str)) } }, }, stdout: { write: (str) => { - outputs.push(str.replace(/\n$/, '')) + outputs.push(trimTrailingNewline(str)) }, }, } @@ -105,12 +93,13 @@ module.exports = () => { streams, logs: { outputs, - joinedOutput: () => outputs.map(o => o.trimEnd()).join('\n').trimEnd(), + joinedOutput: () => joinAndTrimTrailingNewlines(outputs), clearOutput: () => { outputs.length = 0 + outputErrors.length = 0 }, outputErrors, - joinedOutputError: () => outputErrors.map(o => o.trimEnd()).join('\n').trimEnd(), + joinedOutputError: () => joinAndTrimTrailingNewlines(outputs), logs, clearLogs: () => { RAW_LOGS.length = 0 diff --git a/test/lib/cli-entry.js b/test/lib/cli-entry.js index 50d63a86ae760..3a8d3321c4b64 100644 --- a/test/lib/cli-entry.js +++ b/test/lib/cli-entry.js @@ -34,9 +34,9 @@ t.test('print the version, and treat npm_g as npm -g', async t => { await cli(process) t.strictSame(process.argv, ['node', 'npm', '-g', '-v'], 'system process.argv was rewritten') - t.strictSame(logs.verbose.byTitle('cli'), ['node npm']) - t.strictSame(logs.verbose.byTitle('title'), ['npm']) - t.match(logs.verbose.byTitle('argv'), ['"--global" "--version"']) + t.strictSame(logs.verbose.byTitle('cli'), ['cli node npm']) + t.strictSame(logs.verbose.byTitle('title'), ['title npm']) + t.match(logs.verbose.byTitle('argv'), ['argv "--global" "--version"']) t.strictSame(logs.info, [ `using npm@${Npm.version}`, `using node@${process.version}`, @@ -55,9 +55,9 @@ t.test('calling with --versions calls npm version with no args', async t => { await cli(process) t.equal(process.title, 'npm install or whatever') - t.strictSame(logs.verbose.byTitle('cli'), ['node npm']) - t.strictSame(logs.verbose.byTitle('title'), ['npm install or whatever']) - t.match(logs.verbose.byTitle('argv'), ['"install" "or" "whatever" "--versions"']) + t.strictSame(logs.verbose.byTitle('cli'), ['cli node npm']) + t.strictSame(logs.verbose.byTitle('title'), ['title npm install or whatever']) + t.match(logs.verbose.byTitle('argv'), ['argv "install" "or" "whatever" "--versions"']) t.equal(outputs.length, 1) t.match(JSON.parse(outputs[0]), { npm: String, node: String, v8: String }) t.strictSame(exitHandlerCalled(), []) @@ -78,10 +78,10 @@ t.test('logged argv is sanitized', async t => { await cli(process) t.equal(process.title, 'npm version') - t.strictSame(logs.verbose.byTitle('cli'), ['node npm']) - t.strictSame(logs.verbose.byTitle('title'), ['npm version']) + t.strictSame(logs.verbose.byTitle('cli'), ['cli node npm']) + t.strictSame(logs.verbose.byTitle('title'), ['title npm version']) t.match(logs.verbose.byTitle('argv'), - ['"version" "--registry" "https://u:***@npmjs.org/password"']) + ['argv "version" "--registry" "https://u:***@npmjs.org/password"']) }) t.test('logged argv is sanitized with equals', async t => { @@ -97,7 +97,7 @@ t.test('logged argv is sanitized with equals', async t => { }) await cli(process) - t.match(logs.verbose.byTitle('argv'), ['"version" "--registry" "https://u:***@npmjs.org/"']) + t.match(logs.verbose.byTitle('argv'), ['argv "version" "--registry" "https://u:***@npmjs.org/"']) }) t.test('print usage if no params provided', async t => { diff --git a/test/lib/commands/logout.js b/test/lib/commands/logout.js index a34008e5033d2..3087c8bb1e61d 100644 --- a/test/lib/commands/logout.js +++ b/test/lib/commands/logout.js @@ -19,7 +19,7 @@ t.test('token logout - user config', async t => { await npm.exec('logout', []) t.equal( logs.verbose.byTitle('logout')[0], - 'clearing token for https://registry.npmjs.org/', + 'logout clearing token for https://registry.npmjs.org/', 'should log message with correct registry' ) const userRc = await fs.readFile(join(home, '.npmrc'), 'utf-8') @@ -46,7 +46,7 @@ t.test('token scoped logout - user config', async t => { await npm.exec('logout', []) t.equal( logs.verbose.byTitle('logout')[0], - 'clearing token for https://diff-registry.npmjs.com/', + 'logout clearing token for https://diff-registry.npmjs.com/', 'should log message with correct registry' ) @@ -68,7 +68,7 @@ t.test('user/pass logout - user config', async t => { await npm.exec('logout', []) t.equal( logs.verbose.byTitle('logout')[0], - 'clearing user credentials for https://registry.npmjs.org/', + 'logout clearing user credentials for https://registry.npmjs.org/', 'should log message with correct registry' ) @@ -107,7 +107,7 @@ t.test('ignore invalid scoped registry config', async t => { t.equal( logs.verbose.byTitle('logout')[0], - 'clearing token for https://registry.npmjs.org/', + 'logout clearing token for https://registry.npmjs.org/', 'should log message with correct registry' ) const userRc = await fs.readFile(join(home, '.npmrc'), 'utf-8') @@ -136,7 +136,7 @@ t.test('token logout - project config', async t => { t.equal( logs.verbose.byTitle('logout')[0], - 'clearing token for https://registry.npmjs.org/', + 'logout clearing token for https://registry.npmjs.org/', 'should log message with correct registry' ) const userRc = await fs.readFile(join(home, '.npmrc'), 'utf-8') @@ -146,7 +146,7 @@ t.test('token logout - project config', async t => { ].join('\n'), 'leaves user config alone') t.equal( logs.verbose.byTitle('logout')[0], - 'clearing token for https://registry.npmjs.org/', + 'logout clearing token for https://registry.npmjs.org/', 'should log message with correct registry' ) const projectRc = await fs.readFile(join(prefix, '.npmrc'), 'utf-8') diff --git a/test/lib/commands/owner.js b/test/lib/commands/owner.js index ef07539787e80..ec774d1647048 100644 --- a/test/lib/commands/owner.js +++ b/test/lib/commands/owner.js @@ -123,7 +123,7 @@ t.test('owner ls fails to retrieve packument', async t => { }) registry.nock.get(`/${spec.escapedName}`).reply(404) await t.rejects(npm.exec('owner', ['ls'])) - t.match(logs.error.byTitle('owner ls'), [`Couldn't get owner data @npmcli/test-package`]) + t.match(logs.error.byTitle('owner ls'), [`owner ls Couldn't get owner data @npmcli/test-package`]) }) t.test('owner ls ', async t => { diff --git a/test/lib/commands/profile.js b/test/lib/commands/profile.js index 8aff4b10c6759..c6cf2a071dcfa 100644 --- a/test/lib/commands/profile.js +++ b/test/lib/commands/profile.js @@ -474,7 +474,7 @@ t.test('profile set ', async t => { t.equal( logs.warn.byTitle('profile')[0], - 'Passwords do not match, please try again.', + 'profile Passwords do not match, please try again.', 'should log password mismatch message' ) diff --git a/test/lib/commands/query.js b/test/lib/commands/query.js index 539f0837460e3..0907a9d0f4206 100644 --- a/test/lib/commands/query.js +++ b/test/lib/commands/query.js @@ -258,7 +258,7 @@ t.test('expect entries', t => { npm.config.set('expect-results', false) await npm.exec('query', ['#a']) t.not(joinedOutput(), '[]', 'has entries') - t.same(logs.warn.byTitle('query'), ['Expected no results, got 1']) + t.same(logs.warn.byTitle('query'), ['query Expected no results, got 1']) t.ok(process.exitCode, 'exits with code') }) t.test('false, no entries', async t => { @@ -286,7 +286,7 @@ t.test('expect entries', t => { npm.config.set('expect-results', true) await npm.exec('query', ['#b']) t.equal(joinedOutput(), '[]', 'does not have entries') - t.same(logs.warn.byTitle('query'), ['Expected results, got 0']) + t.same(logs.warn.byTitle('query'), ['query Expected results, got 0']) t.ok(process.exitCode, 'exits with code') }) t.test('count, matches', async t => { @@ -305,7 +305,7 @@ t.test('expect entries', t => { npm.config.set('expect-result-count', 1) await npm.exec('query', ['#b']) t.equal(joinedOutput(), '[]', 'does not have entries') - t.same(logs.warn.byTitle('query'), ['Expected 1 result, got 0']) + t.same(logs.warn.byTitle('query'), ['query Expected 1 result, got 0']) t.ok(process.exitCode, 'exits with code') }) t.test('count 3, does not match', async t => { @@ -315,7 +315,7 @@ t.test('expect entries', t => { npm.config.set('expect-result-count', 3) await npm.exec('query', ['#b']) t.equal(joinedOutput(), '[]', 'does not have entries') - t.same(logs.warn.byTitle('query'), ['Expected 3 results, got 0']) + t.same(logs.warn.byTitle('query'), ['query Expected 3 results, got 0']) t.ok(process.exitCode, 'exits with code') }) t.end() diff --git a/test/lib/commands/stars.js b/test/lib/commands/stars.js index 2b35b78e7ea1a..fc38ca77ac781 100644 --- a/test/lib/commands/stars.js +++ b/test/lib/commands/stars.js @@ -87,7 +87,7 @@ t.test('unauthorized request', async t => { t.strictSame( logs(), - ['auth is required to look up your username'], + ['stars auth is required to look up your username'], 'should warn auth required msg' ) @@ -121,7 +121,7 @@ t.test('no pkg starred', async t => { t.strictSame( logs(), - ['user has not starred any packages'], + ['stars user has not starred any packages'], 'should warn no starred packages msg' ) }) diff --git a/test/lib/utils/audit-error.js b/test/lib/utils/audit-error.js index d62f954b4c107..9d6192fbc31be 100644 --- a/test/lib/utils/audit-error.js +++ b/test/lib/utils/audit-error.js @@ -78,7 +78,7 @@ t.test('error, audit command, not json', async t => { t.ok(error, 'throws error') t.match(output, 'body error text', 'some output') - t.strictSame(logs, ['message'], 'some warnings') + t.strictSame(logs, ['audit message'], 'some warnings') }) t.test('error, audit command, json', async t => { @@ -115,5 +115,5 @@ t.test('error, audit command, json', async t => { ' }\n' + '}' , 'some output') - t.strictSame(logs, ['message'], 'some warnings') + t.strictSame(logs, ['audit message'], 'some warnings') })