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