mirror of https://github.com/zulip/zulip.git
zjsunit: Clear require cache also for templates.
This is necessary for the new `mock_template` helper added in97ad6b6b62
to work correctly without leaks, since it uses `mock_cjs` under the hood. This logic was added in216493aae8
.
This commit is contained in:
parent
dd90083ed7
commit
09f8a8ec2b
|
@ -148,7 +148,6 @@ exports.zrequire = function (short_fn) {
|
|||
};
|
||||
|
||||
const staticPath = path.resolve(__dirname, "../../static") + path.sep;
|
||||
const templatesPath = staticPath + "templates" + path.sep;
|
||||
|
||||
exports.complain_about_unused_mocks = function () {
|
||||
for (const filename of module_mocks.keys()) {
|
||||
|
@ -177,7 +176,7 @@ exports.finish = function () {
|
|||
used_module_mocks.clear();
|
||||
|
||||
for (const path of Object.keys(require.cache)) {
|
||||
if (path.startsWith(staticPath) && !path.startsWith(templatesPath)) {
|
||||
if (path.startsWith(staticPath)) {
|
||||
delete require.cache[path];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue