Skip to content
Myr

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 file

Take it

Rename files (#977)ehmickybefore adoption4b2e316

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

Upgrade xo (#980)ehmickybefore adoptionccfa412

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

Rename files (#977)ehmickybefore adoption4b2e316

line 5why, one step back
5

Upgrade xo (#980)ehmickybefore adoptionccfa412

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

Rename files (#977)ehmickybefore adoption4b2e316

lines 7–26why, one step back
7
8const 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('execa() returns a promise with pid', async t => {23 const subprocess = execa('noop.js', ['foo']);24 t.is(typeof subprocess.pid, 'number');25 await subprocess;26});