Made SpyRegistry compatible with strict mode

This commit is contained in:
Steve Gravrock
2025-10-05 06:53:23 -07:00
parent 18491e9b84
commit 73a30ffc3e
2 changed files with 12 additions and 2 deletions

View File

@@ -10017,6 +10017,8 @@ getJasmineRequireObj().SpyFactory = function(j$) {
};
getJasmineRequireObj().SpyRegistry = function(j$) {
'use strict';
const spyOnMsg = j$.private.formatErrorMsg(
'<spyOn>',
'spyOn(<object>, <methodName>)'
@@ -10099,7 +10101,10 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
};
} else {
restoreStrategy = function() {
if (!delete obj[methodName]) {
try {
delete obj[methodName];
// eslint-disable-next-line no-unused-vars
} catch (e) {
obj[methodName] = originalMethod;
}
};

View File

@@ -1,4 +1,6 @@
getJasmineRequireObj().SpyRegistry = function(j$) {
'use strict';
const spyOnMsg = j$.private.formatErrorMsg(
'<spyOn>',
'spyOn(<object>, <methodName>)'
@@ -81,7 +83,10 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
};
} else {
restoreStrategy = function() {
if (!delete obj[methodName]) {
try {
delete obj[methodName];
// eslint-disable-next-line no-unused-vars
} catch (e) {
obj[methodName] = originalMethod;
}
};