output-sync.js
This file
Path
test/stdio/output-sync.js
33 lines · 1.0 KiB · JavaScript
Last changed by
Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
History of this fileTake it
Add support for transforms with `execaSync()` (#945)ehmickybefore adoptionc5f9f09
lines 1–33why, one step back1import test from 'ava';2import {execaSync} from '../../index.js';3import {setFixtureDir} from '../helpers/fixtures-dir.js';4import {throwingGenerator} from '../helpers/generator.js';5import {foobarString} from '../helpers/input.js';67setFixtureDir();89test('Handles errors with stdout generator, sync', t => {10 const cause = new Error(foobarString);11 const error = t.throws(() => {12 execaSync('noop.js', {stdout: throwingGenerator(cause)()});13 });14 t.is(error.cause, cause);15});1617test('Handles errors with stdout generator, spawn failure, sync', t => {18 const cause = new Error(foobarString);19 const error = t.throws(() => {20 execaSync('noop.js', {cwd: 'does_not_exist', stdout: throwingGenerator(cause)()});21 });22 t.true(error.failed);23 t.is(error.cause.code, 'ENOENT');24});2526test('Handles errors with stdout generator, subprocess failure, sync', t => {27 const cause = new Error(foobarString);28 const error = t.throws(() => {29 execaSync('noop-fail.js', ['1'], {stdout: throwingGenerator(cause)()});30 });31 t.true(error.failed);32 t.is(error.cause, cause);33});