diff options
author | Gar <gar+gh@danger.computer> | 2022-05-07 19:11:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-07 19:11:18 +0300 |
commit | 48d2db6037487fd782f67bbcd2cf12e009ece17b (patch) | |
tree | af1907ea0d36bfd9d7c5673ae51e4e8b3a4c7760 /tap-snapshots | |
parent | 8e7ea9b61afe37de6017ff77c142ef3abdff6bec (diff) |
fix: remove test coverage map (#4862)
Turns out there were three files that still had no test coverage because
of the combination of the mocks in tests and the coverage map. Removing
the map altogether exposed them.
This PR removes the coverage map and fixes test to cover all lines that
were being missed.
While adding coverage to the `npm search` codebase multiple unneeded
guards and at least one bug was found (it was impossible to exclude
searches based on username). These were fixed.
The `npm view` tests were also refactored to use the real npm object.
Finally, a small inlining of lib/utils/file-exists.js was done.
Diffstat (limited to 'tap-snapshots')
-rw-r--r-- | tap-snapshots/test/lib/commands/search.js.test.cjs | 130 | ||||
-rw-r--r-- | tap-snapshots/test/lib/commands/view.js.test.cjs | 386 |
2 files changed, 312 insertions, 204 deletions
diff --git a/tap-snapshots/test/lib/commands/search.js.test.cjs b/tap-snapshots/test/lib/commands/search.js.test.cjs index 139fca259..152e66056 100644 --- a/tap-snapshots/test/lib/commands/search.js.test.cjs +++ b/tap-snapshots/test/lib/commands/search.js.test.cjs @@ -9,12 +9,130 @@ exports[`test/lib/commands/search.js TAP empty search results > should have expe 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>/--color > should have expected search results with color 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +[31mlibnpm[0m | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib +[31mlibnpm[0maccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | [31mlibnpm[0maccess +@evocateur/[31mlibnpm[0maccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | +@evocateur/[31mlibnpm[0mpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | +[31mlibnpm[0morg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | [31mlibnpm[0m npm package manager api orgs teams +[31mlibnpm[0msearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api [31mlibnpm[0m +[31mlibnpm[0mteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | +[31mlibnpm[0mhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api +[31mlibnpm[0mpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | +[31mlibnpm[0mfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli [31mlibnpm[0m cli git fund gitfund +@npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli [31mlibnpm[0m cli workspaces map-workspaces +[31mlibnpm[0mversion | library to do the… | =nlf… | 2020-11-04 | 1.0.7 | +@types/[31mlibnpm[0msearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | ` -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 | +exports[`test/lib/commands/search.js TAP search <name> --color > should have expected search results with color 1`] = ` +NAME | DESCRIPTION | AUTHOR | DATE | VERSION | KEYWORDS +[31mlibnpm[0m | Collection of… | =nlf… | 2019-07-16 | 3.0.1 | npm api package manager lib[31m[0m +[31mlibnpm[0maccess | programmatic… | =nlf… | 2020-11-03 | 4.0.1 | [31mlibnpm[0maccess[31m[0m +@evocateur/[31mlibnpm[0maccess | programmatic… | =evocateur | 2019-07-16 | 3.1.2 | [31m[0m +@evocateur/[31mlibnpm[0mpublish | Programmatic API… | =evocateur | 2019-07-16 | 1.2.2 | [31m[0m +[31mlibnpm[0morg | Programmatic api… | =nlf… | 2020-11-03 | 2.0.1 | [31mlibnpm[0m npm package manager api orgs teams[31m[0m +[31mlibnpm[0msearch | Programmatic API… | =nlf… | 2020-12-08 | 3.1.0 | npm search api [31mlibnpm[0m[31m[0m +[31mlibnpm[0mteam | npm Team management… | =nlf… | 2020-11-03 | 2.0.2 | [31m[0m +[31mlibnpm[0mhook | programmatic API… | =nlf… | 2020-11-03 | 6.0.1 | npm hooks registry npm api[31m[0m +[31mlibnpm[0mpublish | Programmatic API… | =nlf… | 2020-11-03 | 4.0.0 | [31m[0m +[31mlibnpm[0mfund | Programmatic API… | =nlf… | 2020-12-08 | 1.0.2 | npm npmcli [31mlibnpm[0m cli git fund gitfund[31m[0m +@npmcli/map-workspaces | Retrieves a… | =nlf… | 2020-09-30 | 1.0.1 | npm npmcli [31mlibnpm[0m cli workspaces map-workspaces[31m[0m +[31mlibnpm[0mversion | library to do the… | =nlf… | 2020-11-04 | 1.0.7 | [31m[0m +@types/[31mlibnpm[0msearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | [31m[0m +` + +exports[`test/lib/commands/search.js TAP search <name> --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 +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 +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 +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 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 +` + +exports[`test/lib/commands/search.js TAP search <name> > 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 | +` + +exports[`test/lib/commands/search.js TAP search <name> 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 | +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 | +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 | +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 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 | +` + +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 | +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 | +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 | +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 npmcli libnpm cli workspaces map-workspaces +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +` + +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 | +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 | +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 | +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 npmcli libnpm cli workspaces map-workspaces +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +` + +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 | +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 | +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 | +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 npmcli libnpm cli workspaces map-workspaces +@types/libnpmsearch | TypeScript… | =types | 2019-09-26 | 2.0.1 | +` + +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 | ` diff --git a/tap-snapshots/test/lib/commands/view.js.test.cjs b/tap-snapshots/test/lib/commands/view.js.test.cjs index 5868e7b04..d5b7a3b4a 100644 --- a/tap-snapshots/test/lib/commands/view.js.test.cjs +++ b/tap-snapshots/test/lib/commands/view.js.test.cjs @@ -5,96 +5,102 @@ * 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`] = ` +exports[`test/lib/commands/view.js TAP deprecated package with license, bugs, repository and other fields > must match snapshot 1`] = ` -claudia -` +[4m[1m[32mgreen[39m@[32m1.0.0[39m[22m[24m | [32mACME[39m | deps: [36m2[39m | versions: [33m2[39m +green is a very important color -exports[`test/lib/commands/view.js TAP should log info by field name array field - 2 elements > must match snapshot 1`] = ` +[1m[31mDEPRECATED[39m[22m!! - true -maintainers[0].name = 'claudia' -maintainers[1].name = 'isaacs' -` +keywords:,[33mcolors, green, crayola[39m -exports[`test/lib/commands/view.js TAP should log info by field name maintainers with email > must match snapshot 1`] = ` +bin:,[33mgreen[39m -{ - "maintainers": [ - { - "name": "claudia", - "email": "c@yellow.com", - "twitter": "cyellow" - }, - { - "name": "isaacs", - "email": "i@yellow.com", - "twitter": "iyellow" - } - ], - "name": "yellow" -} -` +dist +.tarball:,[36mhttp://hm.green.com/1.0.0.tgz[39m +.shasum:,[33m123[39m +.integrity:,[33m---[39m +.unpackedSize:,[33m1.0 GB[39m + +dependencies: +[33mred[39m: 1.0.0 +[33myellow[39m: 1.0.0 -exports[`test/lib/commands/view.js TAP should log info by field name maintainers with url > must match snapshot 1`] = ` +maintainers: +-,[33mclaudia[39m <[36mc@yellow.com[39m> +-,[33misaacs[39m <[36mi@yellow.com[39m> -[ - "claudia (http://c.pink.com)", - "isaacs (http://i.pink.com)" -] +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 ` -exports[`test/lib/commands/view.js TAP should log info by field name nested field with brackets > must match snapshot 1`] = ` +exports[`test/lib/commands/view.js TAP deprecated package with unicode > must match snapshot 1`] = ` -"123" -` +[4m[1m[32mgreen[39m@[32m1.0.0[39m[22m[24m | [32mACME[39m | deps: [36m2[39m | versions: [33m2[39m +green is a very important color -exports[`test/lib/commands/view.js TAP should log info by field name readme > must match snapshot 1`] = ` +[1m[31mDEPRECATED[39m[22m ⚠️ - true -a very useful readme -` +keywords:,[33mcolors, green, crayola[39m -exports[`test/lib/commands/view.js TAP should log info by field name several fields > must match snapshot 1`] = ` +bin:,[33mgreen[39m -{ - "name": "yellow", - "version": "1.0.0" -} -` +dist +.tarball:,[36mhttp://hm.green.com/1.0.0.tgz[39m +.shasum:,[33m123[39m +.integrity:,[33m---[39m +.unpackedSize:,[33m1.0 GB[39m + +dependencies: +[33mred[39m: 1.0.0 +[33myellow[39m: 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`] = ` +maintainers: +-,[33mclaudia[39m <[36mc@yellow.com[39m> +-,[33misaacs[39m <[36mi@yellow.com[39m> -yellow@1.0.0 'claudia' -yellow@1.0.1 'claudia' -yellow@1.0.2 'claudia' +dist-tags: +[1m[32mlatest[39m[22m: 1.0.0 ` -exports[`test/lib/commands/view.js TAP should log info of package in current working dir directory > must match snapshot 1`] = ` +exports[`test/lib/commands/view.js TAP 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, green, crayola[39m -[4m[1m[32mblue[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[39m +bin:,[33mgreen[39m dist -.tarball:[36mhttp://hm.blue.com/1.0.0.tgz[39m -.shasum:[33m123[39m -.integrity:[33m---[39m -.unpackedSize:[33m1 B[39m +.tarball:,[36mhttp://hm.green.com/1.0.0.tgz[39m +.shasum:,[33m123[39m +.integrity:,[33m---[39m +.unpackedSize:,[33m1.0 GB[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 - -published {TIME} ago[39m ` -exports[`test/lib/commands/view.js TAP should log info of package in current working dir non-specific version > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package in cwd directory > 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 +.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 @@ -102,16 +108,15 @@ dist-tags: published {TIME} ago[39m ` -exports[`test/lib/commands/view.js TAP should log info of package in current working dir specific version > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP package in cwd 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 +.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 @@ -119,38 +124,23 @@ dist-tags: published {TIME} ago[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, green, crayola[39m +exports[`test/lib/commands/view.js TAP package in cwd specific version > must match snapshot 1`] = ` -bin:[33mgreen[39m +[4m[1m[32mblue[39m@[32m1.0.0[39m[22m[24m | [1m[31mProprietary[39m[22m | deps: [32mnone[39m | versions: [33m2[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> +.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 -` -exports[`test/lib/commands/view.js TAP should log package info package with --json and semver range > must match snapshot 1`] = ` +published {TIME} ago[39m +` +exports[`test/lib/commands/view.js TAP package with --json and semver range > must match snapshot 1`] = ` [ { "_npmUser": "claudia <claudia@cyan.com>", @@ -168,7 +158,7 @@ exports[`test/lib/commands/view.js TAP should log package info package with --js "tarball": "http://hm.cyan.com/1.0.0.tgz", "integrity": "---", "fileCount": 1, - "unpackedSize": 1 + "unpackedSize": 1000000 } }, { @@ -185,77 +175,44 @@ exports[`test/lib/commands/view.js TAP should log package info package with --js ] ` -exports[`test/lib/commands/view.js TAP should log package info package with homepage > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP 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, green, crayola[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> +.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 maintainers info as object > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP 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 +.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`] = ` - +exports[`test/lib/commands/view.js TAP 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 +.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 @@ -288,16 +245,15 @@ 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`] = ` - +exports[`test/lib/commands/view.js TAP 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 +.tarball:,[36mhttp://hm.cyan.com/1.0.0.tgz[39m +.shasum:,[33m123[39m +.integrity:,[33m---[39m +.unpackedSize:,[33m1.0 MB[39m dist-tags: [1m[32mlatest[39m[22m: 1.0.0 @@ -305,16 +261,15 @@ dist-tags: 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`] = ` - +exports[`test/lib/commands/view.js TAP 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 +.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 @@ -322,16 +277,15 @@ dist-tags: published {TIME} ago[39m ` -exports[`test/lib/commands/view.js TAP should log package info package with semver range > must match snapshot 1`] = ` - +exports[`test/lib/commands/view.js TAP 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 +.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 @@ -341,10 +295,10 @@ published {TIME} ago[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 +.tarball:,[36mhttp://hm.blue.com/1.0.1.tgz[39m +.shasum:,[33m124[39m +.integrity:,[33m---[39m +.unpackedSize:,[33m1.0 kB[39m dist-tags: [1m[32mlatest[39m[22m: 1.0.0 @@ -352,8 +306,47 @@ dist-tags: published [33mover a year from now[39m ` -exports[`test/lib/commands/view.js TAP workspaces all workspaces --json > must match snapshot 1`] = ` +exports[`test/lib/commands/view.js TAP specific field names array field - 1 element > must match snapshot 1`] = ` +claudia +` + +exports[`test/lib/commands/view.js TAP specific field names array field - 2 elements > must match snapshot 1`] = ` +maintainers[0].name = 'claudia' +maintainers[1].name = 'isaacs' +` + +exports[`test/lib/commands/view.js TAP specific field names 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 specific field names maintainers with url > must match snapshot 1`] = ` +[ 'claudia (http://c.pink.com)', 'isaacs (http://i.pink.com)' ] +` + +exports[`test/lib/commands/view.js TAP specific field names nested field with brackets > must match snapshot 1`] = ` +123 +` + +exports[`test/lib/commands/view.js TAP specific field names readme > must match snapshot 1`] = ` +a very useful readme +` + +exports[`test/lib/commands/view.js TAP specific field names several fields > must match snapshot 1`] = ` +name = 'yellow' +version = '1.0.0' +` + +exports[`test/lib/commands/view.js TAP specific field names 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 workspaces all workspaces --json > must match snapshot 1`] = ` { "green": { "_id": "green", @@ -406,7 +399,7 @@ exports[`test/lib/commands/view.js TAP workspaces all workspaces --json > must m "tarball": "http://hm.green.com/1.0.0.tgz", "integrity": "---", "fileCount": 1, - "unpackedSize": 1 + "unpackedSize": 1000000000 } }, "orange": { @@ -434,29 +427,28 @@ exports[`test/lib/commands/view.js TAP workspaces all workspaces --json > must m 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, green, crayola[39m +keywords:,[33mcolors, green, crayola[39m -bin:[33mgreen[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 +.tarball:,[36mhttp://hm.green.com/1.0.0.tgz[39m +.shasum:,[33m123[39m +.integrity:,[33m---[39m +.unpackedSize:,[33m1.0 GB[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> +-,[33mclaudia[39m <[36mc@yellow.com[39m> +-,[33misaacs[39m <[36mi@yellow.com[39m> dist-tags: [1m[32mlatest[39m[22m: 1.0.0 @@ -465,10 +457,10 @@ dist-tags: [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 +.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 @@ -479,13 +471,11 @@ exports[`test/lib/commands/view.js TAP workspaces all workspaces nonexistent fie ` 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" @@ -493,7 +483,6 @@ exports[`test/lib/commands/view.js TAP workspaces all workspaces single field -- ` exports[`test/lib/commands/view.js TAP workspaces all workspaces single field > must match snapshot 1`] = ` - green: green orange: @@ -502,55 +491,56 @@ 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, green, crayola[39m +keywords:,[33mcolors, green, crayola[39m -bin:[33mgreen[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 +.tarball:,[36mhttp://hm.green.com/1.0.0.tgz[39m +.shasum:,[33m123[39m +.integrity:,[33m---[39m +.unpackedSize:,[33m1.0 GB[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> +-,[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 +.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`] = ` +exports[`test/lib/commands/view.js TAP workspaces remote package name > should have warning of ignoring workspaces 1`] = ` +Array [ + Array [ + "Ignoring workspaces for specified package(s)", + ], +] +` +exports[`test/lib/commands/view.js TAP workspaces single workspace --json > must match snapshot 1`] = ` { "green": { "_id": "green", @@ -603,7 +593,7 @@ exports[`test/lib/commands/view.js TAP workspaces single workspace --json > must "tarball": "http://hm.green.com/1.0.0.tgz", "integrity": "---", "fileCount": 1, - "unpackedSize": 1 + "unpackedSize": 1000000000 } } } |