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

prefix.js « lib « test - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 83e2d63680859626f980292559a7f8c3691eef67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const { test } = require('tap')
const requireInject = require('require-inject')

test('prefix', (t) => {
  t.plan(3)
  const dir = '/prefix/dir'

  const prefix = requireInject('../../lib/prefix.js', {
    '../../lib/npm.js': { prefix: dir },
    '../../lib/utils/output.js': (output) => {
      t.equal(output, dir, 'prints the correct directory')
    },
  })

  prefix([], (err) => {
    t.ifError(err, 'npm prefix')
    t.ok('should have printed directory')
  })
})