diff options
Diffstat (limited to 'deps/npm/test/lib/prefix.js')
-rw-r--r-- | deps/npm/test/lib/prefix.js | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/deps/npm/test/lib/prefix.js b/deps/npm/test/lib/prefix.js index 526631388e7..18a37f3ccd1 100644 --- a/deps/npm/test/lib/prefix.js +++ b/deps/npm/test/lib/prefix.js @@ -1,19 +1,13 @@ const t = require('tap') +const { real: mockNpm } = require('../fixtures/mock-npm') -t.test('prefix', (t) => { - t.plan(3) - const dir = '/prefix/dir' - - const Prefix = require('../../lib/prefix.js') - const prefix = new Prefix({ - prefix: dir, - output: (output) => { - t.equal(output, dir, 'prints the correct directory') - }, - }) - - prefix.exec([], (err) => { - t.error(err, 'npm prefix') - t.ok('should have printed directory') - }) +t.test('prefix', async (t) => { + const { joinedOutput, command, npm } = mockNpm(t) + await npm.load() + await command('prefix') + t.equal( + joinedOutput(), + npm.prefix, + 'outputs npm.prefix' + ) }) |