Commit e1746a9
committed
test_runner: avoid reading process state directly in run()
Refs: #53867
The run() function is exposed as a public API via node:test module.
Previously, it accessed process.argv, process.execArgv, process.cwd(),
and process.env directly, which meant programmatic API users could not
fully control the test runner behavior.
This change:
- Captures process.argv, process.cwd(), process.env, and
process.execArgv in the CLI entry point (main/test_runner.js) and
passes them explicitly to run() as options
- Adds a processExecArgv option for V8 flag propagation
- Replaces process.env fallback in runTestFile() with opts.env
- Replaces process.argv usage in getRunArgs() with globPatterns
- Replaces process.env.NODE_TEST_CONTEXT check with env option
- Maintains backwards compatibility: when options are not provided,
run() falls back to process state as before1 parent 7547e79 commit e1746a9
2 files changed
Lines changed: 30 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
167 | 167 | | |
168 | 168 | | |
169 | 169 | | |
| 170 | + | |
| 171 | + | |
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
| |||
183 | 185 | | |
184 | 186 | | |
185 | 187 | | |
186 | | - | |
| 188 | + | |
187 | 189 | | |
188 | 190 | | |
189 | 191 | | |
| |||
214 | 216 | | |
215 | 217 | | |
216 | 218 | | |
217 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
218 | 222 | | |
219 | 223 | | |
220 | 224 | | |
| |||
421 | 425 | | |
422 | 426 | | |
423 | 427 | | |
424 | | - | |
| 428 | + | |
425 | 429 | | |
426 | 430 | | |
427 | 431 | | |
| |||
648 | 652 | | |
649 | 653 | | |
650 | 654 | | |
651 | | - | |
| 655 | + | |
| 656 | + | |
652 | 657 | | |
653 | 658 | | |
654 | 659 | | |
655 | 660 | | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
656 | 675 | | |
657 | 676 | | |
658 | 677 | | |
| |||
759 | 778 | | |
760 | 779 | | |
761 | 780 | | |
762 | | - | |
| 781 | + | |
763 | 782 | | |
764 | 783 | | |
765 | 784 | | |
| |||
830 | 849 | | |
831 | 850 | | |
832 | 851 | | |
| 852 | + | |
833 | 853 | | |
834 | 854 | | |
835 | 855 | | |
836 | 856 | | |
837 | 857 | | |
838 | 858 | | |
839 | | - | |
| 859 | + | |
840 | 860 | | |
841 | 861 | | |
842 | 862 | | |
| |||
0 commit comments