diff options
author | Gar <gar+gh@danger.computer> | 2021-09-15 21:29:13 +0300 |
---|---|---|
committer | Gar <gar+gh@danger.computer> | 2021-10-07 19:07:19 +0300 |
commit | a13d9d53ddf3e0f52f4a39fe116653bf40cf99e5 (patch) | |
tree | c281324e40798b6e8e1ed53a9a2d55dd8f87b91a /test/index.js | |
parent | 32e163fd10aace69d927dae46d04d64c04e5014b (diff) |
feat: drop node 10, 11, and programmatic api
BREAKING CHANGE:
- Drop official support for node versions less than v12.
- Drop support for `require('npm')`
- Update a few subdependencies that dropped node10 support, and brought
in the latest node-gyp
PR-URL: https://github.com/npm/cli/pull/3762
Credit: @wraithgar
Close: #3762
Reviewed-by: @fritzy
Diffstat (limited to 'test/index.js')
-rw-r--r-- | test/index.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/index.js b/test/index.js new file mode 100644 index 000000000..11dd5eb2d --- /dev/null +++ b/test/index.js @@ -0,0 +1,23 @@ +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 { spawn } = require('child_process') + const LS = require('../lib/ls.js') + const ls = new LS({}) + const p = spawn(process.execPath, [index, 'ls', '-h']) + const out = [] + p.stdout.on('data', c => out.push(c)) + p.on('close', (code, signal) => { + t.equal(code, 0) + t.equal(signal, null) + t.match(Buffer.concat(out).toString(), ls.usage) + t.end() + }) +}) + |