summaryrefslogtreecommitdiff
path: root/test/async-hooks/test-shutdownwrap.js
diff options
context:
space:
mode:
authorAnna Henningsen <anna@addaleax.net>2017-05-26 17:53:06 +0200
committerAnna Henningsen <anna@addaleax.net>2017-06-03 23:08:24 +0200
commit1dc3272bb9c2ecd442efd5b978a852a7da31c1e9 (patch)
treed835fa61e0503a8b5c4405c03003085129c2d0fe /test/async-hooks/test-shutdownwrap.js
parent8741e3c7501cbe66696bd3fad4a0a923e76ba11d (diff)
downloadandroid-node-v8-1dc3272bb9c2ecd442efd5b978a852a7da31c1e9.tar.gz
android-node-v8-1dc3272bb9c2ecd442efd5b978a852a7da31c1e9.tar.bz2
android-node-v8-1dc3272bb9c2ecd442efd5b978a852a7da31c1e9.zip
test: improve async hooks test error messages
Improve error messages in the async hooks tests, mostly by removing unhelpful `message` parameters for assertions. PR-URL: https://github.com/nodejs/node/pull/13243 Reviewed-By: Kunal Pathak <kunal.pathak@microsoft.com> Reviewed-By: Andreas Madsen <amwebdk@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Diffstat (limited to 'test/async-hooks/test-shutdownwrap.js')
-rw-r--r--test/async-hooks/test-shutdownwrap.js22
1 files changed, 7 insertions, 15 deletions
diff --git a/test/async-hooks/test-shutdownwrap.js b/test/async-hooks/test-shutdownwrap.js
index 8ce2aae275..c3d9936c54 100644
--- a/test/async-hooks/test-shutdownwrap.js
+++ b/test/async-hooks/test-shutdownwrap.js
@@ -22,29 +22,21 @@ function onlistening() {
// Therefore we track here if we ended the connection already or not.
let endedConnection = false;
function onconnection(c) {
- assert.strictEqual(hooks.activitiesOfTypes('SHUTDOWNWRAP').length, 0,
- 'no shutdown wrap before ending the client connection');
+ assert.strictEqual(hooks.activitiesOfTypes('SHUTDOWNWRAP').length, 0);
c.end();
endedConnection = true;
const as = hooks.activitiesOfTypes('SHUTDOWNWRAP');
- assert.strictEqual(
- as.length, 1,
- 'one shutdown wrap created sync after ending the client connection');
+ assert.strictEqual(as.length, 1);
checkInvocations(as[0], { init: 1 }, 'after ending client connection');
this.close(onserverClosed);
}
function onconnected() {
if (endedConnection) {
- assert.strictEqual(
- hooks.activitiesOfTypes('SHUTDOWNWRAP').length, 1,
- 'one shutdown wrap when client connected but server ended connection');
+ assert.strictEqual(hooks.activitiesOfTypes('SHUTDOWNWRAP').length, 1);
} else {
- assert.strictEqual(
- hooks.activitiesOfTypes('SHUTDOWNWRAP').length, 0,
- 'no shutdown wrap when client connected and server did not end connection'
- );
+ assert.strictEqual(hooks.activitiesOfTypes('SHUTDOWNWRAP').length, 0);
}
}
@@ -61,9 +53,9 @@ function onexit() {
hooks.sanityCheck('SHUTDOWNWRAP');
const as = hooks.activitiesOfTypes('SHUTDOWNWRAP');
const a = as[0];
- assert.strictEqual(a.type, 'SHUTDOWNWRAP', 'shutdown wrap');
- assert.strictEqual(typeof a.uid, 'number', 'uid is a number');
- assert.strictEqual(typeof a.triggerId, 'number', 'triggerId is a number');
+ assert.strictEqual(a.type, 'SHUTDOWNWRAP');
+ assert.strictEqual(typeof a.uid, 'number');
+ assert.strictEqual(typeof a.triggerId, 'number');
checkInvocations(as[0], { init: 1, before: 1, after: 1, destroy: 1 },
'when process exits');
}