diff options
Diffstat (limited to 'test/index.js')
-rw-r--r-- | test/index.js | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/test/index.js b/test/index.js index 26db16e1f..081c89cee 100644 --- a/test/index.js +++ b/test/index.js @@ -1,16 +1,18 @@ const t = require('tap') const index = require.resolve('../index.js') const packageIndex = require.resolve('../') + t.equal(index, packageIndex, 'index is main package require() export') t.throws(() => require(index), { message: 'The programmatic API was removed in npm v8.0.0', }) t.test('loading as main module will load the cli', t => { + const cwd = t.testdir() const { spawn } = require('child_process') const LS = require('../lib/commands/ls.js') const ls = new LS({}) - const p = spawn(process.execPath, [index, 'ls', '-h']) + const p = spawn(process.execPath, [index, 'ls', '-h', '--cache', cwd]) const out = [] p.stdout.on('data', c => out.push(c)) p.on('close', (code, signal) => { |