wait-epipe.js
This file
Path
test/resolve/wait-epipe.js
61 lines · 5.6 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 {setImmediate} from 'node:timers/promises';TweaksSindre Sorhusbefore adoption698a1b8
lines 3–4why, one step back3import test from 'node:test';4import {assertRejects} from '../helpers/assert.js';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 5–18why, one step back5import {execa} from '../../index.js';6import {setFixtureDirectory} from '../helpers/fixtures-directory.js';7import {assertEpipe} from '../helpers/stdio.js';8import {foobarString} from '../helpers/input.js';9import {noopWritable, noopDuplex} from '../helpers/stream.js';10import {11 endOptionStream,12 destroyOptionStream,13 destroySubprocessStream,14 getStreamStdio,15} from '../helpers/wait.js';1617setFixtureDirectory();18TweaksSindre Sorhusbefore adoption698a1b8
line 19why, one step back19const testStreamEpipeFail = async (streamMethod, stream, fdNumber, useTransform) => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 20–24why, one step back20 const subprocess = execa('noop-stdin-fd.js', [`${fdNumber}`], getStreamStdio(fdNumber, stream, useTransform));21 streamMethod({stream, subprocess, fdNumber});22 await setImmediate();23 subprocess.stdin.end(foobarString);24TweaksSindre Sorhusbefore adoption698a1b8
lines 25–29why, one step back25 const {exitCode, stdio, stderr} = await assertRejects(subprocess);26 assert.equal(exitCode, 1);27 assert.equal(stdio[fdNumber], '');28 assert.equal(stream.destroyed, true);29 assertEpipe(stderr, fdNumber);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 30–31why, one step back30};31TweaksSindre Sorhusbefore adoption698a1b8
lines 32–61why, one step back32test('Throws EPIPE when stdout option ends with more writes', () => testStreamEpipeFail(endOptionStream, noopWritable(), 1, false));33test('Throws EPIPE when stdout option aborts with more writes', () => testStreamEpipeFail(destroyOptionStream, noopWritable(), 1, false));34test('Throws EPIPE when stdout option Duplex aborts with more writes', () => testStreamEpipeFail(destroyOptionStream, noopDuplex(), 1, false));35test('Throws EPIPE when stderr option ends with more writes', () => testStreamEpipeFail(endOptionStream, noopWritable(), 2, false));36test('Throws EPIPE when stderr option aborts with more writes', () => testStreamEpipeFail(destroyOptionStream, noopWritable(), 2, false));37test('Throws EPIPE when stderr option Duplex aborts with more writes', () => testStreamEpipeFail(destroyOptionStream, noopDuplex(), 2, false));38test('Throws EPIPE when output stdio[*] option ends with more writes', () => testStreamEpipeFail(endOptionStream, noopWritable(), 3, false));39test('Throws EPIPE when output stdio[*] option aborts with more writes', () => testStreamEpipeFail(destroyOptionStream, noopWritable(), 3, false));40test('Throws EPIPE when output stdio[*] option Duplex aborts with more writes', () => testStreamEpipeFail(destroyOptionStream, noopDuplex(), 3, false));41test('Throws EPIPE when subprocess.stdout aborts with more writes', () => testStreamEpipeFail(destroySubprocessStream, noopWritable(), 1, false));42test('Throws EPIPE when subprocess.stdout Duplex aborts with more writes', () => testStreamEpipeFail(destroySubprocessStream, noopDuplex(), 1, false));43test('Throws EPIPE when subprocess.stderr aborts with more writes', () => testStreamEpipeFail(destroySubprocessStream, noopWritable(), 2, false));44test('Throws EPIPE when subprocess.stderr Duplex aborts with more writes', () => testStreamEpipeFail(destroySubprocessStream, noopDuplex(), 2, false));45test('Throws EPIPE when output subprocess.stdio[*] aborts with more writes', () => testStreamEpipeFail(destroySubprocessStream, noopWritable(), 3, false));46test('Throws EPIPE when output subprocess.stdio[*] Duplex aborts with more writes', () => testStreamEpipeFail(destroySubprocessStream, noopDuplex(), 3, false));47test('Throws EPIPE when stdout option ends with more writes, with a transform', () => testStreamEpipeFail(endOptionStream, noopWritable(), 1, true));48test('Throws EPIPE when stdout option aborts with more writes, with a transform', () => testStreamEpipeFail(destroyOptionStream, noopWritable(), 1, true));49test('Throws EPIPE when stdout option Duplex aborts with more writes, with a transform', () => testStreamEpipeFail(destroyOptionStream, noopDuplex(), 1, true));50test('Throws EPIPE when stderr option ends with more writes, with a transform', () => testStreamEpipeFail(endOptionStream, noopWritable(), 2, true));51test('Throws EPIPE when stderr option aborts with more writes, with a transform', () => testStreamEpipeFail(destroyOptionStream, noopWritable(), 2, true));52test('Throws EPIPE when stderr option Duplex aborts with more writes, with a transform', () => testStreamEpipeFail(destroyOptionStream, noopDuplex(), 2, true));53test('Throws EPIPE when output stdio[*] option ends with more writes, with a transform', () => testStreamEpipeFail(endOptionStream, noopWritable(), 3, true));54test('Throws EPIPE when output stdio[*] option aborts with more writes, with a transform', () => testStreamEpipeFail(destroyOptionStream, noopWritable(), 3, true));55test('Throws EPIPE when output stdio[*] option Duplex aborts with more writes, with a transform', () => testStreamEpipeFail(destroyOptionStream, noopDuplex(), 3, true));56test('Throws EPIPE when subprocess.stdout aborts with more writes, with a transform', () => testStreamEpipeFail(destroySubprocessStream, noopWritable(), 1, true));57test('Throws EPIPE when subprocess.stdout Duplex aborts with more writes, with a transform', () => testStreamEpipeFail(destroySubprocessStream, noopDuplex(), 1, true));58test('Throws EPIPE when subprocess.stderr aborts with more writes, with a transform', () => testStreamEpipeFail(destroySubprocessStream, noopWritable(), 2, true));59test('Throws EPIPE when subprocess.stderr Duplex aborts with more writes, with a transform', () => testStreamEpipeFail(destroySubprocessStream, noopDuplex(), 2, true));60test('Throws EPIPE when output subprocess.stdio[*] aborts with more writes, with a transform', () => testStreamEpipeFail(destroySubprocessStream, noopWritable(), 3, true));61test('Throws EPIPE when output subprocess.stdio[*] Duplex aborts with more writes, with a transform', () => testStreamEpipeFail(destroySubprocessStream, noopDuplex(), 3, true));