Skip to content
Myr

error.js

This file

Path

test/error.js

358 lines · 13.5 KiB · JavaScript

Last changed by

Fix return value being re-used between multiple calls (#796)ehmickybefore adoption7710440

History of this file

Take it

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

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

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

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

line 3why, one step back
3import {execa, execaSync} from '../index.js';

Add `cwd` error property (#565)homersimpsonsbefore adoptionf57fdec

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

Improve `error.message` (#705)ehmickybefore adoption67b476b

line 5why, one step back
5import {fullStdio, getStdio} from './helpers/stdio.js';

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

line 6why, one step back
6import {noopGenerator, outputObjectGenerator} from './helpers/generator.js';

Fix return value being re-used between multiple calls (#796)ehmickybefore adoption7710440

line 7why, one step back
7import {foobarString} from './helpers/input.js';

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 8why, one step back
8

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 9why, one step back
9const isWindows = process.platform === 'win32';

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 10why, one step back
10

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

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

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

line 12why, one step back
12

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 13–14why, one step back
13const TIMEOUT_REGEXP = /timed out after/;
14

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 15–17why, one step back
15const testEmptyErrorStdio = async (t, execaMethod) => {
16 const {failed, stdout, stderr, stdio} = await execaMethod('fail.js', {reject: false});17 t.true(failed);

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

lines 18–19why, one step back
18 t.is(stdout, '');
19 t.is(stderr, '');

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 20–21why, one step back
20 t.deepEqual(stdio, [undefined, '', '']);
21};

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 22why, one step back
22

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 23–24why, one step back
23test('empty error.stdout/stderr/stdio', testEmptyErrorStdio, execa);
24test('empty error.stdout/stderr/stdio - sync', testEmptyErrorStdio, execaSync);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 25why, one step back
25

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 26–31why, one step back
26const testUndefinedErrorStdio = async (t, execaMethod) => {
27 const {stdout, stderr, stdio} = await execaMethod('empty.js', {stdio: 'ignore'});28 t.is(stdout, undefined);29 t.is(stderr, undefined);30 t.deepEqual(stdio, [undefined, undefined, undefined]);31};

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

line 32why, one step back
32

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 33–44why, one step back
33test('undefined error.stdout/stderr/stdio', testUndefinedErrorStdio, execa);
34test('undefined error.stdout/stderr/stdio - sync', testUndefinedErrorStdio, execaSync);3536const testEmptyAll = async (t, options, expectedValue) => {37 const {all} = await t.throwsAsync(execa('fail.js', options));38 t.is(all, expectedValue);39};4041test('empty error.all', testEmptyAll, {all: true}, '');42test('undefined error.all', testEmptyAll, {}, undefined);43test('ignored error.all', testEmptyAll, {all: true, stdio: 'ignore'}, undefined);44

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

lines 45–46why, one step back
45test('empty error.stdio[0] even with input', async t => {
46 const {stdio} = await t.throwsAsync(execa('fail.js', {input: 'test'}));

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

line 47why, one step back
47 t.is(stdio[0], undefined);

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

lines 48–49why, one step back
48});
49

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 50–51why, one step back
50// `error.code` is OS-specific here
51const SPAWN_ERROR_CODES = new Set(['EINVAL', 'ENOTSUP', 'EPERM']);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 52why, one step back
52

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

line 53why, one step back
53test('stdout/stderr/stdio on process spawning errors', async t => {

Fix `reject` option with early spawning errors (#734)ehmickybefore adoption8a18881

line 54why, one step back
54 const {code, stdout, stderr, stdio} = await t.throwsAsync(execa('empty.js', {uid: -1}));

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 55–58why, one step back
55 t.true(SPAWN_ERROR_CODES.has(code));
56 t.is(stdout, undefined);57 t.is(stderr, undefined);58 t.deepEqual(stdio, [undefined, undefined, undefined]);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 59–60why, one step back
59});
60

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 61–62why, one step back
61test('stdout/stderr/all/stdio on process spawning errors - sync', t => {
62 const {code, stdout, stderr, stdio} = t.throws(() => {

Fix `reject` option with early spawning errors (#734)ehmickybefore adoption8a18881

line 63why, one step back
63 execaSync('empty.js', {uid: -1});

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 64why, one step back
64 });

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 65–68why, one step back
65 t.true(SPAWN_ERROR_CODES.has(code));
66 t.is(stdout, undefined);67 t.is(stderr, undefined);68 t.deepEqual(stdio, [undefined, undefined, undefined]);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 69–70why, one step back
69});
70

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 71–73why, one step back
71const testErrorOutput = async (t, execaMethod) => {
72 const {failed, stdout, stderr, stdio} = await execaMethod('echo-fail.js', {...fullStdio, reject: false});73 t.true(failed);

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

lines 74–75why, one step back
74 t.is(stdout, 'stdout');
75 t.is(stderr, 'stderr');

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 76–77why, one step back
76 t.deepEqual(stdio, [undefined, 'stdout', 'stderr', 'fd3']);
77};

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

line 78why, one step back
78

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 79–80why, one step back
79test('error.stdout/stderr/stdio is defined', testErrorOutput, execa);
80test('error.stdout/stderr/stdio is defined - sync', testErrorOutput, execaSync);

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

line 81why, one step back
81

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 82why, one step back
82test('exitCode is 0 on success', async t => {

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

line 83why, one step back
83 const {exitCode} = await execa('noop.js', ['foo']);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 84–86why, one step back
84 t.is(exitCode, 0);
85});86

Upgrade dependenciesSindre Sorhusbefore adoption5d64878

line 87why, one step back
87const testExitCode = async (t, number) => {

Fix inconsistency between `result.stdout` and `error.stdout` (#686)ehmickybefore adoptionec383fe

lines 88–91why, one step back
88 const {exitCode} = await t.throwsAsync(
89 execa('exit.js', [`${number}`]),90 {message: new RegExp(`failed with exit code ${number}`)},91 );

Upgrade dependenciesSindre Sorhusbefore adoption5d64878

line 92why, one step back
92 t.is(exitCode, number);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 93–99why, one step back
93};
9495test('exitCode is 2', testExitCode, 2);96test('exitCode is 3', testExitCode, 3);97test('exitCode is 4', testExitCode, 4);9899test('error.message contains the command', async t => {

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

line 100why, one step back
100 await t.throwsAsync(execa('exit.js', ['2', 'foo', 'bar']), {message: /exit.js 2 foo bar/});

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 101–102why, one step back
101});
102

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

lines 103–104why, one step back
103const testStdioMessage = async (t, encoding, all, objectMode) => {
104 const {message} = await t.throwsAsync(execa('echo-fail.js', {...getStdio(1, noopGenerator(objectMode), 4), encoding, all}));

Improve `error.message` (#705)ehmickybefore adoption67b476b

lines 105–106why, one step back
105 const output = all ? 'stdout\nstderr' : 'stderr\n\nstdout';
106 t.true(message.endsWith(`echo-fail.js\n\n${output}\n\nfd3`));

Fix `error.message` when using `encoding: 'buffer'` (#701)ehmickybefore adoptionb8c1f55

lines 107–108why, one step back
107};
108

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

lines 109–116why, one step back
109test('error.message contains stdout/stderr/stdio if available', testStdioMessage, 'utf8', false, false);
110test('error.message contains stdout/stderr/stdio even with encoding "buffer"', testStdioMessage, 'buffer', false, false);111test('error.message contains all if available', testStdioMessage, 'utf8', true, false);112test('error.message contains all even with encoding "buffer"', testStdioMessage, 'buffer', true, false);113test('error.message contains stdout/stderr/stdio if available, objectMode', testStdioMessage, 'utf8', false, true);114test('error.message contains stdout/stderr/stdio even with encoding "buffer", objectMode', testStdioMessage, 'buffer', false, true);115test('error.message contains all if available, objectMode', testStdioMessage, 'utf8', true, true);116test('error.message contains all even with encoding "buffer", objectMode', testStdioMessage, 'buffer', true, true);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 117why, one step back
117

Improve `error.message` (#705)ehmickybefore adoption67b476b

lines 118–121why, one step back
118const testPartialIgnoreMessage = async (t, index, stdioOption, output) => {
119 const {message} = await t.throwsAsync(execa('echo-fail.js', getStdio(index, stdioOption, 4)));120 t.true(message.endsWith(`echo-fail.js\n\n${output}\n\nfd3`));121};

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

line 122why, one step back
122

Improve `error.message` (#705)ehmickybefore adoption67b476b

lines 123–124why, one step back
123test('error.message does not contain stdout if not available', testPartialIgnoreMessage, 1, 'ignore', 'stderr');
124test('error.message does not contain stderr if not available', testPartialIgnoreMessage, 2, 'ignore', 'stdout');

Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce

lines 125–126why, one step back
125test('error.message does not contain stdout if it is an object', testPartialIgnoreMessage, 1, outputObjectGenerator, 'stderr');
126test('error.message does not contain stderr if it is an object', testPartialIgnoreMessage, 2, outputObjectGenerator, 'stdout');

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

line 127why, one step back
127

Improve `error.message` (#705)ehmickybefore adoption67b476b

lines 128–129why, one step back
128const testFullIgnoreMessage = async (t, options, resultProperty) => {
129 const {[resultProperty]: message} = await t.throwsAsync(execa('echo-fail.js', options));

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 130–131why, one step back
130 t.false(message.includes('stderr'));
131 t.false(message.includes('stdout'));

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

line 132why, one step back
132 t.false(message.includes('fd3'));

Improve `error.message` (#705)ehmickybefore adoption67b476b

line 133why, one step back
133};

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 134why, one step back
134

Improve `error.message` (#705)ehmickybefore adoption67b476b

lines 135–144why, one step back
135test('error.message does not contain stdout/stderr/stdio if not available', testFullIgnoreMessage, {stdio: 'ignore'}, 'message');
136test('error.shortMessage does not contain stdout/stderr/stdio', testFullIgnoreMessage, fullStdio, 'shortMessage');137138const testErrorMessageConsistent = async (t, stdout) => {139 const {message} = await t.throwsAsync(execa('noop-both-fail.js', [stdout, 'stderr']));140 t.true(message.endsWith(`noop-both-fail.js ${stdout} stderr\n\nstderr\n\nstdout`));141};142143test('error.message newlines are consistent - no newline', testErrorMessageConsistent, 'stdout');144test('error.message newlines are consistent - newline', testErrorMessageConsistent, 'stdout\n');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 145–146why, one step back
145
146test('Original error.message is kept', async t => {

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

line 147why, one step back
147 const {originalMessage} = await t.throwsAsync(execa('noop.js', {cwd: 1}));

Drop support for Node 12 (#497)ehmickybefore adoptiona09cbc0

line 148why, one step back
148 t.true(originalMessage.startsWith('The "options.cwd" property must be of type string or an instance of Buffer or URL. Received type number'));

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 149–151why, one step back
149});
150151test('failed is false on success', async t => {

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

line 152why, one step back
152 const {failed} = await execa('noop.js', ['foo']);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 153–156why, one step back
153 t.false(failed);
154});155156test('failed is true on failure', async t => {

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

line 157why, one step back
157 const {failed} = await t.throwsAsync(execa('fail.js'));

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 158–160why, one step back
158 t.true(failed);
159});160

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 161why, one step back
161test('error.isTerminated is true if process was killed directly', async t => {

Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d

line 162why, one step back
162 const subprocess = execa('forever.js', {killSignal: 'SIGINT'});

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 163–165why, one step back
163
164 subprocess.kill();165

Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d

line 166why, one step back
166 const {isTerminated, signal} = await t.throwsAsync(subprocess, {message: /was killed with SIGINT/});

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 167why, one step back
167 t.true(isTerminated);

Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d

line 168why, one step back
168 t.is(signal, 'SIGINT');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 169–170why, one step back
169});
170

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 171why, one step back
171test('error.isTerminated is true if process was killed indirectly', async t => {

Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d

line 172why, one step back
172 const subprocess = execa('forever.js', {killSignal: 'SIGHUP'});

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 173–176why, one step back
173
174 process.kill(subprocess.pid, 'SIGINT');175176 // `process.kill()` is emulated by Node.js on Windows

Improve process termination (#724)ehmickybefore adoption1c48d37

lines 177–185why, one step back
177 if (isWindows) {
178 const {isTerminated, signal} = await t.throwsAsync(subprocess, {message: /failed with exit code 1/});179 t.is(isTerminated, false);180 t.is(signal, undefined);181 } else {182 const {isTerminated, signal} = await t.throwsAsync(subprocess, {message: /was killed with SIGINT/});183 t.is(isTerminated, true);184 t.is(signal, 'SIGINT');185 }

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 186–187why, one step back
186});
187

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

lines 188–190why, one step back
188test('result.isTerminated is false if not killed', async t => {
189 const {isTerminated} = await execa('noop.js');190 t.false(isTerminated);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 191–192why, one step back
191});
192

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

lines 193–198why, one step back
193test('result.isTerminated is false if not killed and childProcess.kill() was called', async t => {
194 const subprocess = execa('noop.js');195 subprocess.kill(0);196 t.true(subprocess.killed);197 const {isTerminated} = await subprocess;198 t.false(isTerminated);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 199–200why, one step back
199});
200

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

lines 201–203why, one step back
201test('result.isTerminated is false if not killed, in sync mode', t => {
202 const {isTerminated} = execaSync('noop.js');203 t.false(isTerminated);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 204–205why, one step back
204});
205

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

lines 206–212why, one step back
206test('result.isTerminated is false on process error', async t => {
207 const {isTerminated} = await t.throwsAsync(execa('wrong command'));208 t.false(isTerminated);209});210211test('result.isTerminated is false on process error, in sync mode', t => {212 const {isTerminated} = t.throws(() => {

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

line 213why, one step back
213 execaSync('wrong command');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 214why, one step back
214 });

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 215why, one step back
215 t.false(isTerminated);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 216–217why, one step back
216});
217

Fix `error.killed` and rename to `error.isTerminated` (#625)ehmickybefore adoption248349c

line 218why, one step back
218if (!isWindows) {

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 219why, one step back
219 test('error.signal is SIGINT', async t => {

Fix randomly failing tests for `spawned.kill()` (#613)ehmickybefore adoption43c30ac

line 220why, one step back
220 const subprocess = execa('forever.js');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 221–228why, one step back
221
222 process.kill(subprocess.pid, 'SIGINT');223224 const {signal} = await t.throwsAsync(subprocess, {message: /was killed with SIGINT/});225 t.is(signal, 'SIGINT');226 });227228 test('error.signalDescription is defined', async t => {

Fix randomly failing tests for `spawned.kill()` (#613)ehmickybefore adoption43c30ac

line 229why, one step back
229 const subprocess = execa('forever.js');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 230–237why, one step back
230
231 process.kill(subprocess.pid, 'SIGINT');232233 const {signalDescription} = await t.throwsAsync(subprocess, {message: /User interruption with CTRL-C/});234 t.is(signalDescription, 'User interruption with CTRL-C');235 });236237 test('error.signal is SIGTERM', async t => {

Fix randomly failing tests for `spawned.kill()` (#613)ehmickybefore adoption43c30ac

line 238why, one step back
238 const subprocess = execa('forever.js');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 239–245why, one step back
239
240 process.kill(subprocess.pid, 'SIGTERM');241242 const {signal} = await t.throwsAsync(subprocess, {message: /was killed with SIGTERM/});243 t.is(signal, 'SIGTERM');244 });245

Improve `killSignal` option (#728)ehmickybefore adoptioncf36c1d

lines 246–248why, one step back
246 test('error.signal uses killSignal', async t => {
247 const {signal} = await t.throwsAsync(execa('forever.js', {killSignal: 'SIGINT', timeout: 1, message: TIMEOUT_REGEXP}));248 t.is(signal, 'SIGINT');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 249–251why, one step back
249 });
250251 test('exitCode is undefined on signal termination', async t => {

Fix randomly failing tests for `spawned.kill()` (#613)ehmickybefore adoption43c30ac

line 252why, one step back
252 const subprocess = execa('forever.js');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 253–261why, one step back
253
254 process.kill(subprocess.pid);255256 const {exitCode} = await t.throwsAsync(subprocess);257 t.is(exitCode, undefined);258 });259}260261test('result.signal is undefined for successful execution', async t => {

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

line 262why, one step back
262 const {signal} = await execa('noop.js');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 263–266why, one step back
263 t.is(signal, undefined);
264});265266test('result.signal is undefined if process failed, but was not killed', async t => {

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

line 267why, one step back
267 const {signal} = await t.throwsAsync(execa('fail.js'));

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 268–271why, one step back
268 t.is(signal, undefined);
269});270271test('result.signalDescription is undefined for successful execution', async t => {

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

line 272why, one step back
272 const {signalDescription} = await execa('noop.js');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 273–276why, one step back
273 t.is(signalDescription, undefined);
274});275276test('error.code is undefined on success', async t => {

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

line 277why, one step back
277 const {code} = await execa('noop.js');

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

lines 278–281why, one step back
278 t.is(code, undefined);
279});280281test('error.code is defined on failure if applicable', async t => {

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

line 282why, one step back
282 const {code} = await t.throwsAsync(execa('noop.js', {cwd: 1}));

Remove faulty emulated ENOENT error on Windows (#447)Mark Terrelbefore adoptionbdbd975

line 283why, one step back
283 t.is(code, 'ERR_INVALID_ARG_TYPE');

Add `cwd` error property (#565)homersimpsonsbefore adoptionf57fdec

lines 284–286why, one step back
284});
285286test('error.cwd is defined on failure if applicable', async t => {

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

line 287why, one step back
287 const {cwd} = await t.throwsAsync(execa('fail.js', [], {cwd: FIXTURES_DIR}));

Add `cwd` error property (#565)homersimpsonsbefore adoptionf57fdec

lines 288–292why, one step back
288 t.is(cwd, FIXTURES_DIR);
289});290291test('error.cwd is undefined on failure if not passed as options', async t => {292 const expectedCwd = process.cwd();

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

line 293why, one step back
293 const {cwd} = await t.throwsAsync(execa('fail.js'));

Add `cwd` error property (#565)homersimpsonsbefore adoptionf57fdec

line 294why, one step back
294 t.is(cwd, expectedCwd);

Fix return value being re-used between multiple calls (#796)ehmickybefore adoption7710440

lines 295–357why, one step back
295});
296297const testUnusualError = async (t, error) => {298 const childProcess = execa('empty.js');299 childProcess.emit('error', error);300 const {message, originalMessage} = await t.throwsAsync(childProcess);301 t.true(message.includes(String(error)));302 t.is(originalMessage, String(error));303};304305test('error instance can be null', testUnusualError, null);306test('error instance can be false', testUnusualError, false);307test('error instance can be a string', testUnusualError, 'test');308test('error instance can be a number', testUnusualError, 0);309test('error instance can be a BigInt', testUnusualError, 0n);310test('error instance can be a symbol', testUnusualError, Symbol('test'));311test('error instance can be a function', testUnusualError, () => {});312test('error instance can be an array', testUnusualError, ['test', 'test']);313314test('error instance can be undefined', async t => {315 const childProcess = execa('empty.js');316 childProcess.emit('error');317 await t.throwsAsync(childProcess, {message: 'Command failed: empty.js'});318});319320test('error instance can be a plain object', async t => {321 const childProcess = execa('empty.js');322 childProcess.emit('error', {message: foobarString});323 await t.throwsAsync(childProcess, {message: new RegExp(foobarString)});324});325326test('error instance can be shared', async t => {327 const originalMessage = foobarString;328 const error = new Error(originalMessage);329 const fixtureName = 'noop.js';330331 const firstArgument = 'one';332 const childProcess = execa(fixtureName, [firstArgument]);333 childProcess.emit('error', error);334 const firstError = await t.throwsAsync(childProcess);335336 const secondArgument = 'two';337 const secondChildProcess = execa(fixtureName, [secondArgument]);338 secondChildProcess.emit('error', error);339 const secondError = await t.throwsAsync(secondChildProcess);340341 const firstCommand = `${fixtureName} ${firstArgument}`;342 const firstMessage = `Command failed: ${firstCommand}\n${foobarString}`;343 t.is(firstError, error);344 t.is(firstError.command, firstCommand);345 t.is(firstError.message, firstMessage);346 t.true(firstError.stack.includes(firstMessage));347 t.is(firstError.shortMessage, firstMessage);348 t.is(firstError.originalMessage, originalMessage);349350 const secondCommand = `${fixtureName} ${secondArgument}`;351 const secondMessage = `Command failed: ${secondCommand}\n${foobarString}`;352 t.not(secondError, error);353 t.is(secondError.command, secondCommand);354 t.is(secondError.message, secondMessage);355 t.true(secondError.stack.includes(secondMessage));356 t.is(secondError.shortMessage, secondMessage);357 t.is(secondError.originalMessage, originalMessage);

Revert "Add link to Netlify job description (#439)" (#445)ehmickybefore adoption2706b3f

line 358why, one step back
358});