diff --git a/test/parallel/test-worker-process-exit-async-module.js b/test/parallel/test-worker-process-exit-async-module.js new file mode 100644 index 000000000000000..9e102572bc2af17 --- /dev/null +++ b/test/parallel/test-worker-process-exit-async-module.js @@ -0,0 +1,10 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const { Worker } = require('worker_threads'); + +const w = new Worker(new URL("data:text/javascript,process.exit(1);await new Promise(()=>{ process.exit(2); })")); +w.on('exit', common.mustCall((code) => { + assert.strictEqual(code, 1); +}));