input.js
This file
Path
test/stdio/input.js
43 lines · 2.5 KiB · JavaScript
Last changed by
Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce
History of this fileTake it
Validate `input` option's type (#668)ehmickybefore adoption65742c6
line 1why, one step back1import {Writable} from 'node:stream';Refactor tests (#628)ehmickybefore adoption30ecc81
line 2why, one step back2import test from 'ava';Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207
line 3why, one step back3import {execa, execaSync} from '../../index.js';Refactor tests (#628)ehmickybefore adoption30ecc81
line 4why, one step back4import {setFixtureDir} from '../helpers/fixtures-dir.js';Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207
line 5why, one step back5import {runExeca, runExecaSync, runScript, runScriptSync} from '../helpers/run.js';Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce
line 6why, one step back6import {foobarUint8Array, foobarBuffer, foobarArrayBuffer, foobarUint16Array, foobarDataView} from '../helpers/input.js';Refactor tests (#628)ehmickybefore adoption30ecc81
lines 7–14why, one step back78setFixtureDir();910const testInput = async (t, input, execaMethod) => {11 const {stdout} = await execaMethod('stdin.js', {input});12 t.is(stdout, 'foobar');13};14Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207
line 15why, one step back15test('input option can be a String', testInput, 'foobar', runExeca);Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce
line 16why, one step back16test('input option can be a Uint8Array', testInput, foobarUint8Array, runExeca);Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207
line 17why, one step back17test('input option can be a String - sync', testInput, 'foobar', runExecaSync);Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce
line 18why, one step back18test('input option can be a Uint8Array - sync', testInput, foobarUint8Array, runExecaSync);Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207
lines 19–20why, one step back19test('input option can be used with $', testInput, 'foobar', runScript);20test('input option can be used with $.sync', testInput, 'foobar', runScriptSync);Refactor tests (#628)ehmickybefore adoption30ecc81
line 21why, one step back21Validate `input` option's type (#668)ehmickybefore adoption65742c6
lines 22–23why, one step back22const testInvalidInput = async (t, input, execaMethod) => {23 t.throws(() => {Add `result.stdio` and `error.stdio` (#676)ehmickybefore adoption62a5207
line 24why, one step back24 execaMethod('empty.js', {input});Validate `input` option's type (#668)ehmickybefore adoption65742c6
lines 25–27why, one step back25 }, {message: /a string, a Uint8Array/});26};27Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce
lines 28–31why, one step back28test('input option cannot be a Buffer', testInvalidInput, foobarBuffer, execa);29test('input option cannot be an ArrayBuffer', testInvalidInput, foobarArrayBuffer, execa);30test('input option cannot be a DataView', testInvalidInput, foobarDataView, execa);31test('input option cannot be a Uint16Array', testInvalidInput, foobarUint16Array, execa);Validate `input` option's type (#668)ehmickybefore adoption65742c6
lines 32–35why, one step back32test('input option cannot be 0', testInvalidInput, 0, execa);33test('input option cannot be false', testInvalidInput, false, execa);34test('input option cannot be null', testInvalidInput, null, execa);35test('input option cannot be a non-Readable stream', testInvalidInput, new Writable(), execa);Allow any type with transforms (#709)ehmickybefore adoptioned8b2ce
lines 36–39why, one step back36test('input option cannot be a Buffer - sync', testInvalidInput, foobarBuffer, execaSync);37test('input option cannot be an ArrayBuffer - sync', testInvalidInput, foobarArrayBuffer, execaSync);38test('input option cannot be a DataView - sync', testInvalidInput, foobarDataView, execaSync);39test('input option cannot be a Uint16Array - sync', testInvalidInput, foobarUint16Array, execaSync);Validate `input` option's type (#668)ehmickybefore adoption65742c6
lines 40–43why, one step back40test('input option cannot be 0 - sync', testInvalidInput, 0, execaSync);41test('input option cannot be false - sync', testInvalidInput, false, execaSync);42test('input option cannot be null - sync', testInvalidInput, null, execaSync);43test('input option cannot be a non-Readable stream - sync', testInvalidInput, new Writable(), execaSync);