(actual, expected)
| 493 | |
| 494 | // Utility for checking whether an error matches a given constructor, regexp or string |
| 495 | function errorMatches (actual, expected) { |
| 496 | if (typeof expected === 'string') { |
| 497 | return actual.message === expected; |
| 498 | } |
| 499 | if (expected instanceof RegExp) { |
| 500 | return expected.test(actual.message); |
| 501 | } |
| 502 | if (actual instanceof expected) { |
| 503 | return true; |
| 504 | } |
| 505 | return false; |
| 506 | } |
| 507 | |
| 508 | |
| 509 | // Exports |