Welcome to mirror list, hosted at ThFree Co, Russian Federation.

prune.js « lib « test - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 074f4eac6eeee29961e02749c00d1e745a0e87a0 (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
28
29
const { test } = require('tap')
const requireInject = require('require-inject')

test('should prune using Arborist', (t) => {
  const prune = requireInject('../../lib/prune.js', {
    '../../lib/npm.js': {
      prefix: 'foo',
      flatOptions: {
        foo: 'bar',
      },
    },
    '@npmcli/arborist': function (args) {
      t.ok(args, 'gets options object')
      t.ok(args.path, 'gets path option')
      this.prune = () => {
        t.ok(true, 'prune is called')
      }
    },
    '../../lib/utils/reify-finish.js': (arb) => {
      t.ok(arb, 'gets arborist tree')
    },
  })
  prune(null, er => {
    if (er)
      throw er
    t.ok(true, 'callback is called')
    t.end()
  })
})