Skip to content
Myr

no-buffer.js

This file

Path

test/resolve/no-buffer.js

261 lines · 15.5 KiB · JavaScript

Last changed by

TweaksSindre Sorhusbefore adoption698a1b8

History of this file

Take it

The walk stopped after 200 commits: lines older than 9f65b86 point at it.

TweaksSindre Sorhusbefore adoption698a1b8

line 1why, one step back
1import assert from 'node:assert/strict';

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 2why, one step back
2import {once} from 'node:events';

TweaksSindre Sorhusbefore adoption698a1b8

line 3why, one step back
3import test from 'node:test';

100% test coverage (#1018)ehmickybefore adoption9f65b86

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

TweaksSindre Sorhusbefore adoption698a1b8

line 5why, one step back
5import {assertRejects, assertLike} from '../helpers/assert.js';

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 6–7why, one step back
6import {execa, execaSync} from '../../index.js';
7import {setFixtureDirectory} from '../helpers/fixtures-directory.js';

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

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

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 9–13why, one step back
9import {foobarString, foobarUppercase, foobarUppercaseUint8Array} from '../helpers/input.js';
10import {resultGenerator, uppercaseGenerator, uppercaseBufferGenerator} from '../helpers/generator.js';1112setFixtureDirectory();13

TweaksSindre Sorhusbefore adoption698a1b8

line 14why, one step back
14const testLateStream = async (fdNumber, all) => {

Add promise-based IPC (#1059)ehmickybefore adoptionacc2b68

lines 15–21why, one step back
15 const subprocess = execa('noop-fd-ipc.js', [`${fdNumber}`, foobarString], {
16 ...fullStdio,17 ipc: true,18 buffer: false,19 all,20 });21 await subprocess.getOneMessage();

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 22–27why, one step back
22 const [output, allOutput] = await Promise.all([
23 getStream(subprocess.stdio[fdNumber]),24 all ? getStream(subprocess.all) : undefined,25 subprocess,26 ]);27

TweaksSindre Sorhusbefore adoption698a1b8

line 28why, one step back
28 assert.equal(output, '');

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 29–30why, one step back
29
30 if (all) {

TweaksSindre Sorhusbefore adoption698a1b8

line 31why, one step back
31 assert.equal(allOutput, '');

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 32–34why, one step back
32 }
33};34

TweaksSindre Sorhusbefore adoption698a1b8

lines 35–38why, one step back
35test('Lacks some data when stdout is read too late `buffer` set to `false`', () => testLateStream(1, false));
36test('Lacks some data when stderr is read too late `buffer` set to `false`', () => testLateStream(2, false));37test('Lacks some data when stdio[*] is read too late `buffer` set to `false`', () => testLateStream(3, false));38test('Lacks some data when all is read too late `buffer` set to `false`', () => testLateStream(1, true));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 39–44why, one step back
39
40const getFirstDataEvent = async stream => {41 const [output] = await once(stream, 'data');42 return output.toString();43};44

TweaksSindre Sorhusbefore adoption698a1b8

line 45why, one step back
45const testIterationBuffer = async (fdNumber, buffer, useDataEvents, all) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 46–55why, one step back
46 const subprocess = execa('noop-fd.js', [`${fdNumber}`, foobarString], {...fullStdio, buffer, all});
47 const getOutput = useDataEvents ? getFirstDataEvent : getStream;48 const [result, output, allOutput] = await Promise.all([49 subprocess,50 getOutput(subprocess.stdio[fdNumber]),51 all ? getOutput(subprocess.all) : undefined,52 ]);5354 const expectedResult = buffer ? foobarString : undefined;55

TweaksSindre Sorhusbefore adoption698a1b8

lines 56–57why, one step back
56 assert.equal(result.stdio[fdNumber], expectedResult);
57 assert.equal(output, foobarString);

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 58why, one step back
58

TweaksSindre Sorhusbefore adoption698a1b8

lines 59–60why, one step back
59 if (!all) {
60 return;

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 61why, one step back
61 }

TweaksSindre Sorhusbefore adoption698a1b8

lines 62–64why, one step back
62
63 assert.equal(result.all, expectedResult);64 assert.equal(allOutput, foobarString);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 65–66why, one step back
65};
66

TweaksSindre Sorhusbefore adoption698a1b8

lines 67–82why, one step back
67test('Can iterate stdout when `buffer` set to `false`', () => testIterationBuffer(1, false, false, false));
68test('Can iterate stderr when `buffer` set to `false`', () => testIterationBuffer(2, false, false, false));69test('Can iterate stdio[*] when `buffer` set to `false`', () => testIterationBuffer(3, false, false, false));70test('Can iterate all when `buffer` set to `false`', () => testIterationBuffer(1, false, false, true));71test('Can iterate stdout when `buffer` set to `true`', () => testIterationBuffer(1, true, false, false));72test('Can iterate stderr when `buffer` set to `true`', () => testIterationBuffer(2, true, false, false));73test('Can iterate stdio[*] when `buffer` set to `true`', () => testIterationBuffer(3, true, false, false));74test('Can iterate all when `buffer` set to `true`', () => testIterationBuffer(1, true, false, true));75test('Can listen to `data` events on stdout when `buffer` set to `false`', () => testIterationBuffer(1, false, true, false));76test('Can listen to `data` events on stderr when `buffer` set to `false`', () => testIterationBuffer(2, false, true, false));77test('Can listen to `data` events on stdio[*] when `buffer` set to `false`', () => testIterationBuffer(3, false, true, false));78test('Can listen to `data` events on all when `buffer` set to `false`', () => testIterationBuffer(1, false, true, true));79test('Can listen to `data` events on stdout when `buffer` set to `true`', () => testIterationBuffer(1, true, true, false));80test('Can listen to `data` events on stderr when `buffer` set to `true`', () => testIterationBuffer(2, true, true, false));81test('Can listen to `data` events on stdio[*] when `buffer` set to `true`', () => testIterationBuffer(3, true, true, false));82test('Can listen to `data` events on all when `buffer` set to `true`', () => testIterationBuffer(1, true, true, true));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 83why, one step back
83

TweaksSindre Sorhusbefore adoption698a1b8

line 84why, one step back
84const testNoBufferStreamError = async (fdNumber, all) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 85–88why, one step back
85 const subprocess = execa('noop-fd.js', [`${fdNumber}`], {...fullStdio, buffer: false, all});
86 const stream = all ? subprocess.all : subprocess.stdio[fdNumber];87 const cause = new Error('test');88 stream.destroy(cause);

TweaksSindre Sorhusbefore adoption698a1b8

line 89why, one step back
89 assertLike(await assertRejects(subprocess), {cause});

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 90–91why, one step back
90};
91

TweaksSindre Sorhusbefore adoption698a1b8

lines 92–95why, one step back
92test('Listen to stdout errors even when `buffer` is `false`', () => testNoBufferStreamError(1, false));
93test('Listen to stderr errors even when `buffer` is `false`', () => testNoBufferStreamError(2, false));94test('Listen to stdio[*] errors even when `buffer` is `false`', () => testNoBufferStreamError(3, false));95test('Listen to all errors even when `buffer` is `false`', () => testNoBufferStreamError(1, true));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 96why, one step back
96

TweaksSindre Sorhusbefore adoption698a1b8

line 97why, one step back
97const testOutput = async (buffer, execaMethod) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 98why, one step back
98 const {stdout} = await execaMethod('noop-fd.js', ['1', foobarString], {buffer});

TweaksSindre Sorhusbefore adoption698a1b8

line 99why, one step back
99 assert.equal(stdout, foobarString);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 100–101why, one step back
100};
101

TweaksSindre Sorhusbefore adoption698a1b8

lines 102–105why, one step back
102test('buffer: true returns output', () => testOutput(true, execa));
103test('buffer: true returns output, fd-specific', () => testOutput({stderr: false}, execa));104test('buffer: default returns output', () => testOutput(undefined, execa));105test('buffer: default returns output, fd-specific', () => testOutput({}, execa));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 106why, one step back
106

TweaksSindre Sorhusbefore adoption698a1b8

line 107why, one step back
107const testNoOutput = async (stdioOption, buffer, execaMethod) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 108why, one step back
108 const {stdout} = await execaMethod('noop.js', {stdout: stdioOption, buffer});

TweaksSindre Sorhusbefore adoption698a1b8

line 109why, one step back
109 assert.equal(stdout, undefined);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 110–111why, one step back
110};
111

TweaksSindre Sorhusbefore adoption698a1b8

lines 112–127why, one step back
112test('buffer: false does not return output', () => testNoOutput('pipe', false, execa));
113test('buffer: false does not return output, fd-specific', () => testNoOutput('pipe', {stdout: false}, execa));114test('buffer: false does not return output, stdout undefined', () => testNoOutput(undefined, false, execa));115test('buffer: false does not return output, stdout null', () => testNoOutput(null, false, execa));116test('buffer: false does not return output, stdout ["pipe"]', () => testNoOutput(['pipe'], false, execa));117test('buffer: false does not return output, stdout [undefined]', () => testNoOutput([undefined], false, execa));118test('buffer: false does not return output, stdout [null]', () => testNoOutput([null], false, execa));119test('buffer: false does not return output, stdout ["pipe", undefined]', () => testNoOutput(['pipe', undefined], false, execa));120test('buffer: false does not return output, sync', () => testNoOutput('pipe', false, execaSync));121test('buffer: false does not return output, fd-specific, sync', () => testNoOutput('pipe', {stdout: false}, execaSync));122test('buffer: false does not return output, stdout undefined, sync', () => testNoOutput(undefined, false, execaSync));123test('buffer: false does not return output, stdout null, sync', () => testNoOutput(null, false, execaSync));124test('buffer: false does not return output, stdout ["pipe"], sync', () => testNoOutput(['pipe'], false, execaSync));125test('buffer: false does not return output, stdout [undefined], sync', () => testNoOutput([undefined], false, execaSync));126test('buffer: false does not return output, stdout [null], sync', () => testNoOutput([null], false, execaSync));127test('buffer: false does not return output, stdout ["pipe", undefined], sync', () => testNoOutput(['pipe', undefined], false, execaSync));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 128why, one step back
128

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

lines 129–133why, one step back
129/*
130With `buffer: false`, additional file descriptors must still be passed to the subprocess.131With synchronous methods, `ignore` is used to avoid buffering, but that only redirects `stdout`/`stderr` to `/dev/null`.132For other file descriptors, it does not pass them at all, which would make the subprocess fail when writing to them.133*/

TweaksSindre Sorhusbefore adoption698a1b8

line 134why, one step back
134const testNoOutputFdStays = async (buffer, execaMethod) => {

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

line 135why, one step back
135 const {stdio, failed} = await execaMethod('noop-fd.js', ['3', foobarString], {...fullStdio, buffer});

TweaksSindre Sorhusbefore adoption698a1b8

lines 136–137why, one step back
136 assert.equal(failed, false);
137 assert.equal(stdio[3], undefined);

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

lines 138–139why, one step back
138};
139

TweaksSindre Sorhusbefore adoption698a1b8

lines 140–143why, one step back
140test('buffer: false keeps stdio[*] open', () => testNoOutputFdStays(false, execa));
141test('buffer: false keeps stdio[*] open, fd-specific', () => testNoOutputFdStays({fd3: false}, execa));142test('buffer: false keeps stdio[*] open, sync', () => testNoOutputFdStays(false, execaSync));143test('buffer: false keeps stdio[*] open, fd-specific, sync', () => testNoOutputFdStays({fd3: false}, execaSync));

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

line 144why, one step back
144

TweaksSindre Sorhusbefore adoption698a1b8

line 145why, one step back
145const testNoOutputFail = async execaMethod => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 146why, one step back
146 const {exitCode, stdout} = await execaMethod('fail.js', {buffer: false, reject: false});

TweaksSindre Sorhusbefore adoption698a1b8

lines 147–148why, one step back
147 assert.equal(exitCode, 2);
148 assert.equal(stdout, undefined);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 149–150why, one step back
149};
150

TweaksSindre Sorhusbefore adoption698a1b8

lines 151–152why, one step back
151test('buffer: false does not return output, failure', () => testNoOutputFail(execa));
152test('buffer: false does not return output, failure, sync', () => testNoOutputFail(execaSync));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 153why, one step back
153

TweaksSindre Sorhusbefore adoption698a1b8

line 154why, one step back
154const testNoOutputAll = async (buffer, bufferStdout, bufferStderr, execaMethod) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 155why, one step back
155 const {stdout, stderr, all} = await execaMethod('noop-both.js', {all: true, buffer, stripFinalNewline: false});

TweaksSindre Sorhusbefore adoption698a1b8

lines 156–157why, one step back
156 assert.equal(stdout, bufferStdout ? `${foobarString}\n` : undefined);
157 assert.equal(stderr, bufferStderr ? `${foobarString}\n` : undefined);

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 158why, one step back
158 const stdoutStderr = [stdout, stderr].filter(Boolean);

TweaksSindre Sorhusbefore adoption698a1b8

line 159why, one step back
159 assert.equal(all, stdoutStderr.length === 0 ? undefined : stdoutStderr.join(''));

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 160–161why, one step back
160};
161

TweaksSindre Sorhusbefore adoption698a1b8

lines 162–169why, one step back
162test('buffer: {}, all: true', () => testNoOutputAll({}, true, true, execa));
163test('buffer: {stdout: false}, all: true', () => testNoOutputAll({stdout: false}, false, true, execa));164test('buffer: {stderr: false}, all: true', () => testNoOutputAll({stderr: false}, true, false, execa));165test('buffer: {all: false}, all: true', () => testNoOutputAll({all: false}, false, false, execa));166test('buffer: {}, all: true, sync', () => testNoOutputAll({}, true, true, execaSync));167test('buffer: {stdout: false}, all: true, sync', () => testNoOutputAll({stdout: false}, false, true, execaSync));168test('buffer: {stderr: false}, all: true, sync', () => testNoOutputAll({stderr: false}, true, false, execaSync));169test('buffer: {all: false}, all: true, sync', () => testNoOutputAll({all: false}, false, false, execaSync));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 170why, one step back
170

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

line 171why, one step back
171// `result.all` only contains the buffered file descriptors, so its `stripFinalNewline` must only follow those

TweaksSindre Sorhusbefore adoption698a1b8

line 172why, one step back
172const testNoOutputAllStripFinalNewline = async (buffer, stripFinalNewline, execaMethod) => {

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

line 173why, one step back
173 const {all} = await execaMethod('noop-both.js', {all: true, buffer, stripFinalNewline});

TweaksSindre Sorhusbefore adoption698a1b8

line 174why, one step back
174 assert.equal(all, `${foobarString}\n`);

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

lines 175–176why, one step back
175};
176

TweaksSindre Sorhusbefore adoption698a1b8

lines 177–180why, one step back
177test('buffer: {stderr: false} only follows the buffered "stripFinalNewline" in result.all', () => testNoOutputAllStripFinalNewline({stderr: false}, {stdout: false, stderr: true}, execa));
178test('buffer: {stdout: false} only follows the buffered "stripFinalNewline" in result.all', () => testNoOutputAllStripFinalNewline({stdout: false}, {stdout: true, stderr: false}, execa));179test('buffer: {stderr: false} only follows the buffered "stripFinalNewline" in result.all, sync', () => testNoOutputAllStripFinalNewline({stderr: false}, {stdout: false, stderr: true}, execaSync));180test('buffer: {stdout: false} only follows the buffered "stripFinalNewline" in result.all, sync', () => testNoOutputAllStripFinalNewline({stdout: false}, {stdout: true, stderr: false}, execaSync));

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

lines 181–182why, one step back
181
182// `result.all` requires the `all` option, even when only one of the two file descriptors is buffered

TweaksSindre Sorhusbefore adoption698a1b8

line 183why, one step back
183const testNoAllWithoutOption = async (buffer, execaMethod) => {

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

line 184why, one step back
184 const {all} = await execaMethod('noop-both.js', {buffer, stripFinalNewline: false});

TweaksSindre Sorhusbefore adoption698a1b8

line 185why, one step back
185 assert.equal(all, undefined);

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

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

TweaksSindre Sorhusbefore adoption698a1b8

lines 188–191why, one step back
188test('buffer: {stdout: false} does not set result.all', () => testNoAllWithoutOption({stdout: false}, execa));
189test('buffer: {stderr: false} does not set result.all', () => testNoAllWithoutOption({stderr: false}, execa));190test('buffer: {stdout: false} does not set result.all, sync', () => testNoAllWithoutOption({stdout: false}, execaSync));191test('buffer: {stderr: false} does not set result.all, sync', () => testNoAllWithoutOption({stderr: false}, execaSync));

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

line 192why, one step back
192

TweaksSindre Sorhusbefore adoption698a1b8

line 193why, one step back
193const testTransform = async (objectMode, execaMethod) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 194–198why, one step back
194 const lines = [];
195 const {stdout} = await execaMethod('noop.js', {196 buffer: false,197 stdout: [uppercaseGenerator(objectMode), resultGenerator(lines)(objectMode)],198 });

TweaksSindre Sorhusbefore adoption698a1b8

lines 199–200why, one step back
199 assert.equal(stdout, undefined);
200 assert.deepEqual(lines, [foobarUppercase]);

100% test coverage (#1018)ehmickybefore adoption9f65b86

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

TweaksSindre Sorhusbefore adoption698a1b8

lines 203–206why, one step back
203test('buffer: false still runs transforms', () => testTransform(false, execa));
204test('buffer: false still runs transforms, objectMode', () => testTransform(true, execa));205test('buffer: false still runs transforms, sync', () => testTransform(false, execaSync));206test('buffer: false still runs transforms, objectMode, sync', () => testTransform(true, execaSync));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 207why, one step back
207

TweaksSindre Sorhusbefore adoption698a1b8

line 208why, one step back
208const testTransformBinary = async (objectMode, execaMethod) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 209–214why, one step back
209 const lines = [];
210 const {stdout} = await execaMethod('noop-fd.js', ['1', foobarString], {211 buffer: false,212 stdout: [uppercaseBufferGenerator(objectMode, true), resultGenerator(lines)(objectMode)],213 encoding: 'buffer',214 });

TweaksSindre Sorhusbefore adoption698a1b8

lines 215–216why, one step back
215 assert.equal(stdout, undefined);
216 assert.deepEqual(lines, [foobarUppercaseUint8Array]);

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 217–218why, one step back
217};
218

TweaksSindre Sorhusbefore adoption698a1b8

lines 219–222why, one step back
219test('buffer: false still runs transforms, encoding "buffer"', () => testTransformBinary(false, execa));
220test('buffer: false still runs transforms, encoding "buffer", objectMode', () => testTransformBinary(true, execa));221test('buffer: false still runs transforms, encoding "buffer", sync', () => testTransformBinary(false, execaSync));222test('buffer: false still runs transforms, encoding "buffer", objectMode, sync', () => testTransformBinary(true, execaSync));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 223why, one step back
223

TweaksSindre Sorhusbefore adoption698a1b8

line 224why, one step back
224const testStreamEnd = async (fdNumber, buffer) => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 225–226why, one step back
225 const subprocess = execa('wrong command', {...fullStdio, buffer});
226 await Promise.all([

TweaksSindre Sorhusbefore adoption698a1b8

line 227why, one step back
227 assertRejects(subprocess, {message: /wrong command/}),

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 228–231why, one step back
228 once(subprocess.stdio[fdNumber], 'end'),
229 ]);230};231

TweaksSindre Sorhusbefore adoption698a1b8

lines 232–237why, one step back
232test('buffer: false > emits end event on stdout when promise is rejected', () => testStreamEnd(1, false));
233test('buffer: false > emits end event on stderr when promise is rejected', () => testStreamEnd(2, false));234test('buffer: false > emits end event on stdio[*] when promise is rejected', () => testStreamEnd(3, false));235test('buffer: true > emits end event on stdout when promise is rejected', () => testStreamEnd(1, true));236test('buffer: true > emits end event on stderr when promise is rejected', () => testStreamEnd(2, true));237test('buffer: true > emits end event on stdio[*] when promise is rejected', () => testStreamEnd(3, true));

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

lines 238–242why, one step back
238
239// When only one file descriptor is buffered, `result.all` is read from its own stream, not from `subprocess.all`.240// `subprocess.all` still merges both file descriptors, so it must be drained. Otherwise, it fills up and applies backpressure on them, hanging the subprocess which is still writing to them.241const LARGE_OUTPUT = 1e6;242

TweaksSindre Sorhusbefore adoption698a1b8

line 243why, one step back
243const testNoBufferAllBackpressure = async (fdNumber, buffer) => {

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

line 244why, one step back
244 const {exitCode, all} = await execa('noop-fd-large.js', [`${fdNumber}`, `${LARGE_OUTPUT}`], {all: true, buffer});

TweaksSindre Sorhusbefore adoption698a1b8

lines 245–246why, one step back
245 assert.equal(exitCode, 0);
246 assert.equal(all.length, LARGE_OUTPUT);

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

lines 247–248why, one step back
247};
248

TweaksSindre Sorhusbefore adoption698a1b8

lines 249–251why, one step back
249// Without the fix, the subprocess hangs until the test times out
250test('all: true does not hang on a large stdout with buffer: {stderr: false}', () => testNoBufferAllBackpressure(1, {stderr: false}));251test('all: true does not hang on a large stderr with buffer: {stdout: false}', () => testNoBufferAllBackpressure(2, {stdout: false}));

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

lines 252–253why, one step back
252
253// `subprocess.all` must keep interleaving a file descriptor which is not buffered, even though Execa does not read it itself

TweaksSindre Sorhusbefore adoption698a1b8

line 254why, one step back
254const testAllStreamWithNoBuffer = async (fdNumber, optionName) => {

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

lines 255–256why, one step back
255 const subprocess = execa('noop-fd.js', [`${fdNumber}`, foobarString], {all: true, buffer: {[optionName]: false}});
256 const [, allContents] = await Promise.all([subprocess, getStream(subprocess.all)]);

TweaksSindre Sorhusbefore adoption698a1b8

line 257why, one step back
257 assert.equal(allContents, foobarString);

Fix `result.all` and `subprocess.all` when only some file descriptors are bufferedSindre Sorhusbefore adoption758768f

lines 258–259why, one step back
258};
259

TweaksSindre Sorhusbefore adoption698a1b8

lines 260–261why, one step back
260test('subprocess.all includes an unbuffered stdout', () => testAllStreamWithNoBuffer(1, 'stdout'));
261test('subprocess.all includes an unbuffered stderr', () => testAllStreamWithNoBuffer(2, 'stderr'));