@@ -35,6 +35,20 @@ var nextTick = typeof setImmediate !== 'undefined'
3535var safeSetTimeout = setTimeout ;
3636var safeClearTimeout = clearTimeout ;
3737
38+ var isErrorConstructor = isProto ( Error , TypeError ) // IE 8 is `false` here
39+ ? function isErrorConstructor ( C ) {
40+ return isProto ( Error , C ) ;
41+ }
42+ : function isErrorConstructor ( C ) {
43+ return isProto ( Error , C )
44+ || isProto ( TypeError , C )
45+ || isProto ( RangeError , C )
46+ || isProto ( SyntaxError , C )
47+ || isProto ( ReferenceError , C )
48+ || isProto ( EvalError , C )
49+ || isProto ( URIError , C ) ;
50+ } ;
51+
3852// eslint-disable-next-line no-unused-vars
3953function getTestArgs ( name_ , opts_ , cb_ ) {
4054 var name = '(anonymous)' ;
@@ -829,7 +843,7 @@ Test.prototype['throws'] = function (fn, expected, msg, extra) {
829843 if ( typeof expected === 'function' ) {
830844 if ( typeof expected . prototype !== 'undefined' && caught . error instanceof expected ) {
831845 passed = true ;
832- } else if ( isProto ( Error , expected ) ) {
846+ } else if ( isErrorConstructor ( expected ) ) {
833847 passed = false ;
834848 } else {
835849 passed = expected . call ( { } , caught . error ) === true ;
0 commit comments