shell.js
This file
Path
test/arguments/shell.js
28 lines · 1017 bytes · JavaScript
Last changed by
TweaksSindre Sorhusbefore adoption698a1b8
History of this fileTake it
The walk stopped after 200 commits: lines older than 9f65b86 point at it.
TweaksSindre Sorhusbefore adoption698a1b8
line 1why, one step back1import assert from 'node:assert/strict';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 2–3why, one step back2import process from 'node:process';3import {pathToFileURL} from 'node:url';TweaksSindre Sorhusbefore adoption698a1b8
line 4why, one step back4import test from 'node:test';Use `which-command` instead of `which` (#1253)Sindre Sorhusbefore adoption9a7a162
line 5why, one step back5import {whichCommand} from 'which-command';100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 6–14why, one step back6import {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';14TweaksSindre Sorhusbefore adoption698a1b8
line 15why, one step back15test('can use `options.shell: true`', async () => {100% test coverage (#1018)ehmickybefore adoption9f65b86
line 16why, one step back16 const {stdout} = await execa('node test/fixtures/noop.js foo', {shell: true});TweaksSindre Sorhusbefore adoption698a1b8
line 17why, one step back17 assert.equal(stdout, 'foo');100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 18–19why, one step back18});19TweaksSindre Sorhusbefore adoption698a1b8
line 20why, one step back20const testShellPath = async mapPath => {100% test coverage (#1018)ehmickybefore adoption9f65b86
line 21why, one step back21 const shellPath = isWindows ? 'cmd.exe' : 'bash';Use `which-command` instead of `which` (#1253)Sindre Sorhusbefore adoption9a7a162
line 22why, one step back22 const shell = mapPath(await whichCommand(shellPath));100% test coverage (#1018)ehmickybefore adoption9f65b86
line 23why, one step back23 const {stdout} = await execa('node test/fixtures/noop.js foo', {shell});TweaksSindre Sorhusbefore adoption698a1b8
line 24why, one step back24 assert.equal(stdout, 'foo');100% test coverage (#1018)ehmickybefore adoption9f65b86
lines 25–26why, one step back25};26TweaksSindre Sorhusbefore adoption698a1b8
lines 27–28why, one step back27test('can use `options.shell: string`', () => testShellPath(identity));28test('can use `options.shell: file URL`', () => testShellPath(pathToFileURL));