-
-
Notifications
You must be signed in to change notification settings - Fork 33.5k
test_runner: enhance config_file support #59138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
nodejs-github-bot
merged 7 commits into
nodejs:main
from
pmarchini:pmarchini/issue/59021
Aug 16, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b851d9f
src: add internal GetOptionsAsFlags
pmarchini 0f0cccf
fixup! src: add internal GetOptionsAsFlags
pmarchini 7b51777
test_runner: replace process.execArgv with getOptionsAsFlagsFromBinding
pmarchini 3095abc
test: add flags
pmarchini efb6a55
test: cover options via config file
pmarchini c59932f
doc: add section on child process option inheritance in test runner
pmarchini afc3850
fixup! doc: add section on child process option inheritance in test r…
pmarchini File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 @@ | ||
NODE_OPTIONS=--v8-pool-size=8 |
This file contains hidden or 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,4 @@ | ||
const { getOptionsAsFlagsFromBinding } = require('internal/options'); | ||
|
||
const flags = getOptionsAsFlagsFromBinding(); | ||
console.log(JSON.stringify(flags.sort())); |
This file contains hidden or 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,9 @@ | ||
{ | ||
"nodeOptions": { | ||
"experimental-transform-types": true, | ||
"max-http-header-size": 8192 | ||
}, | ||
"testRunner": { | ||
"test-isolation": "none" | ||
} | ||
} |
Empty file.
This file contains hidden or 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 @@ | ||
// Empty file used by test/parallel/test-runner-flag-propagation.js |
This file contains hidden or 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,5 @@ | ||
{ | ||
"nodeOptions": { | ||
"max-http-header-size": 10 | ||
} | ||
} |
This file contains hidden or 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,33 @@ | ||
import { run } from 'node:test'; | ||
import { tap } from 'node:test/reporters'; | ||
import { parseArgs } from 'node:util'; | ||
|
||
const options = { | ||
flag: { | ||
type: 'string', | ||
default: '', | ||
}, | ||
expected: { | ||
type: 'string', | ||
default: '', | ||
}, | ||
description: { | ||
type: 'string', | ||
default: 'flag propagation test', | ||
}, | ||
}; | ||
|
||
const { values } = parseArgs({ args: process.argv.slice(2), options }); | ||
|
||
const argv = [ | ||
`--flag=${values.flag}`, | ||
`--expected=${values.expected}`, | ||
`--description="${values.description}"`, | ||
].filter(Boolean); | ||
|
||
run({ | ||
files: ['./test.mjs'], | ||
cwd: process.cwd(), | ||
argv, | ||
isolation: 'process', | ||
}).compose(tap).pipe(process.stdout); |
This file contains hidden or 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,46 @@ | ||
import { test } from 'node:test'; | ||
import { deepStrictEqual } from 'node:assert'; | ||
import internal from 'internal/options'; | ||
import { parseArgs } from 'node:util'; | ||
|
||
const options = { | ||
flag: { | ||
type: 'string', | ||
default: '', | ||
}, | ||
expected: { | ||
type: 'string', | ||
default: '', | ||
}, | ||
description: { | ||
type: 'string', | ||
default: 'flag propagation test', | ||
}, | ||
}; | ||
|
||
|
||
const { values } = parseArgs({ args: process.argv.slice(2), options }); | ||
|
||
let { flag, expected, description } = values; | ||
|
||
test(description, () => { | ||
const optionValue = internal.getOptionValue(flag); | ||
const isArrayOption = Array.isArray(optionValue); | ||
|
||
if (isArrayOption) { | ||
expected = [expected]; | ||
} | ||
|
||
console.error(`testing flag: ${flag}, found value: ${optionValue}, expected: ${expected}`); | ||
|
||
const isNumber = !isNaN(Number(expected)); | ||
const booleanValue = expected === 'true' || expected === 'false'; | ||
if (booleanValue) { | ||
deepStrictEqual(optionValue, expected === 'true'); | ||
return; | ||
} else if (isNumber) { | ||
deepStrictEqual(Number(optionValue), Number(expected)); | ||
} else{ | ||
deepStrictEqual(optionValue, expected); | ||
} | ||
}); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.