node.js
This file
Path
test/node.js
120 lines · 2.9 KiB · JavaScript
Last changed by
Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207
History of this fileTake it
The walk stopped after 200 commits: lines older than 120230c point at it.
Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 1why, one step back1import process from 'node:process';Allow `nodePath` option to be a file URL (#632)ehmickybefore adoption77e1477
line 2why, one step back2import {pathToFileURL} from 'node:url';Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
line 3why, one step back3import test from 'ava';Minor tweaksSindre Sorhusbefore adoption244e87a
line 4why, one step back4import {pEvent} from 'p-event';Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 5why, one step back5import {execaNode} from '../index.js';Re-enable Windows in CI (#500)ehmickybefore adoption071d0a2
line 6why, one step back6import {setFixtureDir} from './helpers/fixtures-dir.js';Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
line 7why, one step back7Re-enable Windows in CI (#500)ehmickybefore adoption071d0a2
line 8why, one step back8setFixtureDir();Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
line 9why, one step back9Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 10–13why, one step back10async function inspectMacro(t, input) {11 const originalArgv = process.execArgv;12 process.execArgv = [input, '-e'];13 try {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
lines 14–15why, one step back14 const subprocess = execaNode('console.log("foo")', {15 reject: false,Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 16–26why, one step back16 });1718 const {stdout, stderr} = await subprocess;1920 t.is(stdout, 'foo');21 t.is(stderr, '');22 } finally {23 process.execArgv = originalArgv;24 }25}26Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
line 27why, one step back27test('node()', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 28why, one step back28 const {exitCode} = await execaNode('test/fixtures/noop.js');Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
lines 29–32why, one step back29 t.is(exitCode, 0);30});3132test('node pipe stdout', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
lines 33–34why, one step back33 const {stdout} = await execaNode('test/fixtures/noop.js', ['foo'], {34 stdout: 'pipe',Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
lines 35–39why, one step back35 });3637 t.is(stdout, 'foo');38});39Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207
lines 40–44why, one step back40test('node does not return ipc channel\'s output', async t => {41 const {stdio} = await execaNode('test/fixtures/noop.js', ['foo']);42 t.deepEqual(stdio, [undefined, 'foo', '', undefined]);43});44Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
line 45why, one step back45test('node correctly use nodePath', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 46why, one step back46 const {stdout} = await execaNode(process.platform === 'win32' ? 'hello.cmd' : 'hello.sh', {Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
lines 47–48why, one step back47 stdout: 'pipe',48 nodePath: process.platform === 'win32' ? 'cmd.exe' : 'bash',Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 49why, one step back49 nodeOptions: process.platform === 'win32' ? ['/c'] : [],Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
lines 50–52why, one step back50 });5152 t.is(stdout, 'Hello World');Allow `nodePath` option to be a file URL (#632)ehmickybefore adoption77e1477
lines 53–58why, one step back53});5455test('The nodePath option can be a file URL', async t => {56 const nodePath = pathToFileURL(process.execPath);57 const {stdout} = await execaNode('test/fixtures/noop.js', ['foo'], {nodePath});58 t.is(stdout, 'foo');Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
lines 59–61why, one step back59});6061test('node pass on nodeOptions', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 62why, one step back62 const {stdout} = await execaNode('console.log("foo")', {Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
line 63why, one step back63 stdout: 'pipe',Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 64why, one step back64 nodeOptions: ['-e'],Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
lines 65–68why, one step back65 });6667 t.is(stdout, 'foo');68});Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 69–72why, one step back6970test.serial(71 'node removes --inspect from nodeOptions when defined by parent process',72 inspectMacro,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 73why, one step back73 '--inspect',Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 74–78why, one step back74);7576test.serial(77 'node removes --inspect=9222 from nodeOptions when defined by parent process',78 inspectMacro,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 79why, one step back79 '--inspect=9222',Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 80–84why, one step back80);8182test.serial(83 'node removes --inspect-brk from nodeOptions when defined by parent process',84 inspectMacro,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 85why, one step back85 '--inspect-brk',Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 86–90why, one step back86);8788test.serial(89 'node removes --inspect-brk=9222 from nodeOptions when defined by parent process',90 inspectMacro,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 91why, one step back91 '--inspect-brk=9222',Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 92–96why, one step back92);9394test.serial(95 'node should not remove --inspect when passed through nodeOptions',96 async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 97why, one step back97 const {stdout, stderr} = await execaNode('console.log("foo")', {Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
line 98why, one step back98 reject: false,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 99why, one step back99 nodeOptions: ['--inspect', '-e'],Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 100–103why, one step back100 });101102 t.is(stdout, 'foo');103 t.true(stderr.includes('Debugger listening'));Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 104why, one step back104 },Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
line 105why, one step back105);Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
lines 106–107why, one step back106107test('node\'s forked script has a communication channel', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
lines 108–110why, one step back108 const subprocess = execaNode('test/fixtures/send.js');109 await pEvent(subprocess, 'message');110Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
lines 111–114why, one step back111 subprocess.send('ping');112113 const message = await pEvent(subprocess, 'message');114 t.is(message, 'pong');Fix processes not exiting on `inputFile` validation (#588)ehmickybefore adoption5b1a1c7
lines 115–116why, one step back115116 subprocess.kill();Improve some tests (#655)ehmickybefore adoption6cf1c5e
lines 117–119why, one step back117118 const {signal} = await t.throwsAsync(subprocess);119 t.is(signal, 'SIGTERM');Add sudo-prompt as a related package (#411)Richie Bendallbefore adoption120230c
line 120why, one step back120});