main-async.js
This file
Path
test/methods/main-async.js
26 lines · 695 bytes · JavaScript
Last changed by
Upgrade xo (#980)ehmickybefore adoptionccfa412
History of this fileTake it
123456789101112131415161718192021222324252627import process from 'node:process';import test from 'ava';import {execa} from '../../index.js';import {setFixtureDirectory} from '../helpers/fixtures-directory.js';
setFixtureDirectory();
const isWindows = process.platform === 'win32';
if (isWindows) { test('execa() - cmd file', async t => { const {stdout} = await execa('hello.cmd'); t.is(stdout, 'Hello World'); });
test('execa() - run cmd command', async t => { const {stdout} = await execa('cmd', ['/c', 'hello.cmd']); t.is(stdout, 'Hello World'); });}
test('execa() returns a promise with pid', async t => { const subprocess = execa('noop.js', ['foo']); t.is(typeof subprocess.pid, 'number'); await subprocess;});