Skip to content
Myr

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 file

Take it

The walk stopped after 200 commits: lines older than 8663361 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';

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

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';

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

line 7why, one step back
7

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

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

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

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

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

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');

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

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',

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

lines 35–39why, one step back
35 });
3637 t.is(stdout, 'foo');38});39

Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207

lines 40–44why, one step back
40test('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});44

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

line 45why, one step back
45test('node correctly use nodePath', async t => {

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

line 46why, one step back
46 const {stdout} = await execaNode(process.platform === 'win32' ? 'hello.cmd' : 'hello.sh', {

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

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

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

lines 50–52why, one step back
50 });
5152 t.is(stdout, 'Hello World');

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

lines 53–58why, one step back
53});
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');

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

lines 59–61why, one step back
59});
6061test('node pass on nodeOptions', async t => {

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

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

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

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

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

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

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

lines 65–68why, one step back
65 });
6667 t.is(stdout, 'foo');68});

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

lines 69–72why, one step back
69
70test.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 back
73 '--inspect',

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

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

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

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

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

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

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

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

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

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

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

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

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

lines 100–103why, one step back
100 });
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 back
104 },

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

line 105why, one step back
105);

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

lines 106–107why, one step back
106
107test('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 back
108 const subprocess = execaNode('test/fixtures/send.js');
109 await pEvent(subprocess, 'message');110

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

lines 111–114why, one step back
111 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 back
115
116 subprocess.kill();

Improve some tests (#655)ehmickybefore adoption6cf1c5e

lines 117–119why, one step back
117
118 const {signal} = await t.throwsAsync(subprocess);119 t.is(signal, 'SIGTERM');

Update `engines` field in `package.json` (#319)ehmickybefore adoption8663361

line 120why, one step back
120});