Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

zjsunit: Move mock clearing to namespace.finish.

Anders Kaseorg59e5e9ba3507
diff --git a/frontend_tests/zjsunit/namespace.js b/frontend_tests/zjsunit/namespace.js
index 2c8dc4aa56d..790b6f303dc 100644
--- a/frontend_tests/zjsunit/namespace.js
+++ b/frontend_tests/zjsunit/namespace.js
@@ -26,9 +26,6 @@ exports.start = () => {
}
actual_load = Module._load;
Module._load = load;
-
- module_mocks.clear();
- used_module_mocks.clear();
};
exports.mock_module = (short_fn, obj) => {
@@ -123,6 +120,8 @@ exports.finish = function () {
);
}
}
+ module_mocks.clear();
+ used_module_mocks.clear();
for (const path of Object.keys(require.cache)) {
if (path.startsWith(staticPath) && !path.startsWith(templatesPath)) {