Skip to content

Commit

Permalink
test: defer invocation checks
Browse files Browse the repository at this point in the history
Do not immediately check the `tcpserver` hook invocations when it
closes. Do it in the next iteration of the event loop.

PR-URL: #42340
Refs: #42340 (comment)
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • Loading branch information
lpinca authored and RafaelGSS committed Nov 10, 2022
1 parent 7435284 commit 66e7821
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/async-hooks/test-tcpwrap.js
Expand Up @@ -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');
});
Expand Down

0 comments on commit 66e7821

Please sign in to comment.