concurrent.js
This file
Path
test/convert/concurrent.js
372 lines · 12.7 KiB · JavaScript
Last changed by
TweaksSindre Sorhusbefore adoption698a1b8
History of this fileTake it
The walk stopped after 200 commits: lines older than 9f65b86 point at it.
TweaksSindre Sorhusbefore adoption698a1b8
line 1why, one step back1import assert from 'node:assert/strict';100% test coverage (#1018)ehmickybefore adoption9f65b86
line 2why, one step back2import {setTimeout} from 'node:timers/promises';TweaksSindre Sorhusbefore adoption698a1b8
line 3why, one step back3import test from 'node:test';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 4–24why, one step back4import {execa} from '../../index.js';5import {setFixtureDirectory} from '../helpers/fixtures-directory.js';6import {foobarString} from '../helpers/input.js';7import {fullReadableStdio} from '../helpers/stdio.js';8import {9 finishedStream,10 assertStreamOutput,11 assertStreamError,12 assertStreamReadError,13 assertSubprocessOutput,14 assertSubprocessError,15 getReadWriteSubprocess,16} from '../helpers/convert.js';1718setFixtureDirectory();1920const endStream = async stream => {21 stream.end(foobarString);22 await setTimeout(0);23};24TweaksSindre Sorhusbefore adoption698a1b8
line 25why, one step back25const endSameWritable = async (stream, secondStream, subprocess, fdNumber) => {100% test coverage (#1018)ehmickybefore adoption9f65b86
line 26why, one step back26 await endStream(stream);TweaksSindre Sorhusbefore adoption698a1b8
line 27why, one step back27 assert.ok(subprocess.stdio[fdNumber].writable);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 28–29why, one step back2829 await endStream(secondStream);TweaksSindre Sorhusbefore adoption698a1b8
line 30why, one step back30 assert.ok(!subprocess.stdio[fdNumber].writable);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 31–33why, one step back31};3233// eslint-disable-next-line max-paramsTweaksSindre Sorhusbefore adoption698a1b8
line 34why, one step back34const endDifferentWritable = async (stream, secondStream, subprocess, fdNumber = 0, secondFdNumber = 3) => {100% test coverage (#1018)ehmickybefore adoption9f65b86
line 35why, one step back35 await endStream(stream);TweaksSindre Sorhusbefore adoption698a1b8
lines 36–37why, one step back36 assert.ok(!subprocess.stdio[fdNumber].writable);37 assert.ok(subprocess.stdio[secondFdNumber].writable);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 38–39why, one step back3839 await endStream(secondStream);TweaksSindre Sorhusbefore adoption698a1b8
line 40why, one step back40 assert.ok(!subprocess.stdio[secondFdNumber].writable);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 41–42why, one step back41};42TweaksSindre Sorhusbefore adoption698a1b8
line 43why, one step back43const testReadableTwice = async (fdNumber, from) => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 44–48why, one step back44 const subprocess = execa('noop-fd.js', [`${fdNumber}`, foobarString]);45 const stream = subprocess.readable({from});46 const secondStream = subprocess.readable({from});4748 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 49–50why, one step back49 assertStreamOutput(stream),50 assertStreamOutput(secondStream),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 51why, one step back51 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 52why, one step back52 await assertSubprocessOutput(subprocess, foobarString, fdNumber);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 53–54why, one step back53};54TweaksSindre Sorhusbefore adoption698a1b8
lines 55–56why, one step back55test('Can call .readable() twice on same file descriptor', () => testReadableTwice(1));56test('Can call .readable({from: "stderr"}) twice on same file descriptor', () => testReadableTwice(2, 'stderr'));100% test coverage (#1018)ehmickybefore adoption9f65b86
line 57why, one step back57TweaksSindre Sorhusbefore adoption698a1b8
line 58why, one step back58const testWritableTwice = async (fdNumber, to, options) => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 59–65why, one step back59 const subprocess = execa('stdin-fd.js', [`${fdNumber}`], options);60 const stream = subprocess.writable({to});61 const secondStream = subprocess.writable({to});6263 await Promise.all([64 finishedStream(stream),65 finishedStream(secondStream),TweaksSindre Sorhusbefore adoption698a1b8
line 66why, one step back66 endSameWritable(stream, secondStream, subprocess, fdNumber),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 67why, one step back67 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 68why, one step back68 await assertSubprocessOutput(subprocess, `${foobarString}${foobarString}`);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 69–70why, one step back69};70TweaksSindre Sorhusbefore adoption698a1b8
lines 71–72why, one step back71test('Can call .writable() twice on same file descriptor', () => testWritableTwice(0, undefined, {}));72test('Can call .writable({to: "fd3"}) twice on same file descriptor', () => testWritableTwice(3, 'fd3', fullReadableStdio()));100% test coverage (#1018)ehmickybefore adoption9f65b86
line 73why, one step back73TweaksSindre Sorhusbefore adoption698a1b8
line 74why, one step back74const testDuplexTwice = async (fdNumber, to, options) => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 75–80why, one step back75 const subprocess = execa('stdin-fd.js', [`${fdNumber}`], options);76 const stream = subprocess.duplex({to});77 const secondStream = subprocess.duplex({to});7879 const expectedOutput = `${foobarString}${foobarString}`;80 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 81–83why, one step back81 assertStreamOutput(stream, expectedOutput),82 assertStreamOutput(secondStream, expectedOutput),83 endSameWritable(stream, secondStream, subprocess, fdNumber),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 84why, one step back84 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 85why, one step back85 await assertSubprocessOutput(subprocess, expectedOutput);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 86–87why, one step back86};87TweaksSindre Sorhusbefore adoption698a1b8
lines 88–89why, one step back88test('Can call .duplex() twice on same file descriptor', () => testDuplexTwice(0, undefined, {}));89test('Can call .duplex({to: "fd3"}) twice on same file descriptor', () => testDuplexTwice(3, 'fd3', fullReadableStdio()));100% test coverage (#1018)ehmickybefore adoption9f65b86
line 90why, one step back90TweaksSindre Sorhusbefore adoption698a1b8
line 91why, one step back91test('Can call .duplex() twice on same readable file descriptor but different writable one', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 92–97why, one step back92 const subprocess = execa('stdin-fd-both.js', ['3'], fullReadableStdio());93 const stream = subprocess.duplex();94 const secondStream = subprocess.duplex({to: 'fd3'});9596 const expectedOutput = `${foobarString}${foobarString}`;97 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 98–100why, one step back98 assertStreamOutput(stream, expectedOutput),99 assertStreamOutput(secondStream, expectedOutput),100 endDifferentWritable(stream, secondStream, subprocess),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 101why, one step back101 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 102why, one step back102 await assertSubprocessOutput(subprocess, expectedOutput);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 103–104why, one step back103});104TweaksSindre Sorhusbefore adoption698a1b8
line 105why, one step back105test('Can call .readable() twice on different file descriptors', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 106–111why, one step back106 const subprocess = execa('noop-both.js', [foobarString]);107 const stream = subprocess.readable();108 const secondStream = subprocess.readable({from: 'stderr'});109110 const expectedOutput = `${foobarString}\n`;111 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 112–113why, one step back112 assertStreamOutput(stream, expectedOutput),113 assertStreamOutput(secondStream, expectedOutput),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 114why, one step back114 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 115–116why, one step back115 await assertSubprocessOutput(subprocess);116 await assertSubprocessOutput(subprocess, foobarString, 2);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 117–118why, one step back117});118TweaksSindre Sorhusbefore adoption698a1b8
line 119why, one step back119test('Can call .writable() twice on different file descriptors', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 120–126why, one step back120 const subprocess = execa('stdin-fd-both.js', ['3'], fullReadableStdio());121 const stream = subprocess.writable();122 const secondStream = subprocess.writable({to: 'fd3'});123124 await Promise.all([125 finishedStream(stream),126 finishedStream(secondStream),TweaksSindre Sorhusbefore adoption698a1b8
line 127why, one step back127 endDifferentWritable(stream, secondStream, subprocess),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 128why, one step back128 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 129why, one step back129 await assertSubprocessOutput(subprocess, `${foobarString}${foobarString}`);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 130–131why, one step back130});131TweaksSindre Sorhusbefore adoption698a1b8
line 132why, one step back132test('Can call .duplex() twice on different file descriptors', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 133–137why, one step back133 const subprocess = execa('stdin-twice-both.js', ['3'], fullReadableStdio());134 const stream = subprocess.duplex();135 const secondStream = subprocess.duplex({from: 'stderr', to: 'fd3'});136137 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 138–140why, one step back138 assertStreamOutput(stream),139 assertStreamOutput(secondStream),140 endDifferentWritable(stream, secondStream, subprocess),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 141why, one step back141 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 142–143why, one step back142 await assertSubprocessOutput(subprocess);143 await assertSubprocessOutput(subprocess, foobarString, 2);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 144–145why, one step back144});145TweaksSindre Sorhusbefore adoption698a1b8
line 146why, one step back146test('Can call .readable() and .writable()', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 147–153why, one step back147 const subprocess = getReadWriteSubprocess();148 const stream = subprocess.writable();149 const secondStream = subprocess.readable();150 stream.end(foobarString);151152 await Promise.all([153 finishedStream(stream),TweaksSindre Sorhusbefore adoption698a1b8
line 154why, one step back154 assertStreamOutput(secondStream),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 155why, one step back155 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 156why, one step back156 await assertSubprocessOutput(subprocess);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 157–158why, one step back157});158TweaksSindre Sorhusbefore adoption698a1b8
line 159why, one step back159test('Can call .writable() and .duplex()', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 160–165why, one step back160 const subprocess = execa('stdin-fd-both.js', ['3'], fullReadableStdio());161 const stream = subprocess.duplex();162 const secondStream = subprocess.writable({to: 'fd3'});163164 const expectedOutput = `${foobarString}${foobarString}`;165 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
line 166why, one step back166 assertStreamOutput(stream, expectedOutput),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 167why, one step back167 finishedStream(secondStream),TweaksSindre Sorhusbefore adoption698a1b8
line 168why, one step back168 endDifferentWritable(stream, secondStream, subprocess),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 169why, one step back169 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 170why, one step back170 await assertSubprocessOutput(subprocess, expectedOutput);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 171–172why, one step back171});172TweaksSindre Sorhusbefore adoption698a1b8
line 173why, one step back173test('Can call .readable() and .duplex()', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 174–179why, one step back174 const subprocess = execa('stdin-both.js');175 const stream = subprocess.duplex();176 const secondStream = subprocess.readable({from: 'stderr'});177 stream.end(foobarString);178179 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 180–181why, one step back180 assertStreamOutput(stream),181 assertStreamOutput(secondStream),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 182why, one step back182 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 183–184why, one step back183 await assertSubprocessOutput(subprocess);184 await assertSubprocessOutput(subprocess, foobarString, 2);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 185–186why, one step back185});186TweaksSindre Sorhusbefore adoption698a1b8
line 187why, one step back187test('Can error one of two .readable() on same file descriptor', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 188–194why, one step back188 const subprocess = execa('noop-fd.js', ['1', foobarString]);189 const stream = subprocess.readable();190 const secondStream = subprocess.readable();191 const cause = new Error(foobarString);192 stream.destroy(cause);193194 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 195–196why, one step back195 assertStreamReadError(stream, cause),196 assertStreamOutput(secondStream),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 197why, one step back197 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 198why, one step back198 await assertSubprocessOutput(subprocess);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 199–200why, one step back199});200TweaksSindre Sorhusbefore adoption698a1b8
line 201why, one step back201test('Can error both .readable() on same file descriptor', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 202–209why, one step back202 const subprocess = execa('noop-fd.js', ['1', foobarString]);203 const stream = subprocess.readable();204 const secondStream = subprocess.readable();205 const cause = new Error(foobarString);206 stream.destroy(cause);207 secondStream.destroy(cause);208209 const [error, secondError] = await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 210–211why, one step back210 assertStreamReadError(stream, {cause}),211 assertStreamReadError(secondStream, {cause}),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 212why, one step back212 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 213–214why, one step back213 assert.equal(error, secondError);214 await assertSubprocessError(subprocess, error);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 215–216why, one step back215});216TweaksSindre Sorhusbefore adoption698a1b8
line 217why, one step back217test('Can error one of two .readable() on different file descriptors', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 218–224why, one step back218 const subprocess = execa('noop-both.js', [foobarString]);219 const stream = subprocess.readable();220 const secondStream = subprocess.readable({from: 'stderr'});221 const cause = new Error(foobarString);222 stream.destroy(cause);223224 const [error, secondError] = await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 225–226why, one step back225 assertStreamReadError(stream, {cause}),226 assertStreamReadError(secondStream, {cause}),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 227why, one step back227 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 228–230why, one step back228 assert.equal(error, secondError);229 assert.equal(error.stderr, foobarString);230 await assertSubprocessError(subprocess, error);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 231–232why, one step back231});232TweaksSindre Sorhusbefore adoption698a1b8
line 233why, one step back233test('Can error both .readable() on different file descriptors', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 234–241why, one step back234 const subprocess = execa('noop-both.js', [foobarString]);235 const stream = subprocess.readable();236 const secondStream = subprocess.readable({from: 'stderr'});237 const cause = new Error(foobarString);238 stream.destroy(cause);239 secondStream.destroy(cause);240241 const [error, secondError] = await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 242–243why, one step back242 assertStreamReadError(stream, {cause}),243 assertStreamReadError(secondStream, {cause}),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 244why, one step back244 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 245–246why, one step back245 assert.equal(error, secondError);246 await assertSubprocessError(subprocess, error);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 247–248why, one step back247});248TweaksSindre Sorhusbefore adoption698a1b8
line 249why, one step back249test('Can error one of two .writable() on same file descriptor', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 250–257why, one step back250 const subprocess = execa('stdin.js');251 const stream = subprocess.writable();252 const secondStream = subprocess.writable();253 const cause = new Error(foobarString);254 stream.destroy(cause);255 secondStream.end(foobarString);256257 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
line 258why, one step back258 assertStreamError(stream, cause),100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 259–260why, one step back259 finishedStream(secondStream),260 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 261why, one step back261 await assertSubprocessOutput(subprocess);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 262–263why, one step back262});263TweaksSindre Sorhusbefore adoption698a1b8
line 264why, one step back264test('Can error both .writable() on same file descriptor', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 265–272why, one step back265 const subprocess = execa('stdin.js');266 const stream = subprocess.writable();267 const secondStream = subprocess.writable();268 const cause = new Error(foobarString);269 stream.destroy(cause);270 secondStream.destroy(cause);271272 const [error, secondError] = await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 273–274why, one step back273 assertStreamError(stream, {cause}),274 assertStreamError(secondStream, {cause}),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 275why, one step back275 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 276–277why, one step back276 assert.equal(error, secondError);277 await assertSubprocessError(subprocess, error);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 278–279why, one step back278});279TweaksSindre Sorhusbefore adoption698a1b8
line 280why, one step back280test('Can error one of two .writable() on different file descriptors', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 281–288why, one step back281 const subprocess = execa('stdin-fd-both.js', ['3'], fullReadableStdio());282 const stream = subprocess.writable();283 const secondStream = subprocess.writable({to: 'fd3'});284 const cause = new Error(foobarString);285 stream.destroy(cause);286 secondStream.end(foobarString);287288 const [error, secondError] = await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 289–290why, one step back289 assertStreamError(stream, {cause}),290 assertStreamError(secondStream, {cause}),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 291why, one step back291 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 292–294why, one step back292 assert.equal(error, secondError);293 assert.equal(error.stdout, foobarString);294 await assertSubprocessError(subprocess, error);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 295–296why, one step back295});296TweaksSindre Sorhusbefore adoption698a1b8
line 297why, one step back297test('Can error both .writable() on different file descriptors', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 298–305why, one step back298 const subprocess = execa('stdin-fd-both.js', ['3'], fullReadableStdio());299 const stream = subprocess.writable();300 const secondStream = subprocess.writable({to: 'fd3'});301 const cause = new Error(foobarString);302 stream.destroy(cause);303 secondStream.destroy(cause);304305 const [error, secondError] = await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 306–307why, one step back306 assertStreamError(stream, {cause}),307 assertStreamError(secondStream, {cause}),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 308why, one step back308 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 309–310why, one step back309 assert.equal(error, secondError);310 await assertSubprocessError(subprocess, error);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 311–312why, one step back311});312TweaksSindre Sorhusbefore adoption698a1b8
line 313why, one step back313test('Can error one of two .duplex() on same file descriptor', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 314–321why, one step back314 const subprocess = execa('stdin.js');315 const stream = subprocess.duplex();316 const secondStream = subprocess.duplex();317 const cause = new Error(foobarString);318 stream.destroy(cause);319 secondStream.end(foobarString);320321 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 322–323why, one step back322 assertStreamReadError(stream, cause),323 assertStreamOutput(secondStream),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 324why, one step back324 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 325why, one step back325 await assertSubprocessOutput(subprocess);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 326–327why, one step back326});327TweaksSindre Sorhusbefore adoption698a1b8
line 328why, one step back328test('Can error both .duplex() on same file descriptor', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 329–336why, one step back329 const subprocess = execa('stdin.js');330 const stream = subprocess.duplex();331 const secondStream = subprocess.duplex();332 const cause = new Error(foobarString);333 stream.destroy(cause);334 secondStream.destroy(cause);335336 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 337–338why, one step back337 assertStreamReadError(stream, cause),338 assertStreamReadError(secondStream, cause),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 339why, one step back339 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 340why, one step back340 await assertSubprocessError(subprocess, {cause});100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 341–342why, one step back341});342TweaksSindre Sorhusbefore adoption698a1b8
line 343why, one step back343test('Can error one of two .duplex() on different file descriptors', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 344–351why, one step back344 const subprocess = execa('stdin-twice-both.js', ['3'], fullReadableStdio());345 const stream = subprocess.duplex();346 const secondStream = subprocess.duplex({from: 'stderr', to: 'fd3'});347 const cause = new Error(foobarString);348 stream.destroy(cause);349 secondStream.end(foobarString);350351 const [error] = await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 352–353why, one step back352 assertStreamReadError(secondStream, {cause}),353 assertStreamReadError(stream, cause),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 354why, one step back354 ]);TweaksSindre Sorhusbefore adoption698a1b8
lines 355–356why, one step back355 assert.equal(error.stderr, foobarString);356 await assertSubprocessError(subprocess, error);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 357–358why, one step back357});358TweaksSindre Sorhusbefore adoption698a1b8
line 359why, one step back359test('Can error both .duplex() on different file descriptors', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 360–367why, one step back360 const subprocess = execa('stdin-twice-both.js', ['3'], fullReadableStdio());361 const stream = subprocess.duplex();362 const secondStream = subprocess.duplex({from: 'stderr', to: 'fd3'});363 const cause = new Error(foobarString);364 stream.destroy(cause);365 secondStream.destroy(cause);366367 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 368–369why, one step back368 assertStreamReadError(stream, cause),369 assertStreamReadError(secondStream, cause),100% test coverage (#1018)ehmickybefore adoption9f65b86
line 370why, one step back370 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 371why, one step back371 await assertSubprocessError(subprocess, {cause});100% test coverage (#1018)ehmickybefore adoption9f65b86
line 372why, one step back372});