Prevent mock clock timing fns from being spied on

Fixes #826
This commit is contained in:
Steve Gravrock
2025-09-25 20:56:19 -07:00
parent 979e4a5d0f
commit 190a13ed96
5 changed files with 73 additions and 0 deletions
+6
View File
@@ -41,6 +41,12 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
throw new Error(getErrorMsg(methodName + '() method does not exist'));
}
// Spying on mock clock timing fns would prevent the real ones from being
// restored.
if (obj[methodName] && obj[methodName][j$.Clock.IsMockClockTimingFn]) {
throw new Error("Mock clock timing functions can't be spied on");
}
if (obj[methodName] && j$.isSpy(obj[methodName])) {
if (this.respy) {
return obj[methodName];