pipeline.js
This file
Path
test/io/pipeline.js
42 lines · 2.2 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
lines 1–3why, one step back1import assert from 'node:assert/strict';2import test from 'node:test';3import {assertRejects, assertLike} from '../helpers/assert.js';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 4–6why, one step back4import {execa} from '../../index.js';5import {getStdio, STANDARD_STREAMS} from '../helpers/stdio.js';6import {setFixtureDirectory} from '../helpers/fixtures-directory.js';Add `result.ipc`/`error.ipc` (#1067)ehmickybefore adoption3ab34de
line 7why, one step back7import {getEarlyErrorSubprocess, expectedEarlyError} from '../helpers/early-error.js';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 8–10why, one step back89setFixtureDirectory();10TweaksSindre Sorhusbefore adoption698a1b8
line 11why, one step back11const testDestroyStandard = async fdNumber => {100% test coverage (#1018)ehmickybefore adoption9f65b86
line 12why, one step back12 const subprocess = execa('forever.js', {...getStdio(fdNumber, [STANDARD_STREAMS[fdNumber], 'pipe']), timeout: 1});TweaksSindre Sorhusbefore adoption698a1b8
lines 13–14why, one step back13 await assertRejects(subprocess, {message: /timed out/});14 assert.ok(!STANDARD_STREAMS[fdNumber].destroyed);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 15–16why, one step back15};16TweaksSindre Sorhusbefore adoption698a1b8
lines 17–19why, one step back17test('Does not destroy process.stdin on subprocess errors', () => testDestroyStandard(0));18test('Does not destroy process.stdout on subprocess errors', () => testDestroyStandard(1));19test('Does not destroy process.stderr on subprocess errors', () => testDestroyStandard(2));100% test coverage (#1018)ehmickybefore adoption9f65b86
line 20why, one step back20TweaksSindre Sorhusbefore adoption698a1b8
lines 21–24why, one step back21const testDestroyStandardSpawn = async fdNumber => {22 const error = await assertRejects(getEarlyErrorSubprocess(getStdio(fdNumber, [STANDARD_STREAMS[fdNumber], 'pipe'])));23 assertLike(error, expectedEarlyError);24 assert.ok(!STANDARD_STREAMS[fdNumber].destroyed);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 25–26why, one step back25};26TweaksSindre Sorhusbefore adoption698a1b8
lines 27–29why, one step back27test('Does not destroy process.stdin on subprocess early errors', () => testDestroyStandardSpawn(0));28test('Does not destroy process.stdout on subprocess early errors', () => testDestroyStandardSpawn(1));29test('Does not destroy process.stderr on subprocess early errors', () => testDestroyStandardSpawn(2));100% test coverage (#1018)ehmickybefore adoption9f65b86
line 30why, one step back30TweaksSindre Sorhusbefore adoption698a1b8
line 31why, one step back31const testDestroyStandardStream = async fdNumber => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 32–35why, one step back32 const subprocess = execa('forever.js', getStdio(fdNumber, [STANDARD_STREAMS[fdNumber], 'pipe']));33 const cause = new Error('test');34 subprocess.stdio[fdNumber].destroy(cause);35 subprocess.kill();TweaksSindre Sorhusbefore adoption698a1b8
lines 36–37why, one step back36 assertLike(await assertRejects(subprocess), {cause});37 assert.ok(!STANDARD_STREAMS[fdNumber].destroyed);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 38–39why, one step back38};39TweaksSindre Sorhusbefore adoption698a1b8
lines 40–42why, one step back40test('Does not destroy process.stdin on stream subprocess errors', () => testDestroyStandardStream(0));41test('Does not destroy process.stdout on stream subprocess errors', () => testDestroyStandardStream(1));42test('Does not destroy process.stderr on stream subprocess errors', () => testDestroyStandardStream(2));