From e23291048a11488a2812784b38bda12896c33692 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 7 Sep 2019 21:48:43 +0200 Subject: [PATCH] test: improve test-worker-message-port-message-before-close Replace a wrong comment with a correct assertion and await all async operations inside the async function. PR-URL: https://github.com/nodejs/node/pull/29483 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- .../parallel/test-worker-message-port-message-before-close.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-worker-message-port-message-before-close.js b/test/parallel/test-worker-message-port-message-before-close.js index ecaad9c8767a93..7edf0655ab88a9 100644 --- a/test/parallel/test-worker-message-port-message-before-close.js +++ b/test/parallel/test-worker-message-port-message-before-close.js @@ -28,11 +28,11 @@ async function test() { for (let i = 0; i < 10000; i++) { const { port1, port2 } = new MessageChannel(); worker.postMessage({ port: port2 }, [ port2 ]); - await once(port1, 'message'); // 'complexObject' + assert.deepStrictEqual(await once(port1, 'message'), ['firstMessage']); assert.deepStrictEqual(await once(port1, 'message'), ['lastMessage']); } - worker.terminate(); + await worker.terminate(); } test().then(common.mustCall());