diff options
author | Gar <gar+gh@danger.computer> | 2021-11-08 21:38:58 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-11-09 18:18:30 +0300 |
commit | b8d608929f395d2d2fca4cb05905c5ef712c0faa (patch) | |
tree | b469ccb31cb4ac777dd73841d790eee892950509 /tap-snapshots/test | |
parent | 2039184189314aa17c3ae1df1447dc778eee0a74 (diff) |
chore: refactor pack tests
Uses the real npm object and doesn't mock anything.
PR-URL: https://github.com/npm/cli/pull/4018
Credit: @wraithgar
Close: #4018
Reviewed-by: @lukekarrys
Diffstat (limited to 'tap-snapshots/test')
-rw-r--r-- | tap-snapshots/test/lib/commands/pack.js.test.cjs | 78 |
1 files changed, 78 insertions, 0 deletions
diff --git a/tap-snapshots/test/lib/commands/pack.js.test.cjs b/tap-snapshots/test/lib/commands/pack.js.test.cjs new file mode 100644 index 000000000..e3219b45e --- /dev/null +++ b/tap-snapshots/test/lib/commands/pack.js.test.cjs @@ -0,0 +1,78 @@ +/* IMPORTANT + * This snapshot file is auto-generated, but designed for humans. + * It should be checked into source control and tracked carefully. + * Re-generate by setting TAP_SNAPSHOT=1 and running tests. + * Make sure to inspect the output below. Do not ignore changes! + */ +'use strict' +exports[`test/lib/commands/pack.js TAP dry run > logs pack contents 1`] = ` +Array [ + undefined, + "package: test-package@1.0.0", + undefined, + "41B package.json", + undefined, + String( + name: test-package + version: 1.0.0 + filename: test-package-1.0.0.tgz + package size: 136 B + unpacked size: 41 B + shasum: a92a0679a70a450f14f98a468756948a679e4107 + integrity: sha512-Gka9ZV/Bryxky[...]LgMJ+0F+FhXMA== + total files: 1 + ), + "", +] +` + +exports[`test/lib/commands/pack.js TAP should log output as valid json > logs pack contents 1`] = ` +Array [] +` + +exports[`test/lib/commands/pack.js TAP should log output as valid json > outputs as json 1`] = ` +Array [ + Array [ + Object { + "bundled": Array [], + "entryCount": 1, + "filename": "test-package-1.0.0.tgz", + "files": Array [ + Object { + "mode": 420, + "path": "package.json", + "size": 41, + }, + ], + "id": "test-package@1.0.0", + "integrity": "sha512-Gka9ZV/BryxkypfvMpTvLfaJE1AUi7PK1EAbYqnVzqtucf6QvUK4CFsLVzagY1GwZVx2T1jwWLgMJ+0F+FhXMA==", + "name": "test-package", + "shasum": "a92a0679a70a450f14f98a468756948a679e4107", + "size": 136, + "unpackedSize": 41, + "version": "1.0.0", + }, + ], +] +` + +exports[`test/lib/commands/pack.js TAP should pack current directory with no arguments > logs pack contents 1`] = ` +Array [ + undefined, + "package: test-package@1.0.0", + undefined, + "41B package.json", + undefined, + String( + name: test-package + version: 1.0.0 + filename: test-package-1.0.0.tgz + package size: 136 B + unpacked size: 41 B + shasum: a92a0679a70a450f14f98a468756948a679e4107 + integrity: sha512-Gka9ZV/Bryxky[...]LgMJ+0F+FhXMA== + total files: 1 + ), + "", +] +` |