From 3e8cda0dfe06d4291b0003a65abbd6fa9c4d5d19 Mon Sep 17 00:00:00 2001 From: ehmicky Date: Wed, 19 Jun 2019 10:00:00 +0200 Subject: [PATCH] Rename `nodeArguments` to `nodeOptions` --- index.d.ts | 4 ++-- index.js | 4 ++-- readme.md | 6 +++--- test/node.js | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/index.d.ts b/index.d.ts index 6a7e21ef10..526593feaa 100644 --- a/index.d.ts +++ b/index.d.ts @@ -203,11 +203,11 @@ declare namespace execa { readonly nodePath?: string; /** - List of string arguments passed to the Node.js executable. + List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable. @default process.execArgv */ - readonly nodeArguments?: string[]; + readonly nodeOptions?: string[]; } interface ExecaReturnBase { diff --git a/index.js b/index.js index 3d78cf7996..a7230cbe41 100644 --- a/index.js +++ b/index.js @@ -531,12 +531,12 @@ module.exports.node = (scriptPath, args, options = {}) => { const stdioOption = stdio.node(options); - const {nodePath = process.execPath, nodeArguments = process.execArgv} = options; + const {nodePath = process.execPath, nodeOptions = process.execArgv} = options; return execa( nodePath, [ - ...nodeArguments, + ...nodeOptions, scriptPath, ...(Array.isArray(args) ? args : []) ], diff --git a/readme.md b/readme.md index 100cd3666a..1416c2f06a 100644 --- a/readme.md +++ b/readme.md @@ -189,7 +189,7 @@ Returns or throws a [`childProcessResult`](#childProcessResult). Execute a Node.js script as a child process. Same as `execa('node', [scriptPath, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)): - - the current Node version and options are used. This can be overridden using the [`nodePath`](#nodepath-for-node-only) and [`nodeArguments`](#nodearguments-for-node-only) options. + - 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. - the [`shell`](#shell) option cannot be used - an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio) @@ -454,12 +454,12 @@ Default: [`process.execPath`](https://nodejs.org/api/process.html#process_proces Node.js executable used to create the child process. -#### nodeArguments *(for `.node()` only)* +#### nodeOptions *(for `.node()` only)* Type: `string[]`
Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv) -List of string arguments passed to the Node.js executable. +List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable. ## Tips diff --git a/test/node.js b/test/node.js index c6ff30d8a8..0be9494305 100644 --- a/test/node.js +++ b/test/node.js @@ -22,16 +22,16 @@ test('node correctly use nodePath', async t => { const {stdout} = await execa.node(process.platform === 'win32' ? 'hello.cmd' : 'hello.sh', { stdout: 'pipe', nodePath: process.platform === 'win32' ? 'cmd.exe' : 'bash', - nodeArguments: process.platform === 'win32' ? ['/c'] : [] + nodeOptions: process.platform === 'win32' ? ['/c'] : [] }); t.is(stdout, 'Hello World'); }); -test('node pass on nodeArguments', async t => { +test('node pass on nodeOptions', async t => { const {stdout} = await execa.node('console.log("foo")', { stdout: 'pipe', - nodeArguments: ['-e'] + nodeOptions: ['-e'] }); t.is(stdout, 'foo');