-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc,test: specify and test CLI option precedence rules
Refs: #35098 (comment) PR-URL: #35106 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Zeyu Yang <himself65@outlook.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
- Loading branch information
Showing
2 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
require('../common'); | ||
const assert = require('assert'); | ||
const { spawnSync } = require('child_process'); | ||
|
||
// The last option on the command line takes precedence: | ||
assert.strictEqual(spawnSync(process.execPath, [ | ||
'--max-http-header-size=1234', | ||
'--max-http-header-size=5678', | ||
'-p', 'http.maxHeaderSize' | ||
], { | ||
encoding: 'utf8' | ||
}).stdout.trim(), '5678'); | ||
|
||
// The command line takes precedence over NODE_OPTIONS: | ||
assert.strictEqual(spawnSync(process.execPath, [ | ||
'--max-http-header-size=5678', | ||
'-p', 'http.maxHeaderSize' | ||
], { | ||
encoding: 'utf8', | ||
env: { ...process.env, NODE_OPTIONS: '--max-http-header-size=1234' } | ||
}).stdout.trim(), '5678'); |