blob: c1b9c71df5a79e936ad96385d4d44deb30bf8648 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
const t = require('tap')
const { real: mockNpm } = require('../../fixtures/mock-npm')
t.test('should run dedupe in dryRun mode', async (t) => {
t.plan(5)
const { Npm } = 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')
}
},
'../../lib/utils/reify-finish.js': (npm, arb) => {
t.ok(arb, 'gets arborist tree')
},
})
const npm = new Npm()
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 npm.exec('find-dupes', [])
})
|