throw.js
This file
Path
test/pipe/throw.js
38 lines · 1.3 KiB · JavaScript
Last changed by
Upgrade xo (#980)ehmickybefore adoptionccfa412
History of this fileTake it
Split files into smaller ones (#976)ehmickybefore adoptiond7c6853
lines 1–3why, one step back1import test from 'ava';2import {execa} from '../../index.js';3import {foobarString} from '../helpers/input.js';Upgrade xo (#980)ehmickybefore adoptionccfa412
line 4why, one step back4import {setFixtureDirectory} from '../helpers/fixtures-directory.js';Split files into smaller ones (#976)ehmickybefore adoptiond7c6853
lines 5–6why, one step back5import {assertPipeError} from '../helpers/pipe.js';6Upgrade xo (#980)ehmickybefore adoptionccfa412
line 7why, one step back7setFixtureDirectory();Split files into smaller ones (#976)ehmickybefore adoptiond7c6853
lines 8–38why, one step back89test('Destination stream is ended when first argument is invalid', async t => {10 const source = execa('empty.js', {stdout: 'ignore'});11 const destination = execa('stdin.js');12 const pipePromise = source.pipe(destination);1314 await assertPipeError(t, pipePromise, 'option is incompatible');15 await source;16 t.like(await destination, {stdout: ''});17});1819test('Destination stream is ended when first argument is invalid - $', async t => {20 const pipePromise = execa('empty.js', {stdout: 'ignore'}).pipe`stdin.js`;21 await assertPipeError(t, pipePromise, 'option is incompatible');22});2324test('Source stream is aborted when second argument is invalid', async t => {25 const source = execa('noop.js', [foobarString]);26 const pipePromise = source.pipe(false);2728 await assertPipeError(t, pipePromise, 'an Execa subprocess');29 t.like(await source, {stdout: ''});30});3132test('Both arguments might be invalid', async t => {33 const source = execa('empty.js', {stdout: 'ignore'});34 const pipePromise = source.pipe(false);3536 await assertPipeError(t, pipePromise, 'an Execa subprocess');37 t.like(await source, {stdout: undefined});38});