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 <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
lpinca authored and danielleadams committed Dec 30, 2022
1 parent f8f2ae8 commit a091b99
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions test/async-hooks/test-tcpwrap.js
Original file line number Diff line number Diff line change
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 a091b99

Please sign in to comment.