Skip to content
Myr

test.js

This file

Path

test.js

450 lines · 12.3 KiB · JavaScript

Last changed by

Meta tweaksSindre Sorhusbefore adoptionc0fc20c

History of this file

Take it

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

line 1why, one step back
1import path from 'path';

Better stdio option handling - fixes #24Sam Verschuerenbefore adoption9cd5e2a

line 2why, one step back
2import fs from 'fs';

add `input` optionJames Talmagebefore adoption605a674

line 3why, one step back
3import stream from 'stream';

add tests (#48)James Talmagebefore adoptionb15483a

line 4why, one step back
4import childProcess from 'child_process';

initSindre Sorhusbefore adoptionbc16d6b

line 5
5import test from 'ava';

make `execa.spawn()` use the same argument normalization as `execa()`Sindre Sorhusbefore adoptiond6e3220

line 6why, one step back
6import getStream from 'get-stream';

Add `cleanup` option (#53)Friedel Ziegelmayerbefore adoptiondbd9acd

lines 7–8why, one step back
7import isRunning from 'is-running';
8import delay from 'delay';

Better stdio option handling - fixes #24Sam Verschuerenbefore adoption9cd5e2a

line 9why, one step back
9import tempfile from 'tempfile';

tweaksSindre Sorhusbefore adoptione3505a8

line 10why, one step back
10import m from './';

initSindre Sorhusbefore adoptionbc16d6b

line 11
11

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

line 12why, one step back
12process.env.PATH = path.join(__dirname, 'fixtures') + path.delimiter + process.env.PATH;

Extend environment by default - fixes #87 (#88)Sam Verschuerenbefore adoptione370117

line 13why, one step back
13process.env.FOO = 'foo';

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

line 14why, one step back
14

initSindre Sorhusbefore adoptionbc16d6b

line 15
15test('execa()', async t => {

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

line 16why, one step back
16 const {stdout} = await m('noop', ['foo']);

initSindre Sorhusbefore adoptionbc16d6b

lines 17–20
17 t.is(stdout, 'foo');
18});1920test('buffer', async t => {

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

line 21why, one step back
21 const {stdout} = await m('noop', ['foo'], {encoding: null});

initSindre Sorhusbefore adoptionbc16d6b

lines 22–25
22 t.true(Buffer.isBuffer(stdout));
23 t.is(stdout.toString(), 'foo');24});25

add `execa.stdout()` shortcut (#14)Sindre Sorhusbefore adoption868f505

lines 26–35why, one step back
26test('execa.stdout()', async t => {
27 const stdout = await m.stdout('noop', ['foo']);28 t.is(stdout, 'foo');29});3031test('execa.stderr()', async t => {32 const stderr = await m.stderr('noop-err', ['foo']);33 t.is(stderr, 'foo');34});35

add `stdout`/`stderr` to errorsSindre Sorhusbefore adoption0ea8aaf

line 36why, one step back
36test('stdout/stderr available on errors', async t => {

meta tweaksSindre Sorhusbefore adoption858af26

lines 37–39why, one step back
37 const err = await t.throws(m('exit', ['2']));
38 t.is(typeof err.stdout, 'string');39 t.is(typeof err.stderr, 'string');

add `stdout`/`stderr` to errorsSindre Sorhusbefore adoption0ea8aaf

lines 40–41why, one step back
40});
41

add tests (#48)James Talmagebefore adoptionb15483a

line 42why, one step back
42test('include stdout and stderr in errors for improved debugging', async t => {

Use spawn instead of execFile (#27)James Talmagebefore adoption31a8d87

lines 43–44why, one step back
43 const err = await t.throws(m('fixtures/error-message.js'));
44 t.regex(err.message, /stdout/);

add tests (#48)James Talmagebefore adoptionb15483a

line 45why, one step back
45 t.regex(err.message, /stderr/);

Fix test for exit code 1 on windows (#78)Sam Verschuerenbefore adoption4231a10

line 46why, one step back
46 t.is(err.code, 1);

include stdout in errors for improved debuggingSindre Sorhusbefore adoptionaea8c9a

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

Do not output stderr and stdout on stdio inherit - fixes #70 (#79)Sam Verschuerenbefore adoption2a12986

lines 49–50why, one step back
49test('do not include in errors when `stdio` is set to `inherit`', async t => {
50 const err = await t.throws(m('fixtures/error-message.js', {stdio: 'inherit'}));

Better stdio option handling - fixes #24Sam Verschuerenbefore adoption9cd5e2a

lines 51–85why, one step back
51 t.notRegex(err.message, /\n/);
52});5354test('do not include `stderr` and `stdout` in errors when set to `inherit`', async t => {55 const err = await t.throws(m('fixtures/error-message.js', {stdout: 'inherit', stderr: 'inherit'}));56 t.notRegex(err.message, /\n/);57});5859test('do not include `stderr` and `stdout` in errors when `stdio` is set to `inherit`', async t => {60 const err = await t.throws(m('fixtures/error-message.js', {stdio: [null, 'inherit', 'inherit']}));61 t.notRegex(err.message, /\n/);62});6364test('do not include `stdout` in errors when set to `inherit`', async t => {65 const err = await t.throws(m('fixtures/error-message.js', {stdout: 'inherit'}));66 t.notRegex(err.message, /stdout/);67 t.regex(err.message, /stderr/);68});6970test('do not include `stderr` in errors when set to `inherit`', async t => {71 const err = await t.throws(m('fixtures/error-message.js', {stderr: 'inherit'}));72 t.regex(err.message, /stdout/);73 t.notRegex(err.message, /stderr/);74});7576test('pass `stdout` to a file descriptor', async t => {77 const file = tempfile('.txt');78 await m('fixtures/noop', ['foo bar'], {stdout: fs.openSync(file, 'w')});79 t.is(fs.readFileSync(file, 'utf8'), 'foo bar\n');80});8182test('pass `stderr` to a file descriptor', async t => {83 const file = tempfile('.txt');84 await m('fixtures/noop-err', ['foo bar'], {stderr: fs.openSync(file, 'w')});85 t.is(fs.readFileSync(file, 'utf8'), 'foo bar\n');

Do not output stderr and stdout on stdio inherit - fixes #70 (#79)Sam Verschuerenbefore adoption2a12986

lines 86–87why, one step back
86});
87

Merge pull request #3 from sindresorhus/local-binsSindre Sorhusbefore adoptiona0c035c

line 88why, one step back
88test('execa.shell()', async t => {

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

line 89why, one step back
89 const {stdout} = await m.shell('node fixtures/noop foo');

Merge pull request #3 from sindresorhus/local-binsSindre Sorhusbefore adoptiona0c035c

lines 90–92why, one step back
90 t.is(stdout, 'foo');
91});92

make `execa.spawn()` use the same argument normalization as `execa()`Sindre Sorhusbefore adoptiond6e3220

line 93why, one step back
93test('execa.spawn()', async t => {

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

lines 94–95why, one step back
94 t.is(typeof m.spawn('noop').pid, 'number');
95 t.is((await getStream(m.spawn('noop', ['foo']).stdout)).trim(), 'foo');

expose `.spawn`Sindre Sorhusbefore adoptionb65479c

lines 96–97why, one step back
96});
97

add `execa.sync()` (#7)Sindre Sorhusbefore adoption9345d2c

line 98why, one step back
98test('execa.sync()', t => {

[BREAKING] for consistency return a result object from `execa.sync()` instead of string (#22)James Talmagebefore adoptiona8f2100

line 99why, one step back
99 const {stdout} = m.sync('noop', ['foo']);

add `execa.sync()` (#7)Sindre Sorhusbefore adoption9345d2c

lines 100–102why, one step back
100 t.is(stdout, 'foo');
101});102

Throw error in sync method - fixes #66 (#67)Sam Verschuerenbefore adoptionc8c9c7b

lines 103–106why, one step back
103test('execa.sync() throws error if written to stderr', t => {
104 t.throws(() => m.sync('foo'), process.platform === 'win32' ? /'foo' is not recognized as an internal or external command/ : 'spawnSync foo ENOENT');105});106

add `execa.shellSync()`Sindre Sorhusbefore adoption71a58ee

line 107why, one step back
107test('execa.shellSync()', t => {

[BREAKING] for consistency return a result object from `execa.sync()` instead of string (#22)James Talmagebefore adoptiona8f2100

line 108why, one step back
108 const {stdout} = m.shellSync('node fixtures/noop foo');

add `execa.shellSync()`Sindre Sorhusbefore adoption71a58ee

lines 109–111why, one step back
109 t.is(stdout, 'foo');
110});111

initSindre Sorhusbefore adoptionbc16d6b

line 112
112test('stripEof option', async t => {

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

line 113why, one step back
113 const {stdout} = await m('noop', ['foo'], {stripEof: false});

initSindre Sorhusbefore adoptionbc16d6b

lines 114–116
114 t.is(stdout, 'foo\n');
115});116

Merge pull request #3 from sindresorhus/local-binsSindre Sorhusbefore adoptiona0c035c

line 117why, one step back
117test.serial('preferLocal option', async t => {

tweaksSindre Sorhusbefore adoptione3505a8

line 118why, one step back
118 t.true((await m('cat-names')).stdout.length > 2);

Merge pull request #3 from sindresorhus/local-binsSindre Sorhusbefore adoptiona0c035c

line 119why, one step back
119

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

lines 120–124why, one step back
120 if (process.platform === 'win32') {
121 // TODO: figure out how to make the below not hang on Windows122 return;123 }124

Fix linting (#77)Sam Verschuerenbefore adoption80a059d

line 125why, one step back
125 // Account for npm adding local binaries to the PATH

Merge pull request #3 from sindresorhus/local-binsSindre Sorhusbefore adoptiona0c035c

lines 126–127why, one step back
126 const _path = process.env.PATH;
127 process.env.PATH = '';

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

line 128why, one step back
128 await t.throws(m('cat-names', {preferLocal: false}), /spawn .* ENOENT/);

Merge pull request #3 from sindresorhus/local-binsSindre Sorhusbefore adoptiona0c035c

line 129why, one step back
129 process.env.PATH = _path;

add `input` optionJames Talmagebefore adoption605a674

lines 130–131why, one step back
130});
131

Add test for #73Sindre Sorhusbefore adoptionc7481f4

lines 132–139why, one step back
132test('localDir option', async t => {
133 const cwd = 'fixtures/local-dir';134 const bin = path.resolve(cwd, 'node_modules/.bin/self-path');135136 await m('npm', ['install', '--no-package-lock'], {cwd});137138 const {stdout} = await m(bin, {localDir: cwd});139

Meta tweaksSindre Sorhusbefore adoptionc0fc20c

line 140why, one step back
140 t.is(path.relative(cwd, stdout), path.normalize('node_modules/self-path'));

Add test for #73Sindre Sorhusbefore adoptionc7481f4

lines 141–142why, one step back
141});
142

add `input` optionJames Talmagebefore adoption605a674

line 143why, one step back
143test('input option can be a String', async t => {

fix option handling in #15Sindre Sorhusbefore adoption3d31e8d

line 144why, one step back
144 const {stdout} = await m('stdin', {input: 'foobar'});

add `input` optionJames Talmagebefore adoption605a674

lines 145–148why, one step back
145 t.is(stdout, 'foobar');
146});147148test('input option can be a Buffer', async t => {

fix option handling in #15Sindre Sorhusbefore adoption3d31e8d

line 149why, one step back
149 const {stdout} = await m('stdin', {input: 'testing12'});

add `input` optionJames Talmagebefore adoption605a674

lines 150–153why, one step back
150 t.is(stdout, 'testing12');
151});152153test('input can be a Stream', async t => {

[BREAKING] ES2015ify and require Node.js 4Sindre Sorhusbefore adoption8a7a51c

line 154why, one step back
154 const s = new stream.PassThrough();

add `input` optionJames Talmagebefore adoption605a674

lines 155–156why, one step back
155 s.write('howdy');
156 s.end();

fix option handling in #15Sindre Sorhusbefore adoption3d31e8d

line 157why, one step back
157 const {stdout} = await m('stdin', {input: s});

add `input` optionJames Talmagebefore adoption605a674

lines 158–160why, one step back
158 t.is(stdout, 'howdy');
159});160

return the child process instead of a promise. (#18)James Talmagebefore adoption99f10ba

lines 161–166why, one step back
161test('you can write to child.stdin', async t => {
162 const child = m('stdin');163 child.stdin.end('unicorns');164 t.is((await child).stdout, 'unicorns');165});166

Fix linting (#77)Sam Verschuerenbefore adoption80a059d

line 167why, one step back
167test('input option can be a String - sync', t => {

[BREAKING] for consistency return a result object from `execa.sync()` instead of string (#22)James Talmagebefore adoptiona8f2100

line 168why, one step back
168 const {stdout} = m.sync('stdin', {input: 'foobar'});

add `input` optionJames Talmagebefore adoption605a674

lines 169–171why, one step back
169 t.is(stdout, 'foobar');
170});171

Fix linting (#77)Sam Verschuerenbefore adoption80a059d

lines 172–173why, one step back
172test('input option can be a Buffer - sync', t => {
173 const {stdout} = m.sync('stdin', {input: Buffer.from('testing12', 'utf8')});

add `input` optionJames Talmagebefore adoption605a674

line 174why, one step back
174 t.is(stdout, 'testing12');

Use spawn instead of execFile (#27)James Talmagebefore adoption31a8d87

lines 175–177why, one step back
175});
176177test('opts.stdout:ignore - stdout will not collect data', async t => {

fix XO lint issuesSindre Sorhusbefore adoption342096c

lines 178–181why, one step back
178 const {stdout} = await m('stdin', {
179 input: 'hello',180 stdio: [null, 'ignore', null]181 });

Use spawn instead of execFile (#27)James Talmagebefore adoption31a8d87

line 182why, one step back
182 t.is(stdout, null);

add `input` optionJames Talmagebefore adoption605a674

lines 183–186why, one step back
183});
184185test('helpful error trying to provide an input stream in sync mode', t => {186 t.throws(

fix option handling in #15Sindre Sorhusbefore adoption3d31e8d

line 187why, one step back
187 () => m.sync('stdin', {input: new stream.PassThrough()}),

add `input` optionJames Talmagebefore adoption605a674

lines 188–189why, one step back
188 /The `input` option cannot be a stream in sync mode/
189 );

Attach pid and kill() to returned promise (#11)Luke Horvatbefore adoption9da5484

lines 190–192why, one step back
190});
191192test('execa() returns a promise with kill() and pid', t => {

fix tests on Windows 💩Sindre Sorhusbefore adoption14f16df

line 193why, one step back
193 const promise = m('noop', ['foo']);

Attach pid and kill() to returned promise (#11)Luke Horvatbefore adoption9da5484

lines 194–195why, one step back
194 t.is(typeof promise.kill, 'function');
195 t.is(typeof promise.pid, 'number');

initSindre Sorhusbefore adoptionbc16d6b

line 196
196});

add max-buffer support (#37)James Talmagebefore adoption6288806

line 197why, one step back
197

Fix tests (#89)Sam Verschuerenbefore adoption1861b5e

lines 198–200why, one step back
198test('maxBuffer affects stdout', async t => {
199 await t.throws(m('max-buffer', ['stdout', '11'], {maxBuffer: 10}), /stdout maxBuffer exceeded/);200 await t.notThrows(m('max-buffer', ['stdout', '10'], {maxBuffer: 10}));

add max-buffer support (#37)James Talmagebefore adoption6288806

lines 201–202why, one step back
201});
202

Fix tests (#89)Sam Verschuerenbefore adoption1861b5e

lines 203–205why, one step back
203test('maxBuffer affects stderr', async t => {
204 await t.throws(m('max-buffer', ['stderr', '13'], {maxBuffer: 12}), /stderr maxBuffer exceeded/);205 await t.notThrows(m('max-buffer', ['stderr', '12'], {maxBuffer: 12}));

add max-buffer support (#37)James Talmagebefore adoption6288806

line 206why, one step back
206});

Add `reject` option (#40)Kevin Mårtenssonbefore adoption9bafd76

lines 207–208why, one step back
207
208test('skip throwing when using reject option', async t => {

Fix tests (#89)Sam Verschuerenbefore adoption1861b5e

line 209why, one step back
209 const err = await m('exit', ['2'], {reject: false});

Add `reject` option (#40)Kevin Mårtenssonbefore adoption9bafd76

lines 210–221why, one step back
210 t.is(typeof err.stdout, 'string');
211 t.is(typeof err.stderr, 'string');212});213214test('execa() returns code and failed properties', async t => {215 const {code, failed} = await m('noop', ['foo']);216 const err = await t.throws(m('exit', ['2']));217 t.is(code, 0);218 t.false(failed);219 t.is(err.code, 2);220 t.true(err.failed);221});

Add test for `../` paths (#43)James Talmagebefore adoption56a20b1

lines 222–227why, one step back
222
223test(`use relative path with '..' chars`, async t => {224 const pathViaParentDir = path.join('..', path.basename(__dirname), 'fixtures', 'noop');225 const {stdout} = await m(pathViaParentDir, ['foo']);226 t.is(stdout, 'foo');227});

add tests (#48)James Talmagebefore adoptionb15483a

line 228why, one step back
228

add test case for throwing on non-executables (#49)Markus Wolfbefore adoptione10d263

line 229why, one step back
229if (process.platform !== 'win32') {

Fix tests (#89)Sam Verschuerenbefore adoption1861b5e

line 230why, one step back
230 test('execa() rejects if running non-executable', async t => {

ensure `execa` rejects and not throws when the core spawn throws and errorSindre Sorhusbefore adoption03964c1

line 231why, one step back
231 const cp = m('non-executable');

Fix tests (#89)Sam Verschuerenbefore adoption1861b5e

line 232why, one step back
232 await t.throws(cp);

add test case for throwing on non-executables (#49)Markus Wolfbefore adoptione10d263

lines 233–235why, one step back
233 });
234}235

add tests (#48)James Talmagebefore adoptionb15483a

lines 236–238why, one step back
236test('err.killed is true if process was killed directly', async t => {
237 const cp = m('forever');238

[BREAKING] ES2015ify and require Node.js 4Sindre Sorhusbefore adoption8a7a51c

line 239why, one step back
239 setTimeout(() => {

add tests (#48)James Talmagebefore adoptionb15483a

lines 240–251why, one step back
240 cp.kill();
241 }, 100);242243 const err = await t.throws(cp);244245 t.true(err.killed);246});247248// TODO: Should this really be the case, or should we improve on child_process?249test('err.killed is false if process was killed indirectly', async t => {250 const cp = m('forever');251

[BREAKING] ES2015ify and require Node.js 4Sindre Sorhusbefore adoption8a7a51c

line 252why, one step back
252 setTimeout(() => {

add tests (#48)James Talmagebefore adoptionb15483a

lines 253–268why, one step back
253 process.kill(cp.pid, 'SIGINT');
254 }, 100);255256 const err = await t.throws(cp);257258 t.false(err.killed);259});260261if (process.platform === 'darwin') {262 test.cb('sanity check: child_process.exec also has killed.false if killed indirectly', t => {263 const cp = childProcess.exec('forever', err => {264 t.truthy(err);265 t.false(err.killed);266 t.end();267 });268

[BREAKING] ES2015ify and require Node.js 4Sindre Sorhusbefore adoption8a7a51c

line 269why, one step back
269 setTimeout(() => {

add tests (#48)James Talmagebefore adoptionb15483a

lines 270–278why, one step back
270 process.kill(cp.pid, 'SIGINT');
271 }, 100);272 });273}274275if (process.platform !== 'win32') {276 test('err.signal is SIGINT', async t => {277 const cp = m('forever');278

[BREAKING] ES2015ify and require Node.js 4Sindre Sorhusbefore adoption8a7a51c

line 279why, one step back
279 setTimeout(() => {

add tests (#48)James Talmagebefore adoptionb15483a

lines 280–290why, one step back
280 process.kill(cp.pid, 'SIGINT');
281 }, 100);282283 const err = await t.throws(cp);284285 t.is(err.signal, 'SIGINT');286 });287288 test('err.signal is SIGTERM', async t => {289 const cp = m('forever');290

[BREAKING] ES2015ify and require Node.js 4Sindre Sorhusbefore adoption8a7a51c

line 291why, one step back
291 setTimeout(() => {

add tests (#48)James Talmagebefore adoptionb15483a

lines 292–298why, one step back
292 process.kill(cp.pid, 'SIGTERM');
293 }, 100);294295 const err = await t.throws(cp);296297 t.is(err.signal, 'SIGTERM');298 });

Fix `killSignal` option (#93)Kevin Mårtenssonbefore adoption2cbcc5c

lines 299–304why, one step back
299
300 test('custom err.signal', async t => {301 const err = await t.throws(m('delay', ['3000', '0'], {killSignal: 'SIGHUP', timeout: 1500}));302303 t.is(err.signal, 'SIGHUP');304 });

add tests (#48)James Talmagebefore adoptionb15483a

lines 305–325why, one step back
305}
306307test('result.signal is null for successful execution', async t => {308 t.is((await m('noop')).signal, null);309});310311test('result.signal is null if process failed, but was not killed', async t => {312 const err = await t.throws(m('exit', [2]));313 t.is(err.signal, null);314});315316async function code(t, num) {317 const err = await t.throws(m('exit', [`${num}`]));318319 t.is(err.code, num);320}321322test('err.code is 2', code, 2);323test('err.code is 3', code, 3);324test('err.code is 4', code, 4);325

Reimplement missing features. Fixes #30 & #32 (#68)James Talmagebefore adoptione96350d

lines 326–351why, one step back
326test('timeout will kill the process early', async t => {
327 const err = await t.throws(m('delay', ['3000', '0'], {timeout: 1500}));328329 t.true(err.timedOut);330 t.not(err.code, 22);331});332333test('timeout will not kill the process early', async t => {334 const err = await t.throws(m('delay', ['3000', '22'], {timeout: 9000}));335336 t.false(err.timedOut);337 t.is(err.code, 22);338});339340test('timedOut will be false if no timeout was set and zero exit code', async t => {341 const result = await m('delay', ['1000', '0']);342343 t.false(result.timedOut);344});345346test('timedOut will be false if no timeout was set and non-zero exit code', async t => {347 const err = await t.throws(m('delay', ['1000', '3']));348349 t.false(err.timedOut);350});351

add tests (#48)James Talmagebefore adoptionb15483a

lines 352–377why, one step back
352async function errorMessage(t, expected, ...args) {
353 const err = await t.throws(m('exit', args));354355 t.regex(err.message, expected);356}357358errorMessage.title = (message, expected) => `err.message matches: ${expected}`;359360test(errorMessage, /Command failed: exit 2 foo bar/, 2, 'foo', 'bar');361test(errorMessage, /Command failed: exit 3 baz quz/, 3, 'baz', 'quz');362363async function cmd(t, expected, ...args) {364 const err = await t.throws(m('fail', args));365366 t.is(err.cmd, `fail${expected}`);367368 const result = await m('noop', args);369370 t.is(result.cmd, `noop${expected}`);371}372373cmd.title = (message, expected) => `cmd is: ${JSON.stringify(expected)}`;374375test(cmd, ' foo bar', 'foo', 'bar');376test(cmd, ' baz quz', 'baz', 'quz');377test(cmd, '');

Add `cleanup` option (#53)Friedel Ziegelmayerbefore adoptiondbd9acd

lines 378–410why, one step back
378
379async function spawnAndKill(t, signal, cleanup) {380 const name = cleanup ? 'sub-process' : 'sub-process-false';381 const cp = m(name);382 let pid;383384 cp.stdout.setEncoding('utf8');385 cp.stdout.on('data', chunk => {386 pid = parseInt(chunk, 10);387 t.is(typeof pid, 'number');388389 setTimeout(() => {390 process.kill(cp.pid, signal);391 }, 100);392 });393394 await t.throws(cp);395396 // Give everybody some time to breath and kill things397 await delay(200);398399 t.false(isRunning(cp.pid));400 t.is(isRunning(pid), !cleanup);401}402403test('cleanup - SIGINT', spawnAndKill, 'SIGINT', true);404test('cleanup - SIGKILL', spawnAndKill, 'SIGTERM', true);405406if (process.platform !== 'win32') {407 // On Windows the subprocesses are actually always killed408 test('cleanup false - SIGINT', spawnAndKill, 'SIGTERM', false);409 test('cleanup false - SIGKILL', spawnAndKill, 'SIGKILL', false);410}

fix support for the `shell` option in `execa.shell()`Sindre Sorhusbefore adoptiona80487b

line 411why, one step back
411

Fix linting (#77)Sam Verschuerenbefore adoption80a059d

line 412why, one step back
412// See: https://github.com/sindresorhus/execa/issues/56

only set to failing test on WindowsSindre Sorhusbefore adoption7d88adc

lines 413–414why, one step back
413const onlyWinFailing = test[process.platform === 'win32' ? 'failing' : 'serial'];
414onlyWinFailing('execa.shell() supports the `shell` option', async t => {

fix support for the `shell` option in `execa.shell()`Sindre Sorhusbefore adoptiona80487b

lines 415–419why, one step back
415 const {stdout} = await m.shell('noop foo', {
416 shell: process.platform === 'win32' ? 'cmd.exe' : '/bin/bash'417 });418 t.is(stdout, 'foo');419});

Attach error listener to stdio stream (#74)Vsevolod Strukchinskybefore adoptiona71bef2

lines 420–422why, one step back
420
421if (process.platform !== 'win32') {422 test('write to fast-exit process', async t => {

Fix linting (#77)Sam Verschuerenbefore adoption80a059d

lines 423–424why, one step back
423 // Try-catch here is necessary, because this test is not 100% accurate
424 // Sometimes process can manage to accept input before exiting

Attach error listener to stdio stream (#74)Vsevolod Strukchinskybefore adoptiona71bef2

lines 425–426why, one step back
425 try {
426 await m(`fast-exit-${process.platform}`, [], {input: 'data'});

Fix tests (#89)Sam Verschuerenbefore adoption1861b5e

line 427why, one step back
427 t.pass();

Attach error listener to stdio stream (#74)Vsevolod Strukchinskybefore adoptiona71bef2

lines 428–432why, one step back
428 } catch (err) {
429 t.is(err.code, 'EPIPE');430 }431 });432}

Extend environment by default - fixes #87 (#88)Sam Verschuerenbefore adoptione370117

lines 433–450why, one step back
433
434test('extend environment variables by default', async t => {435 const result = await m.stdout('environment', [], {env: {BAR: 'bar'}});436437 t.deepEqual(result.split('\n'), [438 'foo',439 'bar'440 ]);441});442443test('do not extend environment with `envExtend` option', async t => {444 const result = await m.stdout('environment', [], {env: {BAR: 'bar', PATH: process.env.PATH}, extendEnv: false});445446 t.deepEqual(result.split('\n'), [447 'undefined',448 'bar'449 ]);450});