setup.js
This file
Path
test/pipe/setup.js
28 lines · 1.9 KiB · JavaScript
Last changed by
Upgrade xo (#980)ehmickybefore adoptionccfa412
History of this fileTake it
Improve piping processes (#834)ehmickybefore adoption1a47ea2
lines 1–2why, one step back1import test from 'ava';2import {execa} from '../../index.js';Upgrade xo (#980)ehmickybefore adoptionccfa412
line 3why, one step back3import {setFixtureDirectory} from '../helpers/fixtures-directory.js';Allow piping process to any file descriptor (#903)ehmickybefore adoption6642cd2
lines 4–5why, one step back4import {fullStdio, fullReadableStdio} from '../helpers/stdio.js';5import {foobarString} from '../helpers/input.js';Improve piping processes (#834)ehmickybefore adoption1a47ea2
line 6why, one step back6Upgrade xo (#980)ehmickybefore adoptionccfa412
line 7why, one step back7setFixtureDirectory();Improve piping processes (#834)ehmickybefore adoption1a47ea2
line 8why, one step back8Allow piping process to any file descriptor (#903)ehmickybefore adoption6642cd2
lines 9–13why, one step back9// eslint-disable-next-line max-params10const pipeToSubprocess = async (t, readableFdNumber, writableFdNumber, from, to, readableOptions = {}, writableOptions = {}) => {11 const {stdout} = await execa('noop-fd.js', [`${readableFdNumber}`, foobarString], readableOptions)12 .pipe(execa('stdin-fd.js', [`${writableFdNumber}`], writableOptions), {from, to});13 t.is(stdout, foobarString);Improve piping processes (#834)ehmickybefore adoption1a47ea2
lines 14–15why, one step back14};15Allow piping process to any file descriptor (#903)ehmickybefore adoption6642cd2
lines 16–17why, one step back16test('pipe(...) can pipe', pipeToSubprocess, 1, 0);17test('pipe(..., {from: "stdout"}) can pipe', pipeToSubprocess, 1, 0, 'stdout');Rename `from|to: 3` to `from|to: 'fd3'` (#920)ehmickybefore adoption8dfdd91
line 18why, one step back18test('pipe(..., {from: "fd1"}) can pipe', pipeToSubprocess, 1, 0, 'fd1');Allow piping process to any file descriptor (#903)ehmickybefore adoption6642cd2
line 19why, one step back19test('pipe(..., {from: "stderr"}) can pipe stderr', pipeToSubprocess, 2, 0, 'stderr');Rename `from|to: 3` to `from|to: 'fd3'` (#920)ehmickybefore adoption8dfdd91
lines 20–21why, one step back20test('pipe(..., {from: "fd2"}) can pipe', pipeToSubprocess, 2, 0, 'fd2');21test('pipe(..., {from: "fd3"}) can pipe', pipeToSubprocess, 3, 0, 'fd3', undefined, fullStdio);Allow piping process to any file descriptor (#903)ehmickybefore adoption6642cd2
lines 22–26why, one step back22test('pipe(..., {from: "all"}) can pipe stdout', pipeToSubprocess, 1, 0, 'all', undefined, {all: true});23test('pipe(..., {from: "all"}) can pipe stderr', pipeToSubprocess, 2, 0, 'all', undefined, {all: true});24test('pipe(..., {from: "all"}) can pipe stdout even with "stderr: ignore"', pipeToSubprocess, 1, 0, 'all', undefined, {all: true, stderr: 'ignore'});25test('pipe(..., {from: "all"}) can pipe stderr even with "stdout: ignore"', pipeToSubprocess, 2, 0, 'all', undefined, {all: true, stdout: 'ignore'});26test('pipe(..., {to: "stdin"}) can pipe', pipeToSubprocess, 1, 0, undefined, 'stdin');Rename `from|to: 3` to `from|to: 'fd3'` (#920)ehmickybefore adoption8dfdd91
lines 27–28why, one step back27test('pipe(..., {to: "fd0"}) can pipe', pipeToSubprocess, 1, 0, undefined, 'fd0');28test('pipe(..., {to: "fd3"}) can pipe', pipeToSubprocess, 1, 3, undefined, 'fd3', {}, fullReadableStdio());