| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 612ba1a commit 7457093
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -738,12 +738,15 @@ assert.throws( | |||
| 738 | 738 | ||
| 739 | 739 | Validate error message using [`RegExp`][]: | |
| 740 | 740 | ||
| 741 | + Using a regular expression runs `.toString` on the error object, and will | ||
| 742 | + therefore also include the error name. | ||
| 743 | + | ||
| 741 | 744 | ```js | |
| 742 | 745 | assert.throws( | |
| 743 | 746 | () => { | |
| 744 | 747 | throw new Error('Wrong value'); | |
| 745 | 748 | }, | |
| 746 | - /value/ | ||
| 749 | + /^Error: Wrong value$/ | ||
| 747 | 750 | ); | |
| 748 | 751 | ``` | |
| 749 | 752 | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments