| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2a621d4 commit c53db1e
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -546,7 +546,10 @@ function innerThrows(shouldThrow, block, expected, message) { | |||
| 546 | 546 | } else if (actual !== undefined) { | |
| 547 | 547 | if (!expected || expectedException(actual, expected)) { | |
| 548 | 548 | details = message ? `: ${message}` : '.'; | |
| 549 | - fail(actual, expected, `Got unwanted exception${details}`, fail); | ||
| 549 | + fail(actual, | ||
| 550 | + expected, | ||
| 551 | + `Got unwanted exception${details}\n${actual.message}`, | ||
| 552 | + fail); | ||
| 550 | 553 | } | |
| 551 | 554 | throw actual; | |
| 552 | 555 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -468,6 +468,34 @@ assert.throws(() => { | |||
| 468 | 468 | }, /Got unwanted exception: user message/, | |
| 469 | 469 | 'a.doesNotThrow ignores user message'); | |
| 470 | 470 | ||
| 471 | + { | ||
| 472 | + let threw = false; | ||
| 473 | + try { | ||
| 474 | + assert.doesNotThrow(makeBlock(thrower, Error), 'user message'); | ||
| 475 | + } catch (e) { | ||
| 476 | + threw = true; | ||
| 477 | + common.expectsError({ | ||
| 478 | + code: 'ERR_ASSERTION', | ||
| 479 | + message: /Got unwanted exception: user message\n\[object Object\]/ | ||
| 480 | + })(e); | ||
| 481 | + } | ||
| 482 | + assert.ok(threw); | ||
| 483 | + } | ||
| 484 | + | ||
| 485 | + { | ||
| 486 | + let threw = false; | ||
| 487 | + try { | ||
| 488 | + assert.doesNotThrow(makeBlock(thrower, Error)); | ||
| 489 | + } catch (e) { | ||
| 490 | + threw = true; | ||
| 491 | + common.expectsError({ | ||
| 492 | + code: 'ERR_ASSERTION', | ||
| 493 | + message: /Got unwanted exception\.\n\[object Object\]/ | ||
| 494 | + })(e); | ||
| 495 | + } | ||
| 496 | + assert.ok(threw); | ||
| 497 | + } | ||
| 498 | + | ||
| 471 | 499 | // make sure that validating using constructor really works | |
| 472 | 500 | { | |
| 473 | 501 | let threw = false; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments