(actual, expected)
| 122 | |
| 123 | // Utility for checking whether an error matches a given constructor, regexp or string |
| 124 | function errorMatches (actual, expected) { |
| 125 | if (typeof expected === 'string') { |
| 126 | return actual.message === expected; |
| 127 | } |
| 128 | if (expected instanceof RegExp) { |
| 129 | return expected.test(actual.message); |
| 130 | } |
| 131 | if (actual instanceof expected) { |
| 132 | return true; |
| 133 | } |
| 134 | return false; |
| 135 | } |
| 136 | |
| 137 | function AssertionError (opts) { |
| 138 | opts = opts || {}; |