From 6f1d2dfb9def3f0439c00d92f10a50e08c758cf5 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 PR-URL: https://github.com/nodejs/node/pull/43751 Refs: https://github.com/v8/v8/commit/22698d267667ad36f8b1d2c1f5ec71f54fcea3eb Reviewed-By: Colin Ihrig Reviewed-By: Jiawen Geng Reviewed-By: Gus Caplan --- .../parallel/test-worker-process-exit-async-module.js | 11 +++++++++++ 1 file changed, 11 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..38d4ad74c7bd85 --- /dev/null +++ b/test/parallel/test-worker-process-exit-async-module.js @@ -0,0 +1,11 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const { Worker } = require('worker_threads'); + +// Regression for https://github.com/nodejs/node/issues/43182. +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); +}));