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.

node_tests: Refresh templates.js import for every test.

Dinesh55b2b1c25d4c
diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js
index 6346459aa9c..3b4dc203031 100644
--- a/frontend_tests/zjsunit/index.js
+++ b/frontend_tests/zjsunit/index.js
@@ -67,8 +67,6 @@ function short_tb(tb) {
return lines.splice(0, i + 1).join("\n") + "\n(...)\n";
}
-require("../../static/js/templates"); // register Zulip extensions
-
function run_one_module(file) {
zjquery.clear_initialize_function();
zjquery.clear_all_elements();
@@ -82,6 +80,11 @@ test.set_verbose(files.length === 1);
try {
for (const file of files) {
+ // register Zulip extensions before each test file; this is
+ // necessary because of how we mock i18n for every module
+ // except for the i18n test suite.
+ require("../../static/js/templates");
+
namespace.start();
namespace.set_global("window", window);
namespace.set_global("to_$", () => window);