diff options
author | npm team <ops+robot@npmjs.com> | 2021-08-19 20:47:33 +0300 |
---|---|---|
committer | Luigi Pinca <luigipinca@gmail.com> | 2021-08-20 15:53:49 +0300 |
commit | 248f4c376444d0202f1d08f039c59485d6aea2e9 (patch) | |
tree | 270bcf6dd5734fa43ea1603bfc4a066b6f8f7926 /deps/npm/test/lib/find-dupes.js | |
parent | 279162cf98b22ec5d0afc182ea22c7a782ccd083 (diff) |
deps: upgrade npm to 7.21.0
PR-URL: https://github.com/nodejs/node/pull/39813
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Diffstat (limited to 'deps/npm/test/lib/find-dupes.js')
-rw-r--r-- | deps/npm/test/lib/find-dupes.js | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/deps/npm/test/lib/find-dupes.js b/deps/npm/test/lib/find-dupes.js index c7b33ceb6ed..17940764b94 100644 --- a/deps/npm/test/lib/find-dupes.js +++ b/deps/npm/test/lib/find-dupes.js @@ -1,24 +1,26 @@ const t = require('tap') -const FindDupes = require('../../lib/find-dupes.js') +const { real: mockNpm } = require('../fixtures/mock-npm') -t.test('should run dedupe in dryRun mode', (t) => { - t.plan(3) - const findDupesTest = new FindDupes({ - config: { - set: (k, v) => { - t.match(k, 'dry-run') - t.match(v, true) - }, +t.test('should run dedupe in dryRun mode', async (t) => { + t.plan(5) + const { npm, command } = mockNpm(t, { + '@npmcli/arborist': function (args) { + t.ok(args, 'gets options object') + t.ok(args.path, 'gets path option') + t.ok(args.dryRun, 'is called in dryRun mode') + this.dedupe = () => { + t.ok(true, 'dedupe is called') + } }, - commands: { - dedupe: (args, cb) => { - t.match(args, []) - cb() - }, + '../../lib/utils/reify-finish.js': (npm, arb) => { + t.ok(arb, 'gets arborist tree') }, }) - findDupesTest.exec({}, () => { - t.end() - }) + await npm.load() + // explicitly set to false so we can be 100% sure it's always true when it + // hits arborist + npm.config.set('dry-run', false) + npm.config.set('prefix', 'foo') + await command('find-dupes') }) |