|
1 | | -// Flags: --expose-internals |
| 1 | +// Flags: --expose-internals --expose-gc |
2 | 2 | 'use strict'; |
3 | 3 | require('../common'); |
4 | 4 | const { Worker } = require('worker_threads'); |
| 5 | +const common = require('../common'); |
| 6 | +const assert = require('assert'); |
5 | 7 |
|
6 | 8 | const CODE = ` |
7 | 9 | // If the --expose-internals flag does not pass to worker |
8 | 10 | // require function will throw an error |
9 | 11 | require('internal/options'); |
10 | 12 | `; |
11 | | -// Test if the flags is passed to worker threads |
| 13 | +// Test if the flags is passed to worker threads collectly |
| 14 | +// and do not throw an error with the invalid execArgv |
| 15 | +// when execArgv is inherited from parent |
12 | 16 | // See https://github.com/nodejs/node/issues/52825 |
| 17 | +// See https://github.com/nodejs/node/issues/53011 |
| 18 | +// Inherited env, execArgv from the parent will be ok |
13 | 19 | new Worker(CODE, { eval: true }); |
14 | | -new Worker(CODE, { eval: true, env: process.env, execArgv: ['--expose-internals'] }); |
| 20 | +// Pass process.env explicitly and inherited execArgv(Node.js options) from parent will be ok |
15 | 21 | new Worker(CODE, { eval: true, env: process.env }); |
| 22 | +// Inherited env from the parent and pass execArgv(Node.js options) explicitly will be ok |
16 | 23 | new Worker(CODE, { eval: true, execArgv: ['--expose-internals'] }); |
| 24 | +// Pass process.env and execArgv(Node.js options) explicitly will be ok |
| 25 | +new Worker(CODE, { eval: true, env: process.env, execArgv: ['--expose-internals'] }); |
| 26 | +// Pass execArgv(V8 options) explicitly will throw an error |
| 27 | +assert.throws(() => { |
| 28 | + new Worker(CODE, { eval: true, execArgv: ['--expose-gc'] }) |
| 29 | +}, /ERR_WORKER_INVALID_EXEC_ARGV/); |
0 commit comments