Skip to content

Commit

Permalink
Rename nodeArguments to nodeOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Jun 19, 2019
1 parent ab83d8d commit 19e1955
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Expand Up @@ -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<StdoutStderrType> {
Expand Down
2 changes: 1 addition & 1 deletion index.js
Expand Up @@ -535,7 +535,7 @@ module.exports.node = (scriptPath, args, options) => {
return execa(
options.nodePath || process.execPath,
[
...(options.nodeArguments || process.execArgv),
...(options.nodeOptions || process.execArgv),
scriptPath,
...(Array.isArray(args) ? args : [])
],
Expand Down
6 changes: 3 additions & 3 deletions readme.md
Expand Up @@ -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)

Expand Down Expand Up @@ -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[]`<br>
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

Expand Down
6 changes: 3 additions & 3 deletions test/node.js
Expand Up @@ -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');
Expand Down

0 comments on commit 19e1955

Please sign in to comment.