Skip to content
Myr

forward.js

This file

Path

test/stdio/forward.js

47 lines · 2.4 KiB · JavaScript

Last changed by

Upgrade xo (#980)ehmickybefore adoptionccfa412

History of this file

Take it

Split files (#837)ehmickybefore adoption672c2d7

lines 1–3why, one step back
1import test from 'ava';
2import {execa} from '../../index.js';3import {getStdio} from '../helpers/stdio.js';

Upgrade xo (#980)ehmickybefore adoptionccfa412

line 4why, one step back
4import {setFixtureDirectory} from '../helpers/fixtures-directory.js';

Fix `stdio: [..., undefined]` option (#948)ehmickybefore adoption96d2ef7

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

Split files (#837)ehmickybefore adoption672c2d7

line 6why, one step back
6

Upgrade xo (#980)ehmickybefore adoptionccfa412

line 7why, one step back
7setFixtureDirectory();

Split files (#837)ehmickybefore adoption672c2d7

line 8why, one step back
8

Fix `stdio: [..., undefined]` option (#948)ehmickybefore adoption96d2ef7

lines 9–11why, one step back
9const testInputOverlapped = async (t, fdNumber) => {
10 const {stdout} = await execa('stdin-fd.js', [`${fdNumber}`, foobarString], getStdio(fdNumber, [foobarUint8Array, 'overlapped', 'pipe']));11 t.is(stdout, foobarString);

Split files (#837)ehmickybefore adoption672c2d7

lines 12–13why, one step back
12};
13

Fix `stdio: [..., undefined]` option (#948)ehmickybefore adoption96d2ef7

lines 14–37why, one step back
14test('stdin can be ["overlapped", "pipe"]', testInputOverlapped, 0);
15test('stdio[*] input can be ["overlapped", "pipe"]', testInputOverlapped, 3);1617const testOutputOverlapped = async (t, fdNumber) => {18 const {stdio} = await execa('noop-fd.js', [`${fdNumber}`, foobarString], getStdio(fdNumber, ['overlapped', 'pipe']));19 t.is(stdio[fdNumber], foobarString);20};2122test('stdout can be ["overlapped", "pipe"]', testOutputOverlapped, 1);23test('stderr can be ["overlapped", "pipe"]', testOutputOverlapped, 2);24test('stdio[*] output can be ["overlapped", "pipe"]', testOutputOverlapped, 3);2526const testFd3Undefined = async (t, stdioOption, options) => {27 const subprocess = execa('empty.js', {...getStdio(3, stdioOption), ...options});28 t.is(subprocess.stdio.length, 4);29 t.is(subprocess.stdio[3], null);3031 const {stdio} = await subprocess;32 t.is(stdio.length, 4);33 t.is(stdio[3], undefined);34};3536test('stdio[*] undefined means "ignore"', testFd3Undefined, undefined, {});37test('stdio[*] null means "ignore"', testFd3Undefined, null, {});

Fix types for `stdio: [..., undefined]` (#952)ehmickybefore adoption6233874

lines 38–39why, one step back
38test('stdio[*] [undefined] means "ignore"', testFd3Undefined, [undefined], {});
39test('stdio[*] [null] means "ignore"', testFd3Undefined, [null], {});

Fix `stdio: [..., undefined]` option (#948)ehmickybefore adoption96d2ef7

lines 40–41why, one step back
40test('stdio[*] undefined means "ignore", "lines: true"', testFd3Undefined, undefined, {lines: true});
41test('stdio[*] null means "ignore", "lines: true"', testFd3Undefined, null, {lines: true});

Fix types for `stdio: [..., undefined]` (#952)ehmickybefore adoption6233874

lines 42–43why, one step back
42test('stdio[*] [undefined] means "ignore", "lines: true"', testFd3Undefined, [undefined], {lines: true});
43test('stdio[*] [null] means "ignore", "lines: true"', testFd3Undefined, [null], {lines: true});

Fix `stdio: [..., undefined]` option (#948)ehmickybefore adoption96d2ef7

lines 44–45why, one step back
44test('stdio[*] undefined means "ignore", "encoding: hex"', testFd3Undefined, undefined, {encoding: 'hex'});
45test('stdio[*] null means "ignore", "encoding: hex"', testFd3Undefined, null, {encoding: 'hex'});

Fix types for `stdio: [..., undefined]` (#952)ehmickybefore adoption6233874

lines 46–47why, one step back
46test('stdio[*] [undefined] means "ignore", "encoding: hex"', testFd3Undefined, [undefined], {encoding: 'hex'});
47test('stdio[*] [null] means "ignore", "encoding: hex"', testFd3Undefined, [null], {encoding: 'hex'});