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 <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
parent
b34f05ecf2
commit
d7c5ffc7a4
@ -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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user