async.js
This file
Path
test/async.js
36 lines · 981 bytes · JavaScript
Last changed by
Split files (#837)ehmickybefore adoption672c2d7
History of this fileTake it
Split files (#837)ehmickybefore adoption672c2d7
lines 1–36why, one step back1import process from 'node:process';2import test from 'ava';3import {execa, execaSync} from '../index.js';4import {setFixtureDir} from './helpers/fixtures-dir.js';56setFixtureDir();78const isWindows = process.platform === 'win32';910if (isWindows) {11 test('execa() - cmd file', async t => {12 const {stdout} = await execa('hello.cmd');13 t.is(stdout, 'Hello World');14 });1516 test('execa() - run cmd command', async t => {17 const {stdout} = await execa('cmd', ['/c', 'hello.cmd']);18 t.is(stdout, 'Hello World');19 });20}2122test('skip throwing when using reject option', async t => {23 const {exitCode} = await execa('fail.js', {reject: false});24 t.is(exitCode, 2);25});2627test('skip throwing when using reject option in sync mode', t => {28 const {exitCode} = execaSync('fail.js', {reject: false});29 t.is(exitCode, 2);30});3132test('execa() returns a promise with pid', async t => {33 const subprocess = execa('noop.js', ['foo']);34 t.is(typeof subprocess.pid, 'number');35 await subprocess;36});