summaryrefslogtreecommitdiff
path: root/test/async-hooks/test-pipewrap.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-pipewrap.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-pipewrap.js')
-rw-r--r--test/async-hooks/test-pipewrap.js20
1 files changed, 9 insertions, 11 deletions
diff --git a/test/async-hooks/test-pipewrap.js b/test/async-hooks/test-pipewrap.js
index a34bca5795..4e4236b46d 100644
--- a/test/async-hooks/test-pipewrap.js
+++ b/test/async-hooks/test-pipewrap.js
@@ -23,24 +23,22 @@ nodeVersionSpawn
// synchronously
const processes = hooks.activitiesOfTypes('PROCESSWRAP');
const pipes = hooks.activitiesOfTypes('PIPEWRAP');
-assert.strictEqual(processes.length, 1,
- '1 processwrap created when process created');
-assert.strictEqual(pipes.length, 3,
- '3 pipe wraps created when process created');
+assert.strictEqual(processes.length, 1);
+assert.strictEqual(pipes.length, 3);
const processwrap = processes[0];
const pipe1 = pipes[0];
const pipe2 = pipes[1];
const pipe3 = pipes[2];
-assert.strictEqual(processwrap.type, 'PROCESSWRAP', 'process wrap type');
-assert.strictEqual(processwrap.triggerId, 1, 'processwrap triggerId is 1');
+assert.strictEqual(processwrap.type, 'PROCESSWRAP');
+assert.strictEqual(processwrap.triggerId, 1);
checkInvocations(processwrap, { init: 1 },
'processwrap when sleep.spawn was called');
[ pipe1, pipe2, pipe3 ].forEach((x) => {
- assert(x.type, 'PIPEWRAP', 'pipe wrap type');
- assert.strictEqual(x.triggerId, 1, 'pipe wrap triggerId is 1');
+ assert.strictEqual(x.type, 'PIPEWRAP');
+ assert.strictEqual(x.triggerId, 1);
checkInvocations(x, { init: 1 }, 'pipe wrap when sleep.spawn was called');
});
@@ -71,14 +69,14 @@ function onexit() {
'processwrap while in onsleepClose callback');
[ pipe1, pipe2, pipe3 ].forEach((x) => {
- assert(x.type, 'PIPEWRAP', 'pipe wrap type');
- assert.strictEqual(x.triggerId, 1, 'pipe wrap triggerId is 1');
+ assert.strictEqual(x.type, 'PIPEWRAP');
+ assert.strictEqual(x.triggerId, 1);
});
const ioEvents = Math.min(pipe2.before.length, pipe2.after.length);
// 2 events without any IO and at least one more for the node version data.
// Usually it is just one event, but it can be more.
- assert.ok(ioEvents >= 3, 'at least 3 stdout io events.');
+ assert.ok(ioEvents >= 3, `at least 3 stdout io events, got ${ioEvents}`);
checkInvocations(pipe1, { init: 1, before: 2, after: 2 },
'pipe wrap when sleep.spawn was called');