Skip to content

Commit c283615

Browse files
committed
[New] when the error type is wrong, show the message and stack
Fixes #479.
1 parent 44cbbf5 commit c283615

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

lib/test.js

-1
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,6 @@ Test.prototype['throws'] = function (fn, expected, msg, extra) {
509509

510510
if (typeof expected === 'function' && caught) {
511511
passed = caught.error instanceof expected;
512-
caught.error = caught.error.constructor;
513512
}
514513

515514
this._assert(typeof fn === 'function' && passed, {

test/throws.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,12 @@ tap.test('failures', function (tt) {
171171
+ ' expected: |-\n'
172172
+ ' [Function: TypeError]\n'
173173
+ ' actual: |-\n'
174-
+ ' [Function: RangeError]\n'
174+
+ " { [RangeError: actual!] message: 'actual!' }\n"
175175
+ ' at: Test.<anonymous> ($TEST/throws.js:$LINE:$COL)\n'
176+
+ ' stack: |-\n'
177+
+ ' RangeError: actual!\n'
178+
+ ' at Test.<anonymous> ($TEST/throws.js:$LINE:$COL)\n'
179+
+ ' [... stack stripped ...]\n'
176180
+ ' ...\n'
177181
+ '\n1..14\n'
178182
+ '# tests 14\n'

0 commit comments

Comments
 (0)