Skip to content
Myr

shell.js

This file

Path

test/arguments/shell.js

27 lines · 922 bytes · JavaScript

Last changed by

Upgrade xo (#980)ehmickybefore adoptionccfa412

History of this file

Take it

Split files into smaller ones (#976)ehmickybefore adoptiond7c6853

lines 1–5why, one step back
1import process from 'node:process';
2import {pathToFileURL} from 'node:url';3import test from 'ava';4import which from 'which';5import {execa} from '../../index.js';

Upgrade xo (#980)ehmickybefore adoptionccfa412

line 6why, one step back
6import {setFixtureDirectory} from '../helpers/fixtures-directory.js';

Split files into smaller ones (#976)ehmickybefore adoptiond7c6853

lines 7–8why, one step back
7import {identity} from '../helpers/stdio.js';
8

Upgrade xo (#980)ehmickybefore adoptionccfa412

line 9why, one step back
9setFixtureDirectory();

Split files into smaller ones (#976)ehmickybefore adoptiond7c6853

lines 10–27why, one step back
10process.env.FOO = 'foo';
1112const isWindows = process.platform === 'win32';1314test('can use `options.shell: true`', async t => {15 const {stdout} = await execa('node test/fixtures/noop.js foo', {shell: true});16 t.is(stdout, 'foo');17});1819const testShellPath = async (t, mapPath) => {20 const shellPath = isWindows ? 'cmd.exe' : 'bash';21 const shell = mapPath(await which(shellPath));22 const {stdout} = await execa('node test/fixtures/noop.js foo', {shell});23 t.is(stdout, 'foo');24};2526test('can use `options.shell: string`', testShellPath, identity);27test('can use `options.shell: file URL`', testShellPath, pathToFileURL);