diff --git a/frontend_tests/zjsunit/namespace.js b/frontend_tests/zjsunit/namespace.js index 4d95b8fb8f..eafe3a4bc2 100644 --- a/frontend_tests/zjsunit/namespace.js +++ b/frontend_tests/zjsunit/namespace.js @@ -12,12 +12,6 @@ exports.set_global = function (name, val) { `); } - // Add this for debugging and to allow with_overrides - // to know that we're dealing with stubbed code. - if (typeof val === "object") { - val._patched_with_set_global = true; - } - if (!(name in old_globals)) { if (!(name in global)) { new_globals.add(name); @@ -116,16 +110,7 @@ exports.with_overrides = function (test_function) { throw new TypeError(`We cannot override a function for ${typeof obj} objects`); } - if (obj[func_name] === undefined) { - if (obj !== global.$ && !obj._patched_with_set_global) { - throw new Error(` - It looks like you are overriding ${func_name} - for a module that never defined it, which probably - indicates that you have a typo or are doing - something hacky in the test. - `); - } - } else if (typeof obj[func_name] !== "function") { + if (obj[func_name] !== undefined && typeof obj[func_name] !== "function") { throw new TypeError(` You are overriding a non-function with a function. This is almost certainly an error.