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 1880029 commit 9d079c4
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions index.d.ts
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
8 changes: 4 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ Returns or throws a [`childProcessResult`](#childProcessResult).
Execute a Node.js script as a child process.

Same as `execa('node', [file, ...arguments], options)` except (like [`child_process#fork()`](https://nodejs.org/api/child_process.html#child_process_child_process_fork_modulepath_args_options)):
- the [`nodePath`](#nodepath-for-node-only) and [`nodeArguments`](#nodearguments-for-node-only) options can be used
- the [`shell`](#shell) option cannot be used
- the [`nodePath`](#nodepath-for-node-only) and [`nodeOptions`](#nodeoptions-for-node-only) options can be used
- 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)

### childProcessResult
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
Original file line number Diff line number Diff line change
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 9d079c4

Please sign in to comment.