node/test/fixtures/spawn-worker-with-trace-exi...

21 lines
392 B
JavaScript

'use strict';
const { Worker, isMainThread } = require('worker_threads')
// Tests that valid per-isolate/env NODE_OPTIONS are allowed and
// work in child workers.
if (isMainThread) {
new Worker(__filename, {
env: {
...process.env,
NODE_OPTIONS: '--trace-exit'
}
})
} else {
setImmediate(() => {
process.nextTick(() => {
process.exit(0);
});
});
}