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