Skip to content
Myr

Add `node` option (#804)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by ehmicky · committed by GitHub · parent 2fd9351 · Browse files · 8 files+229 added−118 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

8 files+229 added−118 removed

  • tests:+121 added−50 removed
  • other:+108 added−68 removed

8 files+229 added−118 removed

added:lib/node.js+24 added
modified:test/fixtures/nested-node.js+6 added-3 removed
modified:test/node.js+115 added-38 removed
9 unmodified lines
10import {foobarString} from './helpers/input.js';1112process.chdir(FIXTURES_DIR);1314test('execaNode() succeeds', async t => {15 const {exitCode} = await execaNode('noop.js');14const runWithNodeOption = (file, args = [], options = {}) => execa(file, args, {...options, node: true});15const runWithNodeOptionSync = (file, args = [], options = {}) => execaSync(file, args, {...options, node: true});16const runWithIpc = (file, options) => execa('node', [file], {...options, ipc: true});1718const testNodeSuccess = async (t, execaMethod) => {19 const {exitCode, stdout} = await execaMethod('noop.js', [foobarString]);20 t.is(exitCode, 0);21 t.is(stdout, foobarString);17});22};2319test('execaNode() returns stdout', async t => {20 const {stdout} = await execaNode('noop.js', ['foo']);21 t.is(stdout, 'foo');24test('execaNode() succeeds', testNodeSuccess, execaNode);25test('The "node" option succeeds', testNodeSuccess, runWithNodeOption);26test('The "node" option succeeds - sync', testNodeSuccess, runWithNodeOptionSync);2728test('execaNode() cannot set the "node" option to false', t => {29 t.throws(() => {30 execaNode('empty.js', {node: false});31 }, {message: /The "node" option cannot be false/});32});3334const testDoubleNode = (t, execPath, execaMethod) => {35 t.throws(() => {36 execaMethod(execPath, ['noop.js']);37 }, {message: /does not need to be "node"/});38};3940test('Cannot use "node" as binary - execaNode()', testDoubleNode, 'node', execaNode);41test('Cannot use "node" as binary - "node" option', testDoubleNode, 'node', runWithNodeOption);42test('Cannot use "node" as binary - "node" option sync', testDoubleNode, 'node', runWithNodeOptionSync);43test('Cannot use path to "node" as binary - execaNode()', testDoubleNode, process.execPath, execaNode);44test('Cannot use path to "node" as binary - "node" option', testDoubleNode, process.execPath, runWithNodeOption);45test('Cannot use path to "node" as binary - "node" option sync', testDoubleNode, process.execPath, runWithNodeOptionSync);4647const getNodePath = async () => {48 const {path} = await getNode(TEST_NODE_VERSION);49 return path;50};5152const TEST_NODE_VERSION = '16.0.0';5331const testNodePath = async (t, mapPath) => {54const testNodePath = async (t, execaMethod, mapPath) => {55 const nodePath = mapPath(await getNodePath());33 const {stdout} = await execaNode('--version', {nodePath});56 const {stdout} = await execaMethod('--version', [], {nodePath});57 t.is(stdout, `v${TEST_NODE_VERSION}`);58};5937test.serial('The "nodePath" option can be used', testNodePath, identity);38test.serial('The "nodePath" option can be a file URL', testNodePath, pathToFileURL);60test.serial('The "nodePath" option can be used - execaNode()', testNodePath, execaNode, identity);61test.serial('The "nodePath" option can be a file URL - execaNode()', testNodePath, execaNode, pathToFileURL);62test.serial('The "nodePath" option can be used - "node" option', testNodePath, runWithNodeOption, identity);63test.serial('The "nodePath" option can be a file URL - "node" option', testNodePath, runWithNodeOption, pathToFileURL);6440test('The "nodePath" option defaults to the current Node.js binary', async t => {41 const {stdout} = await execaNode('--version');65const testNodePathDefault = async (t, execaMethod) => {66 const {stdout} = await execaMethod('--version');67 t.is(stdout, process.version);43});68};6970test('The "nodePath" option defaults to the current Node.js binary - execaNode()', testNodePathDefault, execaNode);71test('The "nodePath" option defaults to the current Node.js binary - "node" option', testNodePathDefault, runWithNodeOption);7273const testNodePathInvalid = (t, execaMethod) => {74 t.throws(() => {75 execaMethod('noop.js', [], {nodePath: true});76 }, {message: /The "nodePath" option must be a string or a file URL/});77};7879test('The "nodePath" option must be a string or URL - execaNode()', testNodePathInvalid, execaNode);80test('The "nodePath" option must be a string or URL - "node" option', testNodePathInvalid, runWithNodeOption);81test('The "nodePath" option must be a string or URL - "node" option sync', testNodePathInvalid, runWithNodeOptionSync);8283const nodePathArguments = ['node', ['-p', 'process.env.Path || process.env.PATH']];8485const testExecPath = async (t, mapPath) => {86 const execPath = mapPath(await getNodePath());
14 unmodified lines
101 const {stdout} = await execa(...nodePathArguments, {execPath});102 t.false(stdout.includes(TEST_NODE_VERSION));103});10467test('The "nodeOptions" option can be used', async t => {68 const {stdout} = await execaNode('empty.js', {nodeOptions: ['--version']});105const testNodeOptions = async (t, execaMethod) => {106 const {stdout} = await execaMethod('empty.js', [], {nodeOptions: ['--version']});107 t.is(stdout, process.version);70});108};109110test('The "nodeOptions" option can be used - execaNode()', testNodeOptions, execaNode);111test('The "nodeOptions" option can be used - "node" option', testNodeOptions, runWithNodeOption);11272const spawnNestedExecaNode = (realExecArgv, fakeExecArgv, nodeOptions) => execa(113const spawnNestedExecaNode = (realExecArgv, fakeExecArgv, execaMethod, nodeOptions) => execa(114 'node',74 [...realExecArgv, 'nested-node.js', fakeExecArgv, nodeOptions, 'noop.js', foobarString],115 [...realExecArgv, 'nested-node.js', fakeExecArgv, execaMethod, nodeOptions, 'noop.js', foobarString],116 {...fullStdio, cwd: FIXTURES_DIR},117);11878const testInspectRemoval = async (t, fakeExecArgv) => {79 const {stdout, stdio} = await spawnNestedExecaNode([], fakeExecArgv, '');119const testInspectRemoval = async (t, fakeExecArgv, execaMethod) => {120 const {stdout, stdio} = await spawnNestedExecaNode([], fakeExecArgv, execaMethod, '');121 t.is(stdout, foobarString);122 t.is(stdio[3], '');123};12484test('The "nodeOptions" option removes --inspect without a port when defined by parent process', testInspectRemoval, '--inspect');85test('The "nodeOptions" option removes --inspect with a port when defined by parent process', testInspectRemoval, '--inspect=9222');86test('The "nodeOptions" option removes --inspect-brk without a port when defined by parent process', testInspectRemoval, '--inspect-brk');87test('The "nodeOptions" option removes --inspect-brk with a port when defined by parent process', testInspectRemoval, '--inspect-brk=9223');125test('The "nodeOptions" option removes --inspect without a port when defined by parent process - execaNode()', testInspectRemoval, '--inspect', 'execaNode');126test('The "nodeOptions" option removes --inspect without a port when defined by parent process - "node" option', testInspectRemoval, '--inspect', 'nodeOption');127test('The "nodeOptions" option removes --inspect with a port when defined by parent process - execaNode()', testInspectRemoval, '--inspect=9222', 'execaNode');128test('The "nodeOptions" option removes --inspect with a port when defined by parent process - "node" option', testInspectRemoval, '--inspect=9222', 'nodeOption');129test('The "nodeOptions" option removes --inspect-brk without a port when defined by parent process - execaNode()', testInspectRemoval, '--inspect-brk', 'execaNode');130test('The "nodeOptions" option removes --inspect-brk without a port when defined by parent process - "node" option', testInspectRemoval, '--inspect-brk', 'nodeOption');131test('The "nodeOptions" option removes --inspect-brk with a port when defined by parent process - execaNode()', testInspectRemoval, '--inspect-brk=9223', 'execaNode');132test('The "nodeOptions" option removes --inspect-brk with a port when defined by parent process - "node" option', testInspectRemoval, '--inspect-brk=9223', 'nodeOption');13389test('The "nodeOptions" option allows --inspect with a different port even when defined by parent process', async t => {90 const {stdout, stdio} = await spawnNestedExecaNode(['--inspect=9225'], '', '--inspect=9224');134const testInspectDifferentPort = async (t, execaMethod) => {135 const {stdout, stdio} = await spawnNestedExecaNode(['--inspect=9225'], '', execaMethod, '--inspect=9224');136 t.is(stdout, foobarString);137 t.true(stdio[3].includes('Debugger listening'));93});138};13995test('The "nodeOptions" option forbids --inspect with the same port when defined by parent process', async t => {96 const {stdout, stdio} = await spawnNestedExecaNode(['--inspect=9226'], '', '--inspect=9226');140test.serial('The "nodeOptions" option allows --inspect with a different port even when defined by parent process - execaNode()', testInspectDifferentPort, 'execaNode');141test.serial('The "nodeOptions" option allows --inspect with a different port even when defined by parent process - "node" option', testInspectDifferentPort, 'nodeOption');142143const testInspectSamePort = async (t, execaMethod) => {144 const {stdout, stdio} = await spawnNestedExecaNode(['--inspect=9226'], '', execaMethod, '--inspect=9226');145 t.is(stdout, foobarString);146 t.true(stdio[3].includes('address already in use'));99});147};148101const runWithIpc = (file, options) => execa('node', [file], {...options, ipc: true});149test.serial('The "nodeOptions" option forbids --inspect with the same port when defined by parent process - execaNode()', testInspectSamePort, 'execaNode');150test.serial('The "nodeOptions" option forbids --inspect with the same port when defined by parent process - "node" option', testInspectSamePort, 'nodeOption');151152const testIpc = async (t, execaMethod, options) => {104 const subprocess = execaMethod('send.js', options);153 const subprocess = execaMethod('send.js', [], options);154 await pEvent(subprocess, 'message');155 subprocess.send(foobarString);156 const {stdout, stdio} = await subprocess;157 t.is(stdout, foobarString);
1 unmodified line
159 t.is(stdio[3], undefined);160};161162test('execaNode() adds an ipc channel', testIpc, execaNode, {});163test('The "node" option adds an ipc channel', testIpc, runWithNodeOption, {});164test('The "ipc" option adds an ipc channel', testIpc, runWithIpc, {});165test('The "ipc" option works with "stdio: \'pipe\'"', testIpc, runWithIpc, {stdio: 'pipe'});166test('The "ipc" option works with "stdio: [\'pipe\', \'pipe\', \'pipe\']"', testIpc, runWithIpc, {stdio: ['pipe', 'pipe', 'pipe']});167test('The "ipc" option works with "stdio: [\'pipe\', \'pipe\', \'pipe\', \'ipc\']"', testIpc, runWithIpc, {stdio: ['pipe', 'pipe', 'pipe', 'ipc']});
3 unmodified lines
171 const {stdio} = await t.throwsAsync(execa('node', ['send.js']), {message: /process.send is not a function/});172 t.is(stdio.length, 3);173});174125test('Can disable "ipc" with execaNode', async t => {126 const {stdio} = await t.throwsAsync(execaNode('send.js', {ipc: false}), {message: /process.send is not a function/});175const testDisableIpc = async (t, execaMethod) => {176 const {failed, message, stdio} = await execaMethod('send.js', [], {ipc: false, reject: false});177 t.true(failed);178 t.true(message.includes('process.send is not a function'));179 t.is(stdio.length, 3);128});180};181130test('Cannot use the "ipc" option with execaSync()', t => {182test('Can disable "ipc" - execaNode()', testDisableIpc, execaNode);183test('Can disable "ipc" - "node" option', testDisableIpc, runWithNodeOption);184test('Can disable "ipc" - "node" option sync', testDisableIpc, runWithNodeOptionSync);185186const NO_IPC_MESSAGE = /The "ipc: true" option cannot be used/;187188const testNoIpcSync = (t, node) => {189 t.throws(() => {132 execaSync('node', ['send.js'], {ipc: true});133 }, {message: /The "ipc: true" option cannot be used/});190 execaSync('node', ['send.js'], {ipc: true, node});191 }, {message: NO_IPC_MESSAGE});192};193194test('Cannot use "ipc: true" with execaSync()', testNoIpcSync, undefined);195test('Cannot use "ipc: true" with execaSync() - "node: false"', testNoIpcSync, false);196197test('Cannot use "ipc: true" with execaSync() - "node: true"', t => {198 t.throws(() => {199 execaSync('send.js', {ipc: true, node: true});200 }, {message: NO_IPC_MESSAGE});201});202203const testNoShell = async (t, execaMethod) => {204 const {failed, message} = await execaMethod('node --version', [], {shell: true, reject: false});205 t.true(failed);206 t.true(message.includes('MODULE_NOT_FOUND'));207};208209test('Cannot use "shell: true" - execaNode()', testNoShell, execaNode);210test('Cannot use "shell: true" - "node" option', testNoShell, runWithNodeOption);211test('Cannot use "shell: true" - "node" option sync', testNoShell, runWithNodeOptionSync);
modified:test/test.js-9 removed
6 unmodified lines
7import {execa, execaSync, execaNode, $} from '../index.js';8import {setFixtureDir, PATH_KEY, FIXTURES_DIR_URL} from './helpers/fixtures-dir.js';9import {identity, fullStdio, getStdio} from './helpers/stdio.js';10import {noopGenerator} from './helpers/generator.js';11import {foobarString} from './helpers/input.js';1112setFixtureDir();13process.env.FOO = 'foo';14
42 unmodified lines
57 t.is(stdout, 'Hello World');58 });59}6062const testNullOptions = async (t, execaMethod) => {63 const {stdout} = await execaMethod('noop.js', [foobarString], null);64 t.is(stdout, foobarString);65};6667test('Can pass null to options', testNullOptions, execa);68test('Can pass null to options - sync', testNullOptions, execaSync);6961test('execaSync() throws error if ENOENT', t => {62 t.throws(() => {63 execaSync('foo');64 }, {message: ENOENT_REGEXP});
236 unmodified lines
modified:index.d.ts+33 added-29 removed
276 unmodified lines
277 */278 readonly localDir?: string | URL;279280 /**281 If `true`, runs with Node.js. The first argument must be a Node.js file.282283 @default `true` with `execaNode()`, `false` otherwise284 */285 readonly node?: boolean;286287 /**288 Node.js executable used to create the child process.289290 Requires the `node` option to be `true`.291292 @default [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)293 */294 readonly nodePath?: string | URL;295296 /**297 List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.298299 Requires the `node` option to be `true`.300301 @default [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI options)302 */303 readonly nodeOptions?: string[];304305 /**306 Path to the Node.js executable to use in child processes.307283 Requires `preferLocal` to be `true`.308 Requires the `preferLocal` option to be `true`.309310 For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.311287 @default process.execPath312 @default [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)313 */314 readonly execPath?: string | URL;315316 /**
263 unmodified lines
580 readonly all?: IfAsync<IsSync, boolean>;581582 /**583 Enables exchanging messages with the child process using [`childProcess.send(value)`](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback) and [`childProcess.on('message', (value) => {})`](https://nodejs.org/api/child_process.html#event-message).584585 @default `true` if the `node` option is enabled, `false` otherwise586 */587 readonly ipc?: IfAsync<IsSync, boolean>;588589 /**
43 unmodified lines
633634export type Options = CommonOptions<false>;635export type SyncOptions = CommonOptions<true>;636610export type NodeOptions<OptionsType extends Options = Options> = {611 /**612 The Node.js executable to use.613614 @default process.execPath615 */616 readonly nodePath?: string | URL;617618 /**619 List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.620621 @default process.execArgv622 */623 readonly nodeOptions?: string[];624} & OptionsType;625637/**638Result of a child process execution. On success this is a plain object. On failure this is also an `Error` instance.639640The child process fails when:
631 unmodified lines
1272*/1273export const $: Execa$;12741275/**1265Executes a Node.js file using `node scriptPath ...arguments`. `file` is a string or a file URL. `arguments` are an array of strings. Returns a `childProcess`.1276Same as `execa()` but using the `node` option.12771267Arguments are automatically escaped. They can contain any character, including spaces.1278Executes a Node.js file using `node scriptPath ...arguments`.12791269This is the preferred method when executing Node.js files.12701271Like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options):1272- the current Node version and options are used. This can be overridden using the `nodePath` and `nodeOptions` options.1273- the `shell` option cannot be used1274- the `ipc` option defaults to `true`12751280@param scriptPath - Node.js script to execute, as a string or file URL1281@param arguments - Arguments to pass to `scriptPath` on execution.1282@returns An `ExecaChildProcess` that is both:1283- a `Promise` resolving or rejecting with a `childProcessResult`.
6 unmodified lines
12901291await execaNode('scriptPath', ['argument']);1292```1293*/1290export function execaNode<OptionsType extends NodeOptions = {}>(1294export function execaNode<OptionsType extends Options = {}>(1295 scriptPath: string | URL,1296 arguments?: readonly string[],1297 options?: OptionsType1298): ExecaChildProcess<OptionsType>;1295export function execaNode<OptionsType extends NodeOptions = {}>(1299export function execaNode<OptionsType extends Options = {}>(1300 scriptPath: string | URL,1301 options?: OptionsType1302): ExecaChildProcess<OptionsType>;
modified:index.js+13 added-13 removed
5 unmodified lines
6import crossSpawn from 'cross-spawn';7import stripFinalNewline from 'strip-final-newline';8import {npmRunPathEnv} from 'npm-run-path';9import {makeError} from './lib/error.js';10import {handleNodeOption} from './lib/node.js';11import {handleInputAsync, pipeOutputAsync, cleanupStdioStreams} from './lib/stdio/async.js';12import {handleInputSync, pipeOutputSync} from './lib/stdio/sync.js';13import {spawnedKill, validateTimeout, normalizeForceKillAfterDelay, cleanupOnExit} from './lib/kill.js';14import {pipeToProcess} from './lib/pipe.js';
24 unmodified lines
39 const filePath = getFilePath(rawFile);40 const command = joinCommand(filePath, rawArgs);41 const escapedCommand = getEscapedCommand(filePath, rawArgs);4242 const {command: file, args, options: initialOptions} = crossSpawn._parse(filePath, rawArgs, rawOptions);43 const [processedFile, processedArgs, processedOptions] = handleNodeOption(filePath, rawArgs, rawOptions);4445 const {command: file, args, options: initialOptions} = crossSpawn._parse(processedFile, processedArgs, processedOptions);4647 const options = addDefaultOptions(initialOptions);48 validateTimeout(options);49 options.shell = normalizeFileUrl(options.shell);50 options.env = getEnv(options);
166 unmodified lines
217 };218};219220export function execaSync(rawFile, rawArgs, rawOptions) {221 const syncOptions = normalizeSyncOptions(rawOptions);218 const {file, args, command, escapedCommand, options} = handleArguments(rawFile, rawArgs, rawOptions);222 const {file, args, command, escapedCommand, options} = handleArguments(rawFile, rawArgs, syncOptions);223 validateSyncOptions(options);224225 const stdioStreamsGroups = handleInputSync(options);226
57 unmodified lines
284 stdio,285 };286}287288const normalizeSyncOptions = (options = {}) => options.node && !options.ipc ? {...options, ipc: false} : options;289290const validateSyncOptions = ({ipc}) => {291 if (ipc) {292 throw new TypeError('The "ipc: true" option cannot be used with synchronous methods.');293 }
44 unmodified lines
338 const [file, ...args] = parseCommand(command);339 return execaSync(file, args, options);340}341336export function execaNode(scriptPath, args = [], options = {}) {342export function execaNode(file, args = [], options = {}) {343 if (!Array.isArray(args)) {344 options = args;345 args = [];346 }347342 const defaultExecArgv = process.execArgv.filter(arg => !arg.startsWith('--inspect'));343 const {344 nodePath = process.execPath,345 nodeOptions = defaultExecArgv,346 } = options;348 if (options.node === false) {349 throw new TypeError('The "node" option cannot be false with `execaNode()`.');350 }351348 return execa(349 nodePath,350 [...nodeOptions, getFilePath(scriptPath), ...args],351 {ipc: true, ...options, shell: false},352 );352 return execa(file, args, {...options, node: true});353}
modified:index.test-d.ts+8 added
1247 unmodified lines
1248execa('unicorns', {shell: '/bin/sh'});1249execaSync('unicorns', {shell: '/bin/sh'});1250execa('unicorns', {shell: fileUrl});1251execaSync('unicorns', {shell: fileUrl});1252execa('unicorns', {node: true});1253execaSync('unicorns', {node: true});1254execa('unicorns', {nodePath: './node'});1255execaSync('unicorns', {nodePath: './node'});1256execa('unicorns', {nodePath: fileUrl});1257execaSync('unicorns', {nodePath: fileUrl});1258execa('unicorns', {nodeOptions: ['--async-stack-traces']});1259execaSync('unicorns', {nodeOptions: ['--async-stack-traces']});1260execa('unicorns', {timeout: 1000});1261execaSync('unicorns', {timeout: 1000});1262execa('unicorns', {maxBuffer: 1000});1263execaSync('unicorns', {maxBuffer: 1000});
128 unmodified lines
modified:readme.md+30 added-26 removed
231 unmodified lines
232Arguments are [automatically escaped](#shell-syntax). They can contain any character, including spaces.233234This is the preferred method when executing single commands.235236#### execaNode(scriptPath, arguments?, options?)237238Executes a Node.js file using `node scriptPath ...arguments`. `file` is a string or a file URL. `arguments` are an array of strings. Returns a [`childProcess`](#childprocess).239240Arguments are [automatically escaped](#shell-syntax). They can contain any character, including spaces.241242This is the preferred method when executing Node.js files.243244Like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options):245- the current Node version and options are used. This can be overridden using the [`nodePath`](#nodepath-for-node-only) and [`nodeOptions`](#nodeoptions-for-node-only) options.246- the [`shell`](#shell) option cannot be used247- the [`ipc`](#ipc) option defaults to `true`248236#### $\`command\`237238Executes a command. The `command` string includes both the `file` and its `arguments`. Returns a [`childProcess`](#childprocess).239
20 unmodified lines
260Arguments are [automatically escaped](#shell-syntax). They can contain any character, but spaces must be escaped with a backslash like `execaCommand('echo has\\ space')`.261262This is the preferred method when executing a user-supplied `command` string, such as in a REPL.263264#### execaNode(scriptPath, arguments?, options?)265266Same as [`execa()`](#execacommandcommand-options) but using the [`node`](#node) option.267268Executes a Node.js file using `node scriptPath ...arguments`.269270#### execaSync(file, arguments?, options?)271272Same as [`execa()`](#execacommandcommand-options) but synchronous.273
262 unmodified lines
536Default: `process.cwd()`537538Preferred path to find locally installed binaries in (use with `preferLocal`).539547#### execPath540#### node541549Type: `string | URL`\550Default: `process.execPath` (Current Node.js executable)542Type: `boolean`\543Default: `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwise544552Path to the Node.js executable to use in child processes.545If `true`, runs with Node.js. The first argument must be a Node.js file.546554Requires [`preferLocal`](#preferlocal) to be `true`.547#### nodeOptions548556For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.549Type: `string[]`\550Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) (current Node.js CLI options)551558#### nodePath *(For `.node()` only)*552List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the [Node.js executable](#nodepath).553554Requires the [`node`](#node) option to be `true`.555556#### nodePath557558Type: `string | URL`\561Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath)559Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)560561Node.js executable used to create the child process.562565#### nodeOptions *(For `.node()` only)*563Requires the [`node`](#node) option to be `true`.564567Type: `string[]`\568Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv)565#### execPath566570List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.567Type: `string | URL`\568Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath) (current Node.js executable)569570Path to the Node.js executable to use in child processes.571572Requires the [`preferLocal`](#preferlocal) option to be `true`.573574For example, this can be used together with [`get-node`](https://github.com/ehmicky/get-node) to run a specific Node.js version in a child process.575576#### verbose577578Type: `boolean`\579Default: `false`
142 unmodified lines
722723#### ipc724725Type: `boolean`\722Default: `true` with [`execaNode()`](#execanodescriptpath-arguments-options), `false` otherwise726Default: `true` if the [`node`](#node) option is enabled, `false` otherwise727728Enables exchanging messages with the child process using [`childProcess.send(value)`](https://nodejs.org/api/child_process.html#subprocesssendmessage-sendhandle-options-callback) and [`childProcess.on('message', (value) => {})`](https://nodejs.org/api/child_process.html#event-message).729730#### serialization
223 unmodified lines