summaryrefslogtreecommitdiff
path: root/test/async-hooks/init-hooks.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/init-hooks.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/init-hooks.js')
-rw-r--r--test/async-hooks/init-hooks.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/test/async-hooks/init-hooks.js b/test/async-hooks/init-hooks.js
index 6b8c2f4be4..90758e5335 100644
--- a/test/async-hooks/init-hooks.js
+++ b/test/async-hooks/init-hooks.js
@@ -1,11 +1,11 @@
'use strict';
// Flags: --expose-gc
+require('../common');
const assert = require('assert');
const async_hooks = require('async_hooks');
const util = require('util');
const print = process._rawDebug;
-require('../common');
if (typeof global.gc === 'function') {
(function exity(cntr) {
@@ -109,7 +109,7 @@ class ActivityCollector {
}
if (violations.length) {
console.error(violations.join('\n'));
- assert.fail(violations.length, 0, 'Failed sanity check');
+ assert.fail(violations.length, 0, `Failed sanity checks: ${violations}`);
}
}
@@ -151,8 +151,8 @@ class ActivityCollector {
this._activities.set(uid, stub);
return stub;
} else {
- const err = new Error('Found a handle who\'s ' + hook +
- ' hook was invoked but not it\'s init hook');
+ const err = new Error(`Found a handle whose ${hook}` +
+ ' hook was invoked but not its init hook');
// Don't throw if we see invocations due to an assertion in a test
// failing since we want to list the assertion failure instead
if (/process\._fatalException/.test(err.stack)) return null;