Skip to content
Myr

shell.js

This file

Path

test/arguments/shell.js

28 lines · 1017 bytes · JavaScript

Last changed by

TweaksSindre Sorhusbefore adoption698a1b8

History of this file

Take it

The walk stopped after 200 commits: lines older than 9f65b86 point at it.

TweaksSindre Sorhusbefore adoption698a1b8

line 1why, one step back
1import assert from 'node:assert/strict';

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 2–3why, one step back
2import process from 'node:process';
3import {pathToFileURL} from 'node:url';

TweaksSindre Sorhusbefore adoption698a1b8

line 4why, one step back
4import test from 'node:test';

Use `which-command` instead of `which` (#1253)Sindre Sorhusbefore adoption9a7a162

line 5why, one step back
5import {whichCommand} from 'which-command';

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 6–14why, one step back
6import {execa} from '../../index.js';
7import {setFixtureDirectory} from '../helpers/fixtures-directory.js';8import {identity} from '../helpers/stdio.js';910setFixtureDirectory();11process.env.FOO = 'foo';1213const isWindows = process.platform === 'win32';14

TweaksSindre Sorhusbefore adoption698a1b8

line 15why, one step back
15test('can use `options.shell: true`', async () => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 16why, one step back
16 const {stdout} = await execa('node test/fixtures/noop.js foo', {shell: true});

TweaksSindre Sorhusbefore adoption698a1b8

line 17why, one step back
17 assert.equal(stdout, 'foo');

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 18–19why, one step back
18});
19

TweaksSindre Sorhusbefore adoption698a1b8

line 20why, one step back
20const testShellPath = async mapPath => {

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 21why, one step back
21 const shellPath = isWindows ? 'cmd.exe' : 'bash';

Use `which-command` instead of `which` (#1253)Sindre Sorhusbefore adoption9a7a162

line 22why, one step back
22 const shell = mapPath(await whichCommand(shellPath));

100% test coverage (#1018)ehmickybefore adoption9f65b86

line 23why, one step back
23 const {stdout} = await execa('node test/fixtures/noop.js foo', {shell});

TweaksSindre Sorhusbefore adoption698a1b8

line 24why, one step back
24 assert.equal(stdout, 'foo');

100% test coverage (#1018)ehmickybefore adoption9f65b86

lines 25–26why, one step back
25};
26

TweaksSindre Sorhusbefore adoption698a1b8

lines 27–28why, one step back
27test('can use `options.shell: string`', () => testShellPath(identity));
28test('can use `options.shell: file URL`', () => testShellPath(pathToFileURL));