summaryrefslogtreecommitdiff
path: root/test/async-hooks/test-shutdownwrap.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/async-hooks/test-shutdownwrap.js')
-rw-r--r--test/async-hooks/test-shutdownwrap.js12
1 files changed, 7 insertions, 5 deletions
diff --git a/test/async-hooks/test-shutdownwrap.js b/test/async-hooks/test-shutdownwrap.js
index dfaac2a1c0..fea4a3a166 100644
--- a/test/async-hooks/test-shutdownwrap.js
+++ b/test/async-hooks/test-shutdownwrap.js
@@ -24,11 +24,13 @@ let endedConnection = false;
function onconnection(c) {
assert.strictEqual(hooks.activitiesOfTypes('SHUTDOWNWRAP').length, 0);
c.end();
- endedConnection = true;
- const as = hooks.activitiesOfTypes('SHUTDOWNWRAP');
- assert.strictEqual(as.length, 1);
- checkInvocations(as[0], { init: 1 }, 'after ending client connection');
- this.close(onserverClosed);
+ process.nextTick(() => {
+ endedConnection = true;
+ const as = hooks.activitiesOfTypes('SHUTDOWNWRAP');
+ assert.strictEqual(as.length, 1);
+ checkInvocations(as[0], { init: 1 }, 'after ending client connection');
+ this.close(onserverClosed);
+ });
}
function onconnected() {