| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 5a40023 commit 9a25541
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -154,6 +154,22 @@ function getRunArgs(path, { forceExit, | |||
| 154 | 154 | cwd }) { | |
| 155 | 155 | const processNodeOptions = getOptionsAsFlagsFromBinding(); | |
| 156 | 156 | const runArgs = ArrayPrototypeFilter(processNodeOptions, filterExecArgv); | |
| 157 | + | ||
| 158 | + /** | ||
| 159 | + * Node supports V8 options passed via cli. | ||
| 160 | + * These options are being consumed by V8 and are not stored in nodeOptions. | ||
| 161 | + * | ||
| 162 | + * We need to propagate these options to the child processes manually. | ||
| 163 | + * | ||
| 164 | + * An example of such option are --allow-natives-syntax and --expose-gc | ||
| 165 | + */ | ||
| 166 | + const nodeOptionsSet = new SafeSet(processNodeOptions); | ||
| 167 | + const unknownProcessExecArgv = ArrayPrototypeFilter( | ||
| 168 | + process.execArgv, | ||
| 169 | + (arg) => !nodeOptionsSet.has(arg), | ||
| 170 | + ); | ||
| 171 | + ArrayPrototypePushApply(runArgs, unknownProcessExecArgv); | ||
| 172 | + | ||
| 157 | 173 | if (forceExit === true) { | |
| 158 | 174 | ArrayPrototypePush(runArgs, '--test-force-exit'); | |
| 159 | 175 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,7 @@ | |||
| 1 | + import { describe, it } from "node:test"; | ||
| 2 | + | ||
| 3 | + describe("test", () => { | ||
| 4 | + it("calls gc", () => { | ||
| 5 | + globalThis.gc(); | ||
| 6 | + }); | ||
| 7 | + }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -125,4 +125,28 @@ describe('test runner flag propagation', () => { | |||
| 125 | 125 | }); | |
| 126 | 126 | } | |
| 127 | 127 | }); | |
| 128 | + | ||
| 129 | + describe('V8 specific flags', () => { | ||
| 130 | + const v8FlagTestFixture = path.join(fixtureDir, 'issue-60986.mjs'); | ||
| 131 | + it('should propagate V8 only flags to child tests', () => { | ||
| 132 | + | ||
| 133 | + const child = spawnSync( | ||
| 134 | + process.execPath, | ||
| 135 | + [ | ||
| 136 | + '--allow-natives-syntax', | ||
| 137 | + '--expose-gc', | ||
| 138 | + '--test', | ||
| 139 | + v8FlagTestFixture, | ||
| 140 | + ], | ||
| 141 | + { | ||
| 142 | + cwd: fixtureDir, | ||
| 143 | + }, | ||
| 144 | + ); | ||
| 145 | + | ||
| 146 | + assert.strictEqual(child.status, 0, `V8 flag propagation test failed.`); | ||
| 147 | + const stdout = child.stdout.toString(); | ||
| 148 | + assert.match(stdout, /tests 1/, `Test should execute for V8 flag propagation`); | ||
| 149 | + assert.match(stdout, /pass 1/, `Test should pass for V8 flag propagation check`); | ||
| 150 | + }); | ||
| 151 | + }); | ||
| 128 | 152 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments