jest-mock
Advanced tools
Comparing version 21.3.0-beta.4 to 21.3.0-beta.5
@@ -647,3 +647,3 @@ 'use strict'; | ||
isMockFunction(fn) { | ||
return !!fn._isMockFunction; | ||
return !!(fn && fn._isMockFunction); | ||
} | ||
@@ -661,2 +661,8 @@ | ||
spyOn(object, methodName) { | ||
if (typeof object !== 'object' && typeof object !== 'function') { | ||
throw new Error( | ||
'Cannot spyOn on a primitive value; ' + this._typeOf(object) + ' given'); | ||
} | ||
const original = object[methodName]; | ||
@@ -667,3 +673,7 @@ | ||
throw new Error( | ||
'Cannot spyOn the ' + methodName + ' property; it is not a function'); | ||
'Cannot spy the ' + | ||
methodName + | ||
' property because it is not a function; ' + | ||
this._typeOf(original) + | ||
' given instead'); | ||
@@ -696,2 +706,6 @@ } | ||
this._spyState = new Set(); | ||
} | ||
_typeOf(value) { | ||
return value == null ? '' + value : typeof value; | ||
}} | ||
@@ -698,0 +712,0 @@ |
{ | ||
"name": "jest-mock", | ||
"version": "21.3.0-beta.4", | ||
"version": "21.3.0-beta.5", | ||
"repository": { | ||
@@ -5,0 +5,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
100234
2691