Skip to content
Myr

node.js

This file

Path

test/node.js

46 lines · 1.2 KiB · JavaScript

Last changed by

Fix lintingehmickybefore adoption2752f49

History of this file

Take it

Fix lintingehmickybefore adoption2752f49

line 1why, one step back
1import path from 'path';

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 2–24why, one step back
2import test from 'ava';
3import pEvent from 'p-event';4import execa from '..';56process.env.PATH = path.join(__dirname, 'fixtures') + path.delimiter + process.env.PATH;78test('node()', async t => {9 const {exitCode} = await execa.node('test/fixtures/noop');10 t.is(exitCode, 0);11});1213test('node pipe stdout', async t => {14 const {stdout} = await execa.node('test/fixtures/noop', ['foo'], {15 stdout: 'pipe'16 });1718 t.is(stdout, 'foo');19});2021test('node correctly use nodePath', async t => {22 const {stdout} = await execa.node(process.platform === 'win32' ? 'hello.cmd' : 'hello.sh', {23 stdout: 'pipe',24 nodePath: process.platform === 'win32' ? 'cmd.exe' : 'bash',

Rename `nodeArguments` to `nodeOptions` (#299)ehmickybefore adoptionb979534

line 25why, one step back
25 nodeOptions: process.platform === 'win32' ? ['/c'] : []

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 26–30why, one step back
26 });
2728 t.is(stdout, 'Hello World');29});30

Rename `nodeArguments` to `nodeOptions` (#299)ehmickybefore adoptionb979534

line 31why, one step back
31test('node pass on nodeOptions', async t => {

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 32–33why, one step back
32 const {stdout} = await execa.node('console.log("foo")', {
33 stdout: 'pipe',

Rename `nodeArguments` to `nodeOptions` (#299)ehmickybefore adoptionb979534

line 34why, one step back
34 nodeOptions: ['-e']

Add `.node()` method (#200)Guillaume Martignybefore adoptionc2f5edf

lines 35–46why, one step back
35 });
3637 t.is(stdout, 'foo');38});3940test('node\'s forked script has a communication channel', async t => {41 const subprocess = execa.node('test/fixtures/send');42 subprocess.send('ping');4344 const message = await pEvent(subprocess, 'message');45 t.is(message, 'pong');46});