zjsunit: Move mock clearing to namespace.finish.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2021-03-09 21:04:09 -08:00 committed by Steve Howell
parent 1b58f5a700
commit 59e5e9ba35
1 changed files with 2 additions and 3 deletions

View File

@ -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)) {