Skip to content
Myr

command.js

This file

Path

test/command.js

340 lines · 11.1 KiB · JavaScript

Last changed by

Add `$.s` as an alias for `$.sync` (#594)ehmickybefore adoptionb719fb0

History of this file

Take it

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

line 1why, one step back
1import {inspect} from 'node:util';

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

line 2why, one step back
2import test from 'ava';

Fix default value of `stdin` with `$` (#550)ehmickybefore adoption6fe7e51

line 3why, one step back
3import {isStream} from 'is-stream';

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 4why, one step back
4import {execa, execaSync, execaCommand, execaCommandSync, $} from '../index.js';

Re-enable Windows in CI (#500)ehmickybefore adoption071d0a2

line 5why, one step back
5import {setFixtureDir} from './helpers/fixtures-dir.js';

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

line 6why, one step back
6

Re-enable Windows in CI (#500)ehmickybefore adoption071d0a2

line 7why, one step back
7setFixtureDir();

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 8–9why, one step back
8
9const command = async (t, expected, ...args) => {

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 10–11why, one step back
10 const {command: failCommand} = await t.throwsAsync(execa('fail.js', args));
11 t.is(failCommand, `fail.js${expected}`);

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

line 12why, one step back
12

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 13–14why, one step back
13 const {command} = await execa('noop.js', args);
14 t.is(command, `noop.js${expected}`);

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 15–22why, one step back
15};
1617command.title = (message, expected) => `command is: ${JSON.stringify(expected)}`;1819test(command, ' foo bar', 'foo', 'bar');20test(command, ' baz quz', 'baz', 'quz');21test(command, '');22

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

line 23why, one step back
23const testEscapedCommand = async (t, expected, args) => {

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 24–25why, one step back
24 const {escapedCommand: failEscapedCommand} = await t.throwsAsync(execa('fail.js', args));
25 t.is(failEscapedCommand, `fail.js ${expected}`);

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

lines 26–27why, one step back
26
27 const {escapedCommand: failEscapedCommandSync} = t.throws(() => {

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 28why, one step back
28 execaSync('fail.js', args);

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

line 29why, one step back
29 });

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 30why, one step back
30 t.is(failEscapedCommandSync, `fail.js ${expected}`);

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

line 31why, one step back
31

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 32–33why, one step back
32 const {escapedCommand} = await execa('noop.js', args);
33 t.is(escapedCommand, `noop.js ${expected}`);

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

line 34why, one step back
34

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 35–36why, one step back
35 const {escapedCommand: escapedCommandSync} = execaSync('noop.js', args);
36 t.is(escapedCommandSync, `noop.js ${expected}`);

Add `.escapedCommand` property (#466)ehmickybefore adoption712bafc

lines 37–45why, one step back
37};
3839testEscapedCommand.title = (message, expected) => `escapedCommand is: ${JSON.stringify(expected)}`;4041test(testEscapedCommand, 'foo bar', ['foo', 'bar']);42test(testEscapedCommand, '"foo bar"', ['foo bar']);43test(testEscapedCommand, '"\\"foo\\""', ['"foo"']);44test(testEscapedCommand, '"*"', ['*']);45

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

line 46why, one step back
46test('allow commands with spaces and no array arguments', async t => {

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 47why, one step back
47 const {stdout} = await execa('command with space.js');

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 48–51why, one step back
48 t.is(stdout, '');
49});5051test('allow commands with spaces and array arguments', async t => {

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 52why, one step back
52 const {stdout} = await execa('command with space.js', ['foo', 'bar']);

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 53–55why, one step back
53 t.is(stdout, 'foo\nbar');
54});55

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 56why, one step back
56test('execaCommand()', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 57why, one step back
57 const {stdout} = await execaCommand('echo.js foo bar');

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 58–60why, one step back
58 t.is(stdout, 'foo\nbar');
59});60

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 61why, one step back
61test('execaCommand() ignores consecutive spaces', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 62why, one step back
62 const {stdout} = await execaCommand('echo.js foo bar');

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 63–65why, one step back
63 t.is(stdout, 'foo\nbar');
64});65

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

lines 66–67why, one step back
66test('execaCommand() allows escaping spaces in commands', async t => {
67 const {stdout} = await execaCommand('command\\ with\\ space.js foo bar');

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 68–70why, one step back
68 t.is(stdout, 'foo\nbar');
69});70

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 71why, one step back
71test('execaCommand() allows escaping spaces in arguments', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 72why, one step back
72 const {stdout} = await execaCommand('echo.js foo\\ bar');

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 73–75why, one step back
73 t.is(stdout, 'foo bar');
74});75

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 76why, one step back
76test('execaCommand() escapes other whitespaces', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 77why, one step back
77 const {stdout} = await execaCommand('echo.js foo\tbar');

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 78–80why, one step back
78 t.is(stdout, 'foo\tbar');
79});80

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 81why, one step back
81test('execaCommand() trims', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 82why, one step back
82 const {stdout} = await execaCommand(' echo.js foo bar ');

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

lines 83–85why, one step back
83 t.is(stdout, 'foo\nbar');
84});85

Require Node.js 12.20 and move to ESM (#478)Minh Nguyenbefore adoption7707880

line 86why, one step back
86test('execaCommandSync()', t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 87why, one step back
87 const {stdout} = execaCommandSync('echo.js foo bar');

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

line 88why, one step back
88 t.is(stdout, 'foo\nbar');

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 89–91why, one step back
89});
9091test('$', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 92why, one step back
92 const {stdout} = await $`echo.js foo bar`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 93–101why, one step back
93 t.is(stdout, 'foo\nbar');
94});9596test('$ accepts options', async t => {97 const {stdout} = await $({stripFinalNewline: true})`noop.js foo`;98 t.is(stdout, 'foo');99});100101test('$ allows string interpolation', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 102why, one step back
102 const {stdout} = await $`echo.js foo ${'bar'}`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 103–105why, one step back
103 t.is(stdout, 'foo\nbar');
104});105

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

line 106why, one step back
106test('$ allows number interpolation', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 107why, one step back
107 const {stdout} = await $`echo.js 1 ${2}`;

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 108–110why, one step back
108 t.is(stdout, '1\n2');
109});110

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 111why, one step back
111test('$ allows array interpolation', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 112why, one step back
112 const {stdout} = await $`echo.js ${['foo', 'bar']}`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 113–115why, one step back
113 t.is(stdout, 'foo\nbar');
114});115

Fix argument concatenation with `$` (#553)ehmickybefore adoption07585d0

lines 116–120why, one step back
116test('$ allows empty array interpolation', async t => {
117 const {stdout} = await $`echo.js foo ${[]} bar`;118 t.is(stdout, 'foo\nbar');119});120

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

line 121why, one step back
121test('$ allows execa return value interpolation', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

lines 122–123why, one step back
122 const foo = await $`echo.js foo`;
123 const {stdout} = await $`echo.js ${foo} bar`;

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 124–127why, one step back
124 t.is(stdout, 'foo\nbar');
125});126127test('$ allows execa return value array interpolation', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

lines 128–129why, one step back
128 const foo = await $`echo.js foo`;
129 const {stdout} = await $`echo.js ${[foo, 'bar']}`;

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 130–133why, one step back
130 t.is(stdout, 'foo\nbar');
131});132133test('$ allows execa return value buffer interpolation', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

lines 134–135why, one step back
134 const foo = await $({encoding: null})`echo.js foo`;
135 const {stdout} = await $`echo.js ${foo} bar`;

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 136–139why, one step back
136 t.is(stdout, 'foo\nbar');
137});138139test('$ allows execa return value buffer array interpolation', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

lines 140–141why, one step back
140 const foo = await $({encoding: null})`echo.js foo`;
141 const {stdout} = await $`echo.js ${[foo, 'bar']}`;

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 142–144why, one step back
142 t.is(stdout, 'foo\nbar');
143});144

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 145why, one step back
145test('$ ignores consecutive spaces', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 146why, one step back
146 const {stdout} = await $`echo.js foo bar`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 147–150why, one step back
147 t.is(stdout, 'foo\nbar');
148});149150test('$ allows escaping spaces with interpolation', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 151why, one step back
151 const {stdout} = await $`echo.js ${'foo bar'}`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 152–155why, one step back
152 t.is(stdout, 'foo bar');
153});154155test('$ disallows escaping spaces with backslashes', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 156why, one step back
156 const {stdout} = await $`echo.js foo\\ bar`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 157–160why, one step back
157 t.is(stdout, 'foo\\\nbar');
158});159160test('$ allows space escaped values in array interpolation', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 161why, one step back
161 const {stdout} = await $`echo.js ${['foo', 'bar baz']}`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 162–165why, one step back
162 t.is(stdout, 'foo\nbar baz');
163});164165test('$ passes newline escape sequence as one argument', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 166why, one step back
166 const {stdout} = await $`echo.js \n`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 167–170why, one step back
167 t.is(stdout, '\n');
168});169170test('$ passes newline escape sequence in interpolation as one argument', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 171why, one step back
171 const {stdout} = await $`echo.js ${'\n'}`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 172–175why, one step back
172 t.is(stdout, '\n');
173});174175test('$ handles invalid escape sequence', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 176why, one step back
176 const {stdout} = await $`echo.js \u`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

line 177why, one step back
177 t.is(stdout, '\\u');

Fix argument concatenation with `$` (#553)ehmickybefore adoption07585d0

lines 178–217why, one step back
178});
179180test('$ can concatenate at the end of tokens', async t => {181 const {stdout} = await $`echo.js foo${'bar'}`;182 t.is(stdout, 'foobar');183});184185test('$ does not concatenate at the end of tokens with a space', async t => {186 const {stdout} = await $`echo.js foo ${'bar'}`;187 t.is(stdout, 'foo\nbar');188});189190test('$ can concatenate at the end of tokens followed by an array', async t => {191 const {stdout} = await $`echo.js foo${['bar', 'foo']}`;192 t.is(stdout, 'foobar\nfoo');193});194195test('$ can concatenate at the start of tokens', async t => {196 const {stdout} = await $`echo.js ${'foo'}bar`;197 t.is(stdout, 'foobar');198});199200test('$ does not concatenate at the start of tokens with a space', async t => {201 const {stdout} = await $`echo.js ${'foo'} bar`;202 t.is(stdout, 'foo\nbar');203});204205test('$ can concatenate at the start of tokens followed by an array', async t => {206 const {stdout} = await $`echo.js ${['foo', 'bar']}foo`;207 t.is(stdout, 'foo\nbarfoo');208});209210test('$ can concatenate at the start and end of tokens followed by an array', async t => {211 const {stdout} = await $`echo.js foo${['bar', 'foo']}bar`;212 t.is(stdout, 'foobar\nfoobar');213});214215test('$ can concatenate multiple tokens', async t => {216 const {stdout} = await $`echo.js ${'foo'}bar${'foo'}`;217 t.is(stdout, 'foobarfoo');

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 218–225why, one step back
218});
219220test('$ allows escaping spaces in commands with interpolation', async t => {221 const {stdout} = await $`${'command with space.js'} foo bar`;222 t.is(stdout, 'foo\nbar');223});224225test('$ escapes other whitespaces', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 226why, one step back
226 const {stdout} = await $`echo.js foo\tbar`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 227–230why, one step back
227 t.is(stdout, 'foo\tbar');
228});229230test('$ trims', async t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 231why, one step back
231 const {stdout} = await $` echo.js foo bar `;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 232–235why, one step back
232 t.is(stdout, 'foo\nbar');
233});234235test('$.sync', t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 236why, one step back
236 const {stdout} = $.sync`echo.js foo bar`;

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 237–239why, one step back
237 t.is(stdout, 'foo\nbar');
238});239

Add `$.s` as an alias for `$.sync` (#594)ehmickybefore adoptionb719fb0

lines 240–244why, one step back
240test('$.sync can be called $.s', t => {
241 const {stdout} = $.s`echo.js foo bar`;242 t.is(stdout, 'foo\nbar');243});244

Add `$` tagged templates API (#510)Aaron Casanovabefore adoptioneae327c

lines 245–247why, one step back
245test('$.sync accepts options', t => {
246 const {stdout} = $({stripFinalNewline: true}).sync`noop.js foo`;247 t.is(stdout, 'foo');

Separate command-related logic into its own file (#329)ehmickybefore adoption46daa7b

line 248why, one step back
248});

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

line 249why, one step back
249

Improve validation of `$.sync` options binding (#551)ehmickybefore adoption881fbad

lines 250–253why, one step back
250test('$.sync must be used after options binding, not before', t => {
251 t.throws(() => $.sync({})`noop.js`, {message: /Please use/});252});253

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

line 254why, one step back
254test('$.sync allows execa return value interpolation', t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

lines 255–256why, one step back
255 const foo = $.sync`echo.js foo`;
256 const {stdout} = $.sync`echo.js ${foo} bar`;

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 257–260why, one step back
257 t.is(stdout, 'foo\nbar');
258});259260test('$.sync allows execa return value array interpolation', t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

lines 261–262why, one step back
261 const foo = $.sync`echo.js foo`;
262 const {stdout} = $.sync`echo.js ${[foo, 'bar']}`;

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 263–266why, one step back
263 t.is(stdout, 'foo\nbar');
264});265266test('$.sync allows execa return value buffer interpolation', t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

lines 267–268why, one step back
267 const foo = $({encoding: null}).sync`echo.js foo`;
268 const {stdout} = $.sync`echo.js ${foo} bar`;

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 269–272why, one step back
269 t.is(stdout, 'foo\nbar');
270});271272test('$.sync allows execa return value buffer array interpolation', t => {

Simplify tests (#552)ehmickybefore adoption5fa61d8

lines 273–274why, one step back
273 const foo = $({encoding: null}).sync`echo.js foo`;
274 const {stdout} = $.sync`echo.js ${[foo, 'bar']}`;

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 275–280why, one step back
275 t.is(stdout, 'foo\nbar');
276});277278const invalidExpression = test.macro({279 async exec(t, input, expected) {280 await t.throwsAsync(

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 281why, one step back
281 async () => $`echo.js ${input}`,

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 282–285why, one step back
282 {instanceOf: TypeError, message: expected},
283 );284285 t.throws(

Simplify tests (#552)ehmickybefore adoption5fa61d8

line 286why, one step back
286 () => $.sync`echo.js ${input}`,

Allow `execa` return values in `$` template expressions (#528)Aaron Casanovabefore adoption58ea251

lines 287–326why, one step back
287 {instanceOf: TypeError, message: expected},
288 );289 },290 title(prettyInput, input, expected) {291 return `$ APIs throw on invalid '${prettyInput ?? inspect(input)}' expression with '${expected}'`;292 },293});294295test(invalidExpression, undefined, 'Unexpected "undefined" in template expression');296test(invalidExpression, [undefined], 'Unexpected "undefined" in template expression');297298test(invalidExpression, null, 'Unexpected "object" in template expression');299test(invalidExpression, [null], 'Unexpected "object" in template expression');300301test(invalidExpression, true, 'Unexpected "boolean" in template expression');302test(invalidExpression, [true], 'Unexpected "boolean" in template expression');303304test(invalidExpression, {}, 'Unexpected "object" in template expression');305test(invalidExpression, [{}], 'Unexpected "object" in template expression');306307test(invalidExpression, {foo: 'bar'}, 'Unexpected "object" in template expression');308test(invalidExpression, [{foo: 'bar'}], 'Unexpected "object" in template expression');309310test(invalidExpression, {stdout: undefined}, 'Unexpected "undefined" stdout in template expression');311test(invalidExpression, [{stdout: undefined}], 'Unexpected "undefined" stdout in template expression');312313test(invalidExpression, {stdout: 1}, 'Unexpected "number" stdout in template expression');314test(invalidExpression, [{stdout: 1}], 'Unexpected "number" stdout in template expression');315316test(invalidExpression, Promise.resolve(), 'Unexpected "object" in template expression');317test(invalidExpression, [Promise.resolve()], 'Unexpected "object" in template expression');318319test(invalidExpression, Promise.resolve({stdout: 'foo'}), 'Unexpected "object" in template expression');320test(invalidExpression, [Promise.resolve({stdout: 'foo'})], 'Unexpected "object" in template expression');321322test('$`noop.js`', invalidExpression, $`noop.js`, 'Unexpected "object" in template expression');323test('[ $`noop.js` ]', invalidExpression, [$`noop.js`], 'Unexpected "object" in template expression');324325test('$({stdio: \'inherit\'}).sync`noop.js`', invalidExpression, $({stdio: 'inherit'}).sync`noop.js`, 'Unexpected "undefined" stdout in template expression');326test('[ $({stdio: \'inherit\'}).sync`noop.js` ]', invalidExpression, [$({stdio: 'inherit'}).sync`noop.js`], 'Unexpected "undefined" stdout in template expression');

Fix default value of `stdin` with `$` (#550)ehmickybefore adoption6fe7e51

lines 327–340why, one step back
327
328test('$ stdin defaults to "inherit"', async t => {329 const {stdout} = await $({input: 'foo'})`stdin-script.js`;330 t.is(stdout, 'foo');331});332333test('$.sync stdin defaults to "inherit"', t => {334 const {stdout} = $({input: 'foo'}).sync`stdin-script.js`;335 t.is(stdout, 'foo');336});337338test('$ stdin has no default value when stdio is set', t => {339 t.true(isStream($({stdio: 'pipe'})`noop.js`.stdin));340});