1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
Description: Disable tests that require network access
Tests in this package require access to https://registry.npmjs.org/echo-cli
and https://registry.npmjs.org/say-shalom at build time. Disable these
tests, since NPM is inaccessible at build time per policy.
Author: Steve Langasek <steve.langasek@ubuntu.com>
Bug-Debian: https://bugs.debian.org/920468
Reviewed-By: Xavier Guimard <yadd@debian.org>
Last-Modified: 2019-02-14
--- a/test/index.js
+++ b/test/index.js
@@ -16,39 +16,6 @@
const NPX_ESC = isWindows ? child.escapeArg(NPX_PATH) : NPX_PATH
-test('npx --always-spawn', t => {
- return child.spawn('node', [
- NPX_ESC, '--always-spawn', 'echo-cli', 'hewwo'
- ], {stdio: 'pipe'}).then(res => {
- t.equal(res.stdout.trim(), 'hewwo')
- })
-})
-
-test('npx --always-spawn resolves promise after command is executed', t => {
- const _runCommand = child.runCommand
- const parsed = main.parseArgs([
- process.argv[0],
- '[fake arg]',
- '--always-spawn',
- 'echo-cli',
- 'hewwo'
- ], NPM_PATH)
- child.runCommand = (command, opts) => {
- child.runCommand = _runCommand
- return Promise.resolve([command, opts])
- }
- return main(parsed)
- .then(args => {
- const command = args[0]
- const opts = args[1]
- t.ok(command.includes('node'), 'node executes the command')
- t.equal(opts.alwaysSpawn, true, 'set opts.alwaysSpawn')
- t.equal(opts.command, 'echo-cli', 'set opts.command')
- t.ok(opts.cmdOpts[0].includes('echo-cli'), 'set opts.cmdOpts[0]')
- t.equal(opts.cmdOpts[1], 'hewwo', 'set opts.cmdOpts[1]')
- })
-})
-
test('npx --shell-auto-fallback', t => {
return child.spawn('node', [
NPX_ESC, '--shell-auto-fallback', 'zsh'
@@ -293,21 +260,6 @@
})
})
-test('npx with custom installer stdio', t => {
- const NPX_PATH = path.resolve(__dirname, 'util', 'npx-bin-inherit-stdio.js')
- const NPX_ESC = isWindows ? child.escapeArg(NPX_PATH) : NPX_PATH
-
- return child.spawn('node', [
- NPX_ESC, 'say-shalom@1.2.7'
- ], {stdio: 'pipe'}).then(res => {
- t.equal(res.code, 0, 'command succeeded')
- t.match(
- res.stdout.toString(), /"added":/, 'installer output printed directly to console'
- )
- t.end()
- })
-})
-
test('noisy npx with --quiet arg on windows', {
skip: !isWindows && 'Only on Windows does the path to the downloaded module get printed'
}, t => {
|