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: dfb50f174f5dbc6d77e2192c8a9bba0352075b0c (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/utils/output.js': (output) => {
      t.equal(output, dir, 'prints the correct directory')
    },
  })
  const prefix = new Prefix({ prefix: dir })

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