File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -124,7 +124,7 @@ should.Assertion.prototype.rejectedWith = function(message, properties) {
124
124
that . fail ( ) ;
125
125
}
126
126
127
- var errorMatched = true , errorInfo = '' ;
127
+ var errorMatched = true , errorInfo = '' , messageStr ;
128
128
129
129
if ( 'string' == typeof message ) {
130
130
errorMatched = message == err . message ;
@@ -147,7 +147,8 @@ should.Assertion.prototype.rejectedWith = function(message, properties) {
147
147
148
148
if ( ! errorMatched ) {
149
149
if ( 'string' == typeof message || message instanceof RegExp ) {
150
- errorInfo = " with a message matching " + message + ", but got '" + err . message + "'" ;
150
+ messageStr = message instanceof RegExp ? message : "'" + message + "'" ;
151
+ errorInfo = " with a message matching " + messageStr + ", but got '" + err . message + "'" ;
151
152
} else if ( 'function' == typeof message ) {
152
153
errorInfo = " of type " + util . functionName ( message ) + ", but got " + util . functionName ( err . constructor ) ;
153
154
}
You can’t perform that action at this time.
0 commit comments