From 6395d1e8f6626e7d3fd3d06005928ca0a63ea49e Mon Sep 17 00:00:00 2001 From: legendecas Date: Sun, 10 Jul 2022 08:45:16 +0800 Subject: [PATCH] test: add test on worker process.exit in async modules --- test/parallel/test-worker-process-exit-async-module.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/parallel/test-worker-process-exit-async-module.js 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 00000000000000..9e102572bc2af1 --- /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); +}));