node.js
This file
Path
test/node.js
112 lines · 2.6 KiB · JavaScript
Last changed by
Allow `nodePath` option to be a file URL (#632)ehmickybefore adoption77e1477
History of this fileTake it
The walk stopped after 200 commits: lines older than c2f5edf 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 `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
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 `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
line 7why, one step back7Re-enable Windows in CI (#500)ehmickybefore adoption071d0a2
line 8why, one step back8setFixtureDir();Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
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 `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
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 `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
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 `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
lines 35–40why, one step back35 });3637 t.is(stdout, 'foo');38});3940test('node correctly use nodePath', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 41why, one step back41 const {stdout} = await execaNode(process.platform === 'win32' ? 'hello.cmd' : 'hello.sh', {Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
lines 42–43why, one step back42 stdout: 'pipe',43 nodePath: process.platform === 'win32' ? 'cmd.exe' : 'bash',Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 44why, one step back44 nodeOptions: process.platform === 'win32' ? ['/c'] : [],Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
lines 45–47why, one step back45 });4647 t.is(stdout, 'Hello World');Allow `nodePath` option to be a file URL (#632)ehmickybefore adoption77e1477
lines 48–53why, one step back48});4950test('The nodePath option can be a file URL', async t => {51 const nodePath = pathToFileURL(process.execPath);52 const {stdout} = await execaNode('test/fixtures/noop.js', ['foo'], {nodePath});53 t.is(stdout, 'foo');Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
lines 54–55why, one step back54});55Rename `nodeArguments` to `nodeOptions` (#299)ehmickybefore adoptionb979534
line 56why, one step back56test('node pass on nodeOptions', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 57why, one step back57 const {stdout} = await execaNode('console.log("foo")', {Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
line 58why, one step back58 stdout: 'pipe',Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 59why, one step back59 nodeOptions: ['-e'],Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
lines 60–63why, one step back60 });6162 t.is(stdout, 'foo');63});Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 64–67why, one step back6465test.serial(66 'node removes --inspect from nodeOptions when defined by parent process',67 inspectMacro,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 68why, one step back68 '--inspect',Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 69–73why, one step back69);7071test.serial(72 'node removes --inspect=9222 from nodeOptions when defined by parent process',73 inspectMacro,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 74why, one step back74 '--inspect=9222',Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 75–79why, one step back75);7677test.serial(78 'node removes --inspect-brk from nodeOptions when defined by parent process',79 inspectMacro,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 80why, one step back80 '--inspect-brk',Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 81–85why, one step back81);8283test.serial(84 'node removes --inspect-brk=9222 from nodeOptions when defined by parent process',85 inspectMacro,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 86why, one step back86 '--inspect-brk=9222',Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 87–91why, one step back87);8889test.serial(90 'node should not remove --inspect when passed through nodeOptions',91 async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 92why, one step back92 const {stdout, stderr} = await execaNode('console.log("foo")', {Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
line 93why, one step back93 reject: false,Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 94why, one step back94 nodeOptions: ['--inspect', '-e'],Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
lines 95–98why, one step back95 });9697 t.is(stdout, 'foo');98 t.true(stderr.includes('Debugger listening'));Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
line 99why, one step back99 },Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64
line 100why, one step back100);Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
lines 101–102why, one step back101102test('node\'s forked script has a communication channel', async t => {Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880
lines 103–105why, one step back103 const subprocess = execaNode('test/fixtures/send.js');104 await pEvent(subprocess, 'message');105Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
lines 106–109why, one step back106 subprocess.send('ping');107108 const message = await pEvent(subprocess, 'message');109 t.is(message, 'pong');Fix processes not exiting on `inputFile` validation (#588)ehmickybefore adoption5b1a1c7
lines 110–111why, one step back110111 subprocess.kill();Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf
line 112why, one step back112});