Skip to content
Myr

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 file

Take 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 back
1import process from 'node:process';

Allow `nodePath` option to be a file URL (#632)ehmickybefore adoption77e1477

line 2why, one step back
2import {pathToFileURL} from 'node:url';

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 3why, one step back
3import test from 'ava';

Minor tweaksSindre Sorhusbefore adoption244e87a

line 4why, one step back
4import {pEvent} from 'p-event';

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 5why, one step back
5import {execaNode} from '../index.js';

Re-enable Windows in CI (#500)ehmickybefore adoption071d0a2

line 6why, one step back
6import {setFixtureDir} from './helpers/fixtures-dir.js';

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 7why, one step back
7

Re-enable Windows in CI (#500)ehmickybefore adoption071d0a2

line 8why, one step back
8setFixtureDir();

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 9why, one step back
9

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

lines 10–13why, one step back
10async 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 back
14 const subprocess = execaNode('console.log("foo")', {
15 reject: false,

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

lines 16–26why, one step back
16 });
1718 const {stdout, stderr} = await subprocess;1920 t.is(stdout, 'foo');21 t.is(stderr, '');22 } finally {23 process.execArgv = originalArgv;24 }25}26

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 27why, one step back
27test('node()', async t => {

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 28why, one step back
28 const {exitCode} = await execaNode('test/fixtures/noop.js');

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 29–32why, one step back
29 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 back
33 const {stdout} = await execaNode('test/fixtures/noop.js', ['foo'], {
34 stdout: 'pipe',

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 35–40why, one step back
35 });
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 back
41 const {stdout} = await execaNode(process.platform === 'win32' ? 'hello.cmd' : 'hello.sh', {

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 42–43why, one step back
42 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 back
44 nodeOptions: process.platform === 'win32' ? ['/c'] : [],

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 45–47why, one step back
45 });
4647 t.is(stdout, 'Hello World');

Allow `nodePath` option to be a file URL (#632)ehmickybefore adoption77e1477

lines 48–53why, one step back
48});
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 back
54});
55

Rename `nodeArguments` to `nodeOptions` (#299)ehmickybefore adoptionb979534

line 56why, one step back
56test('node pass on nodeOptions', async t => {

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 57why, one step back
57 const {stdout} = await execaNode('console.log("foo")', {

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 58why, one step back
58 stdout: 'pipe',

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 59why, one step back
59 nodeOptions: ['-e'],

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 60–63why, one step back
60 });
6162 t.is(stdout, 'foo');63});

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

lines 64–67why, one step back
64
65test.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 back
68 '--inspect',

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

lines 69–73why, one step back
69);
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 back
74 '--inspect=9222',

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

lines 75–79why, one step back
75);
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 back
80 '--inspect-brk',

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

lines 81–85why, one step back
81);
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 back
86 '--inspect-brk=9222',

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

lines 87–91why, one step back
87);
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 back
92 const {stdout, stderr} = await execaNode('console.log("foo")', {

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

line 93why, one step back
93 reject: false,

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 94why, one step back
94 nodeOptions: ['--inspect', '-e'],

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

lines 95–98why, one step back
95 });
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 back
99 },

Remove `--inspect` & `--inspect-brk` from `execArgv` (#435)Ward Peetersbefore adoption8fd3f64

line 100why, one step back
100);

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 101–102why, one step back
101
102test('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 back
103 const subprocess = execaNode('test/fixtures/send.js');
104 await pEvent(subprocess, 'message');105

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 106–109why, one step back
106 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 back
110
111 subprocess.kill();

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

line 112why, one step back
112});