From 5700aba880a537d017be123a81342944a08c7b89 Mon Sep 17 00:00:00 2001 From: Luigi Pinca Date: Tue, 25 Oct 2022 20:21:02 +0200 Subject: [PATCH] test: defer invocation checks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Do not immediately check the `tcpserver` hook invocations when it closes. Do it in the next iteration of the event loop. PR-URL: https://github.com/nodejs/node/pull/42340 Refs: https://github.com/nodejs/node/pull/42340#issuecomment-1290964192 Reviewed-By: Michaël Zasso Reviewed-By: Juan José Arboleda Reviewed-By: Yagiz Nizipli Reviewed-By: Darshan Sen Reviewed-By: Antoine du Hamel --- test/async-hooks/test-tcpwrap.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/async-hooks/test-tcpwrap.js b/test/async-hooks/test-tcpwrap.js index 3256a1598b0adc..3f0987b98822ef 100644 --- a/test/async-hooks/test-tcpwrap.js +++ b/test/async-hooks/test-tcpwrap.js @@ -128,9 +128,9 @@ function onconnection(c) { } function onserverClosed() { - checkInvocations(tcpserver, { init: 1, before: 1, after: 1, destroy: 1 }, - 'tcpserver when server is closed'); setImmediate(() => { + checkInvocations(tcpserver, { init: 1, before: 1, after: 1, destroy: 1 }, + 'tcpserver when server is closed'); checkInvocations(tcp1, { init: 1, before: 2, after: 2, destroy: 1 }, 'tcp1 after server is closed'); });