Rename `nodeArguments` to `nodeOptions` (#299)
Before adoption: this commit came in with the history the project adopted, so no landing records it.
authored by ehmicky · committed by Sindre Sorhus · parent 825f8a7 · Browse files · 4 files·+10 added−10 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
4 files+10 added−10 removed
- tests:+3 added−3 removed
- other:+7 added−7 removed
Provenance
- Commit
b979534- Tree
5083cb9- Author
ehmicky <ehmicky@users.noreply.github.com>- Committer
Sindre Sorhus <sindresorhus@gmail.com>- Parent
825f8a7
4 files changed+10 added−10 removed
modified:test/node.js+3 added-3 removed
20 unmodified lines2122232425252627282930313132333434353637388 unmodified lines20 unmodified linestest('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');});8 unmodified linesmodified:index.d.ts+2 added-2 removed
201 unmodified lines202 */203 readonly nodePath?: string;204 205 /**206- List of string arguments passed to the Node.js executable.206+ List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.207 208 @default process.execArgv209 */210- readonly nodeArguments?: string[];210+ readonly nodeOptions?: string[];211 }212 213 interface ExecaReturnBase<StdoutStderrType> {214 /**248 unmodified linesmodified:index.js+2 added-2 removed
529 unmodified lines530 }531 532 const stdioOption = stdio.node(options);533 534- const {nodePath = process.execPath, nodeArguments = process.execArgv} = options;534+ const {nodePath = process.execPath, nodeOptions = process.execArgv} = options;535 536 return execa(537 nodePath,538 [539- ...nodeArguments,539+ ...nodeOptions,540 scriptPath,541 ...(Array.isArray(args) ? args : [])542 ],543 {9 unmodified linesmodified:readme.md+3 added-3 removed
187 unmodified lines188 189 Execute a Node.js script as a child process.190 191 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)):192- - 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.192+ - 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.193 - the [`shell`](#shell) option cannot be used194 - an extra channel [`ipc`](https://nodejs.org/api/child_process.html#child_process_options_stdio) is passed to [`stdio`](#stdio)195 196 ### childProcessResult256 unmodified lines453 Default: [`process.execPath`](https://nodejs.org/api/process.html#process_process_execpath)454 455 Node.js executable used to create the child process.456 457-#### nodeArguments *(for `.node()` only)*457+#### nodeOptions *(for `.node()` only)*458 459 Type: `string[]`<br>460 Default: [`process.execArgv`](https://nodejs.org/api/process.html#process_process_execargv)461 462-List of string arguments passed to the Node.js executable.462+List of [CLI options](https://nodejs.org/api/cli.html#cli_options) passed to the Node.js executable.463 464 ## Tips465 466 ### Save and pipe output from a child process56 unmodified lines