| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent a1d36db commit 749bc16
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -578,14 +578,21 @@ function expectedException(actual, expected, message, fn) { | |||
| 578 | 578 | if (expected.test(str)) | |
| 579 | 579 | return; | |
| 580 | 580 | ||
| 581 | - throw new AssertionError({ | ||
| 581 | + if (!message) { | ||
| 582 | + generatedMessage = true; | ||
| 583 | + message = 'The input did not match the regular expression ' + | ||
| 584 | + `${inspect(expected)}. Input:\n\n${inspect(str)}\n`; | ||
| 585 | + } | ||
| 586 | + | ||
| 587 | + const err = new AssertionError({ | ||
| 582 | 588 | actual, | |
| 583 | 589 | expected, | |
| 584 | - message: message || 'The input did not match the regular expression ' + | ||
| 585 | - `${inspect(expected)}. Input:\n\n${inspect(str)}\n`, | ||
| 590 | + message, | ||
| 586 | 591 | operator: fn.name, | |
| 587 | 592 | stackStartFn: fn | |
| 588 | 593 | }); | |
| 594 | + err.generatedMessage = generatedMessage; | ||
| 595 | + throw err; | ||
| 589 | 596 | } | |
| 590 | 597 | ||
| 591 | 598 | // Handle primitives properly. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments