diff options
author | Marco Sirabella <marco@sirabella.org> | 2021-04-19 00:20:07 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-05-06 20:26:36 +0300 |
commit | 701627c5169934e59da2959d76a49c77278cc9dc (patch) | |
tree | 94bbe1292b16829cc467fc89ff61debf268494e4 /test | |
parent | 99ff40dff5e5e55a5d5f045ba90e76c08174ca38 (diff) |
feat(cache): Allow `add` to accept multiple specs
This is a backwards incompatible change to the undocumented
`cache add pkg version`, but
Motivations for this can be found here:
https://github.com/npm/cli/pull/2976#issuecomment-811511134
Signed-off-by: Marco Sirabella <marco@sirabella.org>
PR-URL: https://github.com/npm/cli/pull/3098
Credit: @mjsir911
Close: #3098
Reviewed-by: @wraithgar
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/cache.js | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/test/lib/cache.js b/test/lib/cache.js index bbebae889..bad0ede89 100644 --- a/test/lib/cache.js +++ b/test/lib/cache.js @@ -134,20 +134,21 @@ t.test('cache add pkg only', t => { }) }) -t.test('cache add pkg w/ spec modifier', t => { +t.test('cache add multiple pkgs', t => { t.teardown(() => { logOutput = [] tarballStreamSpec = '' tarballStreamOpts = {} }) - cache.exec(['add', 'mypkg', 'latest'], err => { + cache.exec(['add', 'mypkg', 'anotherpkg'], err => { t.error(err) t.strictSame(logOutput, [ - ['silly', 'cache add', 'args', ['mypkg', 'latest']], - ['silly', 'cache add', 'spec', 'mypkg@latest'], + ['silly', 'cache add', 'args', ['mypkg', 'anotherpkg']], + ['silly', 'cache add', 'spec', 'mypkg'], + ['silly', 'cache add', 'spec', 'anotherpkg'], ], 'logs correctly') - t.equal(tarballStreamSpec, 'mypkg@latest', 'passes the correct spec to pacote') + t.equal(tarballStreamSpec, 'anotherpkg', 'passes the correct spec to pacote') t.same(tarballStreamOpts, npm.flatOptions, 'passes the correct options to pacote') t.end() }) |