script.js
This file
Path
test/script.js
59 lines · 2.0 KiB · JavaScript
Last changed by
Allow template strings with all methods (#933)ehmickybefore adoption8074d85
History of this fileTake it
Split files (#791)ehmickybefore adoption932fb26
lines 1–4why, one step back1import test from 'ava';2import {isStream} from 'is-stream';3import {$} from '../index.js';4import {setFixtureDir} from './helpers/fixtures-dir.js';Allow template strings with all methods (#933)ehmickybefore adoption8074d85
line 5why, one step back5import {foobarString} from './helpers/input.js';Split files (#791)ehmickybefore adoption932fb26
lines 6–8why, one step back67setFixtureDir();8Rename `spawned` and `child process` to `subprocess` (#897)ehmickybefore adoption8fe2343
lines 9–10why, one step back9const testScriptStdoutSync = (t, getSubprocess, expectedStdout) => {10 const {stdout} = getSubprocess();Allow newlines in `$` (#843)ehmickybefore adoption1315486
lines 11–12why, one step back11 t.is(stdout, expectedStdout);12};Split files (#791)ehmickybefore adoption932fb26
line 13why, one step back13Allow template strings with all methods (#933)ehmickybefore adoption8074d85
lines 14–17why, one step back14test('$.sync`...`', testScriptStdoutSync, () => $.sync`echo.js foo bar`, 'foo\nbar');15test('$.s`...`', testScriptStdoutSync, () => $.s`echo.js foo bar`, 'foo\nbar');16test('$(options).sync`...`', testScriptStdoutSync, () => $({stripFinalNewline: false}).sync`echo.js ${foobarString}`, `${foobarString}\n`);17test('$.sync(options)`...`', testScriptStdoutSync, () => $.sync({stripFinalNewline: false})`echo.js ${foobarString}`, `${foobarString}\n`);Split files (#791)ehmickybefore adoption932fb26
line 18why, one step back18Allow template strings with all methods (#933)ehmickybefore adoption8074d85
lines 19–21why, one step back19test('Cannot call $.sync.sync', t => {20 t.false('sync' in $.sync);21});Split files (#791)ehmickybefore adoption932fb26
line 22why, one step back22Allow template strings with all methods (#933)ehmickybefore adoption8074d85
lines 23–25why, one step back23test('Cannot call $.sync(options).sync', t => {24 t.false('sync' in $.sync({}));25});Split files (#791)ehmickybefore adoption932fb26
line 26why, one step back26Allow template strings with all methods (#933)ehmickybefore adoption8074d85
lines 27–30why, one step back27test('$(options)() stdin defaults to "inherit"', async t => {28 const {stdout} = await $({input: foobarString})('stdin-script.js');29 t.is(stdout, foobarString);30});Split files (#791)ehmickybefore adoption932fb26
line 31why, one step back31Allow template strings with all methods (#933)ehmickybefore adoption8074d85
lines 32–34why, one step back32test('$.sync(options)() stdin defaults to "inherit"', t => {33 const {stdout} = $.sync({input: foobarString})('stdin-script.js');34 t.is(stdout, foobarString);Split files (#791)ehmickybefore adoption932fb26
lines 35–36why, one step back35});36Allow template strings with all methods (#933)ehmickybefore adoption8074d85
lines 37–39why, one step back37test('$(options).sync() stdin defaults to "inherit"', t => {38 const {stdout} = $({input: foobarString}).sync('stdin-script.js');39 t.is(stdout, foobarString);Improve input validation (#838)ehmickybefore adoption8ee137c
lines 40–41why, one step back40});41Allow template strings with all methods (#933)ehmickybefore adoption8074d85
lines 42–44why, one step back42test('$(options)`...` stdin defaults to "inherit"', async t => {43 const {stdout} = await $({input: foobarString})`stdin-script.js`;44 t.is(stdout, foobarString);Split files (#791)ehmickybefore adoption932fb26
lines 45–46why, one step back45});46Allow template strings with all methods (#933)ehmickybefore adoption8074d85
lines 47–49why, one step back47test('$.sync(options)`...` stdin defaults to "inherit"', t => {48 const {stdout} = $.sync({input: foobarString})`stdin-script.js`;49 t.is(stdout, foobarString);Split files (#791)ehmickybefore adoption932fb26
lines 50–51why, one step back50});51Allow template strings with all methods (#933)ehmickybefore adoption8074d85
lines 52–54why, one step back52test('$(options).sync`...` stdin defaults to "inherit"', t => {53 const {stdout} = $({input: foobarString}).sync`stdin-script.js`;54 t.is(stdout, foobarString);Split files (#791)ehmickybefore adoption932fb26
lines 55–59why, one step back55});5657test('$ stdin has no default value when stdio is set', t => {58 t.true(isStream($({stdio: 'pipe'})`noop.js`.stdin));59});