output-sync.js
This file
Path
test/io/output-sync.js
35 lines · 1.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 {assertThrows} from '../helpers/assert.js';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 4–10why, one step back4import {execaSync} from '../../index.js';5import {setFixtureDirectory} from '../helpers/fixtures-directory.js';6import {throwingGenerator} from '../helpers/generator.js';7import {foobarString} from '../helpers/input.js';89setFixtureDirectory();10TweaksSindre Sorhusbefore adoption698a1b8
line 11why, one step back11test('Handles errors with stdout generator, sync', () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
line 12why, one step back12 const cause = new Error(foobarString);TweaksSindre Sorhusbefore adoption698a1b8
line 13why, one step back13 const error = assertThrows(() => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 14–15why, one step back14 execaSync('noop.js', {stdout: throwingGenerator(cause)()});15 });TweaksSindre Sorhusbefore adoption698a1b8
line 16why, one step back16 assert.equal(error.cause, cause);100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 17–18why, one step back17});18TweaksSindre Sorhusbefore adoption698a1b8
line 19why, one step back19test('Handles errors with stdout generator, spawn failure, sync', () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
line 20why, one step back20 const cause = new Error(foobarString);TweaksSindre Sorhusbefore adoption698a1b8
line 21why, one step back21 const error = assertThrows(() => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 22–23why, one step back22 execaSync('noop.js', {cwd: 'does_not_exist', stdout: throwingGenerator(cause)()});23 });TweaksSindre Sorhusbefore adoption698a1b8
lines 24–25why, one step back24 assert.equal(error.failed, true);25 assert.equal(error.cause.code, 'ENOENT');100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 26–27why, one step back26});27TweaksSindre Sorhusbefore adoption698a1b8
line 28why, one step back28test('Handles errors with stdout generator, subprocess failure, sync', () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
line 29why, one step back29 const cause = new Error(foobarString);TweaksSindre Sorhusbefore adoption698a1b8
line 30why, one step back30 const error = assertThrows(() => {100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 31–32why, one step back31 execaSync('noop-fail.js', ['1'], {stdout: throwingGenerator(cause)()});32 });TweaksSindre Sorhusbefore adoption698a1b8
lines 33–34why, one step back33 assert.equal(error.failed, true);34 assert.equal(error.cause, cause);100% test coverage (#1018)ehmickybefore adoption9f65b86
line 35why, one step back35});