sequence.js
This file
Path
test/pipe/sequence.js
400 lines · 15.1 KiB · JavaScript
Last changed by
TweaksSindre Sorhusbefore adoption698a1b8
History of this fileTake it
The walk stopped after 200 commits: lines older than 08eb743 point at it.
TweaksSindre Sorhusbefore adoption698a1b8
line 1why, one step back1import assert from 'node:assert/strict';Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 2–4why, one step back2import {once} from 'node:events';3import process from 'node:process';4import {PassThrough} from 'node:stream';Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
line 5why, one step back5import {setTimeout} from 'node:timers/promises';TweaksSindre Sorhusbefore adoption698a1b8
lines 6–7why, one step back6import test from 'node:test';7import {assertRejects, assertLike} from '../helpers/assert.js';Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 8–16why, one step back8import {execa} from '../../index.js';9import {setFixtureDirectory} from '../helpers/fixtures-directory.js';10import {foobarString} from '../helpers/input.js';11import {noopGenerator} from '../helpers/generator.js';12import {prematureClose} from '../helpers/stdio.js';1314setFixtureDirectory();1516const isLinux = process.platform === 'linux';Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
line 17why, one step back17const timeoutSymbol = Symbol('timeout');Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 18why, one step back18TweaksSindre Sorhusbefore adoption698a1b8
lines 19–37why, one step back19// The `unhandledRejection` event is what these tests assert on, but `node:test` also listens to it20// and fails any test during which it fires. That listener is removed while the event is observed,21// since the event itself is what `assertUnhandledRejection()` asserts on.22const observeUnhandledRejection = async () => {23 const testRunnerListeners = process.listeners('unhandledRejection');24 for (const listener of testRunnerListeners) {25 process.removeListener('unhandledRejection', listener);26 }2728 try {29 return await once(process, 'unhandledRejection');30 } finally {31 for (const listener of testRunnerListeners) {32 process.on('unhandledRejection', listener);33 }34 }35};3637const assertUnhandledRejection = async pipePromise => {Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
line 38why, one step back38 const result = await Promise.race([TweaksSindre Sorhusbefore adoption698a1b8
lines 39–40why, one step back39 observeUnhandledRejection(),40 setTimeout(5000, timeoutSymbol),Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 41–42why, one step back41 ]);42TweaksSindre Sorhusbefore adoption698a1b8
line 43why, one step back43 assert.notEqual(result, timeoutSymbol);Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 44–49why, one step back4445 if (result === timeoutSymbol) {46 return;47 }4849 const [reason, unhandledPromise] = result;TweaksSindre Sorhusbefore adoption698a1b8
lines 50–51why, one step back50 assert.equal(unhandledPromise, pipePromise);51 assert.match(reason.message, /Command failed with exit code 2/);Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 52–53why, one step back52};53TweaksSindre Sorhusbefore adoption698a1b8
line 54why, one step back54const assertUnhandledPipePromise = async ({destinationOptions = {}, inspectPipePromise} = {}) => {Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 55–58why, one step back55 const source = execa('fail.js');56 const destination = execa('fail.js', destinationOptions);57 const pipePromise = source.pipe(destination);58 await inspectPipePromise?.(pipePromise);TweaksSindre Sorhusbefore adoption698a1b8
line 59why, one step back59 await assertUnhandledRejection(pipePromise);Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
line 60why, one step back60 await Promise.all([TweaksSindre Sorhusbefore adoption698a1b8
lines 61–62why, one step back61 assertRejects(source),62 assertRejects(destination),Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
line 63why, one step back63 ]);TweaksSindre Sorhusbefore adoption698a1b8
line 64why, one step back64 await assertRejects(pipePromise);Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 65–66why, one step back65};66TweaksSindre Sorhusbefore adoption698a1b8
line 67why, one step back67test('Source stream abort -> destination success', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 68–72why, one step back68 const source = execa('noop-repeat.js');69 const destination = execa('stdin.js');70 const pipePromise = source.pipe(destination);71 source.stdout.destroy();72TweaksSindre Sorhusbefore adoption698a1b8
lines 73–74why, one step back73 assert.equal(await assertRejects(pipePromise), await assertRejects(source));74 assertLike(await assertRejects(source), {exitCode: 1});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 75–77why, one step back75 await destination;76});77TweaksSindre Sorhusbefore adoption698a1b8
line 78why, one step back78test('Source stream error -> destination success', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 79–84why, one step back79 const source = execa('noop-repeat.js');80 const destination = execa('stdin.js');81 const pipePromise = source.pipe(destination);82 const cause = new Error('test');83 source.stdout.destroy(cause);84TweaksSindre Sorhusbefore adoption698a1b8
lines 85–86why, one step back85 assert.equal(await assertRejects(pipePromise), await assertRejects(source));86 assertLike(await assertRejects(source), {originalMessage: cause.message, exitCode: 1});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 87–89why, one step back87 await destination;88});89TweaksSindre Sorhusbefore adoption698a1b8
line 90why, one step back90test('Destination stream abort -> source failure', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 91–95why, one step back91 const source = execa('noop-repeat.js');92 const destination = execa('stdin.js');93 const pipePromise = source.pipe(destination);94 destination.stdin.destroy();95TweaksSindre Sorhusbefore adoption698a1b8
lines 96–98why, one step back96 assert.equal(await assertRejects(pipePromise), await assertRejects(destination));97 assertLike(await assertRejects(destination), prematureClose);98 assertLike(await assertRejects(source), {exitCode: 1});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 99–100why, one step back99});100TweaksSindre Sorhusbefore adoption698a1b8
line 101why, one step back101test('Destination stream error -> source failure', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 102–107why, one step back102 const source = execa('noop-repeat.js');103 const destination = execa('stdin.js');104 const pipePromise = source.pipe(destination);105 const cause = new Error('test');106 destination.stdin.destroy(cause);107TweaksSindre Sorhusbefore adoption698a1b8
lines 108–110why, one step back108 assert.equal(await assertRejects(pipePromise), await assertRejects(destination));109 assertLike(await assertRejects(destination), {originalMessage: cause.message, exitCode: 0});110 assertLike(await assertRejects(source), {exitCode: 1});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 111–112why, one step back111});112TweaksSindre Sorhusbefore adoption698a1b8
line 113why, one step back113test('Source success -> destination success', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 114–117why, one step back114 const source = execa('noop.js', [foobarString]);115 const destination = execa('stdin.js');116 const pipePromise = source.pipe(destination);117TweaksSindre Sorhusbefore adoption698a1b8
lines 118–120why, one step back118 assertLike(await source, {stdout: foobarString});119 assertLike(await destination, {stdout: foobarString});120 assert.equal(await pipePromise, await destination);Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 121–122why, one step back121});122TweaksSindre Sorhusbefore adoption698a1b8
line 123why, one step back123test('Destination stream end -> source failure', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 124–128why, one step back124 const source = execa('noop-repeat.js');125 const destination = execa('stdin.js');126 const pipePromise = source.pipe(destination);127 destination.stdin.end();128TweaksSindre Sorhusbefore adoption698a1b8
line 129why, one step back129 assert.equal(await assertRejects(pipePromise), await assertRejects(source));Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 130why, one step back130 await destination;TweaksSindre Sorhusbefore adoption698a1b8
line 131why, one step back131 assertLike(await assertRejects(source), {exitCode: 1});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 132–133why, one step back132});133TweaksSindre Sorhusbefore adoption698a1b8
line 134why, one step back134test('Source normal failure -> destination success', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 135–138why, one step back135 const source = execa('noop-fail.js', ['1', foobarString]);136 const destination = execa('stdin.js');137 const pipePromise = source.pipe(destination);138TweaksSindre Sorhusbefore adoption698a1b8
lines 139–140why, one step back139 assert.equal(await assertRejects(pipePromise), await assertRejects(source));140 assertLike(await assertRejects(source), {stdout: foobarString, exitCode: 2});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 141–143why, one step back141 await destination;142});143TweaksSindre Sorhusbefore adoption698a1b8
line 144why, one step back144test('Source normal failure -> deep destination success', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 145–150why, one step back145 const source = execa('noop-fail.js', ['1', foobarString]);146 const destination = execa('stdin.js');147 const secondDestination = execa('stdin.js');148 const pipePromise = source.pipe(destination);149 const secondPipePromise = pipePromise.pipe(secondDestination);150TweaksSindre Sorhusbefore adoption698a1b8
lines 151–155why, one step back151 assert.equal(await assertRejects(pipePromise), await assertRejects(source));152 assert.equal(await assertRejects(secondPipePromise), await assertRejects(source));153 assertLike(await assertRejects(source), {stdout: foobarString, exitCode: 2});154 assertLike(await destination, {stdout: foobarString});155 assertLike(await secondDestination, {stdout: foobarString});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 156–157why, one step back156});157TweaksSindre Sorhusbefore adoption698a1b8
line 158why, one step back158const testSourceTerminated = async signal => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 159–163why, one step back159 const source = execa('noop-repeat.js');160 const destination = execa('stdin.js');161 const pipePromise = source.pipe(destination);162 source.kill(signal);163TweaksSindre Sorhusbefore adoption698a1b8
lines 164–165why, one step back164 assert.equal(await assertRejects(pipePromise), await assertRejects(source));165 assertLike(await assertRejects(source), {signal});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 166–168why, one step back166 await destination;167};168TweaksSindre Sorhusbefore adoption698a1b8
lines 169–170why, one step back169test('Source SIGTERM -> destination success', () => testSourceTerminated('SIGTERM'));170test('Source SIGKILL -> destination success', () => testSourceTerminated('SIGKILL'));Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 171why, one step back171TweaksSindre Sorhusbefore adoption698a1b8
line 172why, one step back172test('Destination success before source -> source success', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 173–180why, one step back173 const passThroughStream = new PassThrough();174 const source = execa('stdin.js', {stdin: ['pipe', passThroughStream]});175 const destination = execa('empty.js');176 const pipePromise = source.pipe(destination);177178 await destination;179 passThroughStream.end();180 await source;TweaksSindre Sorhusbefore adoption698a1b8
line 181why, one step back181 assert.equal(await pipePromise, await destination);Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 182–183why, one step back182});183TweaksSindre Sorhusbefore adoption698a1b8
line 184why, one step back184test('Destination normal failure -> source failure', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 185–188why, one step back185 const source = execa('noop-repeat.js');186 const destination = execa('fail.js');187 const pipePromise = source.pipe(destination);188TweaksSindre Sorhusbefore adoption698a1b8
lines 189–191why, one step back189 assert.equal(await assertRejects(pipePromise), await assertRejects(destination));190 assertLike(await assertRejects(destination), {exitCode: 2});191 assertLike(await assertRejects(source), {exitCode: 1});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 192–193why, one step back192});193TweaksSindre Sorhusbefore adoption698a1b8
line 194why, one step back194test('Destination normal failure -> deep source failure', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 195–200why, one step back195 const source = execa('noop-repeat.js');196 const destination = execa('stdin.js');197 const secondDestination = execa('fail.js');198 const pipePromise = source.pipe(destination);199 const secondPipePromise = pipePromise.pipe(secondDestination);200TweaksSindre Sorhusbefore adoption698a1b8
lines 201–205why, one step back201 assert.equal(await assertRejects(pipePromise), await assertRejects(destination));202 assert.equal(await assertRejects(secondPipePromise), await assertRejects(secondDestination));203 assertLike(await assertRejects(secondDestination), {exitCode: 2});204 assertLike(await assertRejects(destination), {exitCode: 1});205 assertLike(await assertRejects(source), {exitCode: 1});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 206–207why, one step back206});207TweaksSindre Sorhusbefore adoption698a1b8
line 208why, one step back208const testDestinationTerminated = async signal => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 209–213why, one step back209 const source = execa('noop-repeat.js');210 const destination = execa('stdin.js');211 const pipePromise = source.pipe(destination);212 destination.kill(signal);213TweaksSindre Sorhusbefore adoption698a1b8
lines 214–216why, one step back214 assert.equal(await assertRejects(pipePromise), await assertRejects(destination));215 assertLike(await assertRejects(destination), {signal});216 assertLike(await assertRejects(source), {exitCode: 1});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 217–218why, one step back217};218TweaksSindre Sorhusbefore adoption698a1b8
lines 219–220why, one step back219test('Destination SIGTERM -> source abort', () => testDestinationTerminated('SIGTERM'));220test('Destination SIGKILL -> source abort', () => testDestinationTerminated('SIGKILL'));Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 221why, one step back221TweaksSindre Sorhusbefore adoption698a1b8
line 222why, one step back222test('Source already ended -> ignore source', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 223–227why, one step back223 const source = execa('noop.js', [foobarString]);224 await source;225 const destination = execa('stdin.js');226 const pipePromise = source.pipe(destination);227TweaksSindre Sorhusbefore adoption698a1b8
lines 228–230why, one step back228 assert.equal(await pipePromise, await destination);229 assertLike(await source, {stdout: foobarString});230 assertLike(await destination, {stdout: ''});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 231–232why, one step back231});232TweaksSindre Sorhusbefore adoption698a1b8
line 233why, one step back233test('Source already aborted -> ignore source', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 234–238why, one step back234 const source = execa('noop.js', [foobarString]);235 source.stdout.destroy();236 const destination = execa('stdin.js');237 const pipePromise = source.pipe(destination);238TweaksSindre Sorhusbefore adoption698a1b8
lines 239–241why, one step back239 assert.equal(await pipePromise, await destination);240 assertLike(await source, {stdout: ''});241 assertLike(await destination, {stdout: ''});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 242–243why, one step back242});243TweaksSindre Sorhusbefore adoption698a1b8
line 244why, one step back244test('Source already errored -> failure', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 245–250why, one step back245 const source = execa('noop.js', [foobarString]);246 const cause = new Error('test');247 source.stdout.destroy(cause);248 const destination = execa('stdin.js');249 const pipePromise = source.pipe(destination);250TweaksSindre Sorhusbefore adoption698a1b8
lines 251–253why, one step back251 assert.equal(await assertRejects(pipePromise), await assertRejects(source));252 assertLike(await assertRejects(source), {cause});253 assertLike(await destination, {stdout: ''});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 254–255why, one step back254});255TweaksSindre Sorhusbefore adoption698a1b8
line 256why, one step back256test('Destination already ended -> ignore source', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 257–262why, one step back257 const destination = execa('stdin.js');258 destination.stdin.end('.');259 await destination;260 const source = execa('noop.js', [foobarString]);261 const pipePromise = source.pipe(destination);262TweaksSindre Sorhusbefore adoption698a1b8
lines 263–265why, one step back263 assert.equal(await pipePromise, await destination);264 assertLike(await destination, {stdout: '.'});265 assertLike(await source, {stdout: ''});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 266–267why, one step back266});267TweaksSindre Sorhusbefore adoption698a1b8
line 268why, one step back268test('Destination already aborted -> failure', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 269–270why, one step back269 const destination = execa('stdin.js');270 destination.stdin.destroy();TweaksSindre Sorhusbefore adoption698a1b8
line 271why, one step back271 assertLike(await assertRejects(destination), prematureClose);Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 272–274why, one step back272 const source = execa('noop.js', [foobarString]);273 const pipePromise = source.pipe(destination);274TweaksSindre Sorhusbefore adoption698a1b8
lines 275–276why, one step back275 assert.equal(await assertRejects(pipePromise), await assertRejects(destination));276 assertLike(await source, {stdout: ''});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 277–278why, one step back277});278TweaksSindre Sorhusbefore adoption698a1b8
line 279why, one step back279test('Destination already errored -> failure', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 280–282why, one step back280 const destination = execa('stdin.js');281 const cause = new Error('test');282 destination.stdin.destroy(cause);TweaksSindre Sorhusbefore adoption698a1b8
line 283why, one step back283 assertLike(await assertRejects(destination), {cause});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 284–286why, one step back284 const source = execa('noop.js', [foobarString]);285 const pipePromise = source.pipe(destination);286TweaksSindre Sorhusbefore adoption698a1b8
lines 287–288why, one step back287 assert.equal(await assertRejects(pipePromise), await assertRejects(destination));288 assertLike(await source, {stdout: ''});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 289–290why, one step back289});290TweaksSindre Sorhusbefore adoption698a1b8
line 291why, one step back291test('Source normal failure + destination normal failure', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 292–295why, one step back292 const source = execa('noop-fail.js', ['1', foobarString]);293 const destination = execa('stdin-fail.js');294 const pipePromise = source.pipe(destination);295TweaksSindre Sorhusbefore adoption698a1b8
lines 296–298why, one step back296 assert.equal(await assertRejects(pipePromise), await assertRejects(destination));297 assertLike(await assertRejects(source), {stdout: foobarString, exitCode: 2});298 assertLike(await assertRejects(destination), {stdout: foobarString, exitCode: 2});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 299–300why, one step back299});300TweaksSindre Sorhusbefore adoption698a1b8
line 301why, one step back301test('Simultaneous error on source and destination', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 302–306why, one step back302 const source = execa('noop.js', ['']);303 const destination = execa('stdin.js');304 const pipePromise = source.pipe(destination);305306 const sourceCause = new Error(foobarString);Add `nodeChildProcess` to subprocess promises and make the subprocess a normal promise (#1255)Sindre Sorhusbefore adoptionade74bf
line 307why, one step back307 source.nodeChildProcess.emit('error', sourceCause);Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 308why, one step back308 const destinationCause = new Error('other');Add `nodeChildProcess` to subprocess promises and make the subprocess a normal promise (#1255)Sindre Sorhusbefore adoptionade74bf
line 309why, one step back309 destination.nodeChildProcess.emit('error', destinationCause);Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 310why, one step back310TweaksSindre Sorhusbefore adoption698a1b8
lines 311–313why, one step back311 assert.equal(await assertRejects(pipePromise), await assertRejects(destination));312 assertLike(await assertRejects(source), {cause: sourceCause});313 assertLike(await assertRejects(destination), {cause: destinationCause});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 314–315why, one step back314});315TweaksSindre Sorhusbefore adoption698a1b8
line 316why, one step back316test('Does not need to await individual promises', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 317–318why, one step back317 const source = execa('fail.js');318 const destination = execa('fail.js');TweaksSindre Sorhusbefore adoption698a1b8
line 319why, one step back319 await assertRejects(source.pipe(destination));Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 320–321why, one step back320});321TweaksSindre Sorhusbefore adoption698a1b8
lines 322–323why, one step back322test('Need to await .pipe() return value', async () => {323 await assertUnhandledPipePromise();Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 324–325why, one step back324});325TweaksSindre Sorhusbefore adoption698a1b8
lines 326–327why, one step back326test('Need to await .pipe() return value, "all" option', async () => {327 await assertUnhandledPipePromise({destinationOptions: {all: true}});Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 328–329why, one step back328});329TweaksSindre Sorhusbefore adoption698a1b8
lines 330–331why, one step back330test('Need to await .pipe() return value after inspecting lazy .all', async () => {331 await assertUnhandledPipePromise({Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 332–334why, one step back332 destinationOptions: {all: true},333 inspectPipePromise(pipePromise) {334 const descriptor = Object.getOwnPropertyDescriptor(pipePromise, 'all');TweaksSindre Sorhusbefore adoption698a1b8
line 335why, one step back335 assert.equal(typeof descriptor.get, 'function');Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 336–339why, one step back336 },337 });338});339TweaksSindre Sorhusbefore adoption698a1b8
line 340why, one step back340test('Need to await .pipe() return value after getOneMessage()', async () => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 341why, one step back341 const source = execa('fail.js');Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
line 342why, one step back342 const destination = execa('ipc-send-twice.js', {ipc: true});Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 343why, one step back343 const pipePromise = source.pipe(destination);Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
line 344why, one step back344TweaksSindre Sorhusbefore adoption698a1b8
lines 345–347why, one step back345 assert.equal(await pipePromise.getOneMessage(), 'foo');346 await assertUnhandledRejection(pipePromise);347 await assertRejects(source);Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
line 348why, one step back348 await destination;TweaksSindre Sorhusbefore adoption698a1b8
line 349why, one step back349 await assertRejects(pipePromise);Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 350–351why, one step back350});351TweaksSindre Sorhusbefore adoption698a1b8
line 352why, one step back352test('Need to await .pipe() return value after paused getEachMessage()', async () => {Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
lines 353–357why, one step back353 const source = execa('fail.js');354 const destination = execa('ipc-send-twice.js', {ipc: true});355 const pipePromise = source.pipe(destination);356 const iterator = pipePromise.getEachMessage();357TweaksSindre Sorhusbefore adoption698a1b8
lines 358–360why, one step back358 assert.deepEqual(await iterator.next(), {done: false, value: 'foo'});359 await assertUnhandledRejection(pipePromise);360 await assertRejects(source);Expose the destination subprocess methods on `.pipe()` (#1252)Sindre Sorhusbefore adoptionc31c94c
line 361why, one step back361 await destination;TweaksSindre Sorhusbefore adoption698a1b8
line 362why, one step back362 await assertRejects(pipePromise);Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 363–365why, one step back363});364365if (isLinux) {TweaksSindre Sorhusbefore adoption698a1b8
line 366why, one step back366 const testYesHead = async (useStdoutTransform, useStdinTransform, all) => {Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 367–369why, one step back367 const source = execa('yes', {stdout: useStdoutTransform ? noopGenerator(false) : 'pipe', all});368 const destination = execa('head', ['-n', '1'], {stdin: useStdinTransform ? noopGenerator(false) : 'pipe'});369 const pipePromise = source.pipe(destination);TweaksSindre Sorhusbefore adoption698a1b8
lines 370–374why, one step back370 assert.equal(await assertRejects(pipePromise), await assertRejects(source));371 assertLike(await destination, {stdout: 'y'});372 const sourceError = await assertRejects(source);373 assert.equal(sourceError.exitCode, 1);374 assert.match(sourceError.stderr, /^yes: standard output: (?:Broken pipe|Connection reset by peer)$/);Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 375why, one step back375TweaksSindre Sorhusbefore adoption698a1b8
lines 376–381why, one step back376 assert.equal(source.stdout.readableEnded, false);377 assert.equal(source.stdout.errored, null);378 assert.equal(source.stdout.destroyed, true);379 assert.equal(source.stderr.readableEnded, true);380 assert.equal(source.stderr.errored, null);381 assert.equal(source.stderr.destroyed, true);Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 382why, one step back382TweaksSindre Sorhusbefore adoption698a1b8
lines 383–384why, one step back383 if (!all) {384 return;Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 385why, one step back385 }TweaksSindre Sorhusbefore adoption698a1b8
lines 386–389why, one step back386387 assert.equal(source.all.readableEnded, true);388 assert.equal(source.all.errored, null);389 assert.equal(source.all.destroyed, true);Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
lines 390–391why, one step back390 };391TweaksSindre Sorhusbefore adoption698a1b8
lines 392–399why, one step back392 test('Works with yes | head', () => testYesHead(false, false, false));393 test('Works with yes | head, input transform', () => testYesHead(false, true, false));394 test('Works with yes | head, output transform', () => testYesHead(true, false, false));395 test('Works with yes | head, input/output transform', () => testYesHead(true, true, false));396 test('Works with yes | head, "all" option', () => testYesHead(false, false, true));397 test('Works with yes | head, "all" option, input transform', () => testYesHead(false, true, true));398 test('Works with yes | head, "all" option, output transform', () => testYesHead(true, false, true));399 test('Works with yes | head, "all" option, input/output transform', () => testYesHead(true, true, true));Upgrade `tsd` and `c8` (#982)ehmickybefore adoption08eb743
line 400why, one step back400}