Skip to content

Commit

Permalink
fixup! fix: revert '--json' argument to 'npm pack' command
Browse files Browse the repository at this point in the history
  • Loading branch information
ruyadorno committed May 20, 2021
1 parent d18c29e commit b95b512
Showing 1 changed file with 44 additions and 6 deletions.
50 changes: 44 additions & 6 deletions test/lib/pack.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,35 @@ t.test('should log output as valid json', (t) => {
libnpmpack,
'../../lib/utils/tar.js': {
getContents: async () => ({
filename: 'my-cool-pkg-1.0.0.tgz',
files: [{ path: 'README.md' }, { path: 'index.js' }, { path: 'package.json' }],
entryCount: 3,
id: '@ruyadorno/redact@1.0.0',
name: '@ruyadorno/redact',
version: '1.0.0',
size: 2450,
unpackedSize: 4911,
shasum: '044c7574639b923076069d6e801e2d1866430f17',
// mocks exactly how ssri Integrity works:
integrity: {
sha512: [
{
source: 'sha512-JSdyskeR2qonBUaQ4vdlU/vQGSfgCxSq5O+vH+d2yVWRqzso4O3gUzd6QX/V7OWV//zU7kA5o63Zf433jUnOtQ==',
digest: 'JSdyskeR2qonBUaQ4vdlU/vQGSfgCxSq5O+vH+d2yVWRqzso4O3gUzd6QX/V7OWV//zU7kA5o63Zf433jUnOtQ==',
algorithm: 'sha512',
options: [],
},
],
toJSON () {
return 'sha512-JSdyskeR2qonBUaQ4vdlU/vQGSfgCxSq5O+vH+d2yVWRqzso4O3gUzd6QX/V7OWV//zU7kA5o63Zf433jUnOtQ=='
},
},
filename: '@ruyadorno/redact-1.0.0.tgz',
files: [
{ path: 'LICENSE', size: 1113, mode: 420 },
{ path: 'README.md', size: 2639, mode: 420 },
{ path: 'index.js', size: 719, mode: 493 },
{ path: 'package.json', size: 440, mode: 420 },
],
entryCount: 4,
bundled: [],
}),
},
npmlog: {
Expand All @@ -198,9 +224,21 @@ t.test('should log output as valid json', (t) => {
t.error(err, { bail: true })

t.match(JSON.parse(OUTPUT), [{
filename: 'my-cool-pkg-1.0.0.tgz',
files: [{ path: 'README.md' }, { path: 'index.js' }, { path: 'package.json' }],
entryCount: 3,
id: '@ruyadorno/redact@1.0.0',
name: '@ruyadorno/redact',
version: '1.0.0',
size: 2450,
unpackedSize: 4911,
shasum: '044c7574639b923076069d6e801e2d1866430f17',
integrity: 'sha512-JSdyskeR2qonBUaQ4vdlU/vQGSfgCxSq5O+vH+d2yVWRqzso4O3gUzd6QX/V7OWV//zU7kA5o63Zf433jUnOtQ==',
filename: '@ruyadorno/redact-1.0.0.tgz',
files: [
{ path: 'LICENSE' },
{ path: 'README.md' },
{ path: 'index.js' },
{ path: 'package.json' },
],
entryCount: 4,
}], 'pack details output as valid json')

t.end()
Expand Down

0 comments on commit b95b512

Please sign in to comment.