Skip to content
Myr

resolve.js

This file

Path

test/stream/resolve.js

49 lines · 1.9 KiB · JavaScript

Last changed by

Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343

History of this file

Take it

Split files (#837)ehmickybefore adoption672c2d7

lines 1–7why, one step back
1import test from 'ava';
2import {execa, execaSync} from '../../index.js';3import {setFixtureDir} from '../helpers/fixtures-dir.js';4import {getStdio} from '../helpers/stdio.js';56setFixtureDir();7

Rename `index` to `fdNumber` (#862)ehmickybefore adoption295ef40

lines 8–10why, one step back
8const testIgnore = async (t, fdNumber, execaMethod) => {
9 const result = await execaMethod('noop.js', getStdio(fdNumber, 'ignore'));10 t.is(result.stdio[fdNumber], undefined);

Split files (#837)ehmickybefore adoption672c2d7

lines 11–19why, one step back
11};
1213test('stdout is undefined if ignored', testIgnore, 1, execa);14test('stderr is undefined if ignored', testIgnore, 2, execa);15test('stdio[*] is undefined if ignored', testIgnore, 3, execa);16test('stdout is undefined if ignored - sync', testIgnore, 1, execaSync);17test('stderr is undefined if ignored - sync', testIgnore, 2, execaSync);18test('stdio[*] is undefined if ignored - sync', testIgnore, 3, execaSync);19

Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343

lines 20–24why, one step back
20const testSubprocessEventsCleanup = async (t, fixtureName) => {
21 const subprocess = execa(fixtureName, {reject: false});22 t.deepEqual(subprocess.eventNames().map(String).sort(), ['Symbol(error)', 'error', 'exit', 'spawn']);23 await subprocess;24 t.deepEqual(subprocess.eventNames(), []);

Split files (#837)ehmickybefore adoption672c2d7

lines 25–26why, one step back
25};
26

Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343

lines 27–28why, one step back
27test('subprocess listeners are cleaned up on success', testSubprocessEventsCleanup, 'empty.js');
28test('subprocess listeners are cleaned up on failure', testSubprocessEventsCleanup, 'fail.js');

Split files (#837)ehmickybefore adoption672c2d7

lines 29–49why, one step back
29
30test('Aborting stdout should not abort stderr nor all', async t => {31 const subprocess = execa('empty.js', {all: true});3233 subprocess.stdout.destroy();34 t.false(subprocess.stdout.readable);35 t.true(subprocess.stderr.readable);36 t.true(subprocess.all.readable);3738 await subprocess;3940 t.false(subprocess.stdout.readableEnded);41 t.is(subprocess.stdout.errored, null);42 t.true(subprocess.stdout.destroyed);43 t.true(subprocess.stderr.readableEnded);44 t.is(subprocess.stderr.errored, null);45 t.true(subprocess.stderr.destroyed);46 t.true(subprocess.all.readableEnded);47 t.is(subprocess.all.errored, null);48 t.true(subprocess.all.destroyed);49});