summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2017-08-19 17:57:36 -0400
committerJames M Snell <jasnell@gmail.com>2017-08-23 10:25:44 -0700
commit0ce54a7ec96431a088a15a5e24614428184497f0 (patch)
treeccda04673430d666e731db4c3b730b462265bd6b
parente76b1ff17e321f1e1536f2ff9d9fea45cf2d9623 (diff)
downloadandroid-node-v8-0ce54a7ec96431a088a15a5e24614428184497f0.tar.gz
android-node-v8-0ce54a7ec96431a088a15a5e24614428184497f0.tar.bz2
android-node-v8-0ce54a7ec96431a088a15a5e24614428184497f0.zip
test: improve assertion fail messages
PR-URL: https://github.com/nodejs/node/pull/14949 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
-rw-r--r--test/parallel/test-stream-inheritance.js23
1 files changed, 16 insertions, 7 deletions
diff --git a/test/parallel/test-stream-inheritance.js b/test/parallel/test-stream-inheritance.js
index 8ca7ae1f1e..2d9a1e83ef 100644
--- a/test/parallel/test-stream-inheritance.js
+++ b/test/parallel/test-stream-inheritance.js
@@ -33,8 +33,14 @@ assert.ok(!(undefined instanceof Writable));
// Simple inheritance check for `Writable` works fine in a subclass constructor.
function CustomWritable() {
- assert.ok(this instanceof Writable, 'inherits from Writable');
- assert.ok(this instanceof CustomWritable, 'inherits from CustomWritable');
+ assert.ok(
+ this instanceof CustomWritable,
+ `${this} does not inherit from CustomWritable`
+ );
+ assert.ok(
+ this instanceof Writable,
+ `${this} does not inherit from Writable`
+ );
}
Object.setPrototypeOf(CustomWritable, Writable);
@@ -42,8 +48,11 @@ Object.setPrototypeOf(CustomWritable.prototype, Writable.prototype);
new CustomWritable();
-assert.throws(CustomWritable,
- common.expectsError({
- code: 'ERR_ASSERTION',
- message: /^inherits from Writable$/
- }));
+common.expectsError(
+ CustomWritable,
+ {
+ code: 'ERR_ASSERTION',
+ type: assert.AssertionError,
+ message: 'undefined does not inherit from CustomWritable'
+ }
+);