node_tests: Import templates.js only once for all tests.

Reverts 55b2b1c with a better fix.

Closes: #19934
This commit is contained in:
Dinesh 2021-10-13 13:11:02 +05:30 committed by Tim Abbott
parent 6f31b959ac
commit 40470b938b
2 changed files with 6 additions and 5 deletions

View File

@ -20,6 +20,10 @@ page_params.translation_data = {
"<p>Le canal <b>{stream_name}</b> n'existe pas.</p><p>Gérez vos abonnements <z-link>sur votre page canaux</z-link>.</p>",
};
// Re-register Zulip extensions so extensions registered previously with
// mocked i18n.ts do not interefere with following tests.
require("../../static/js/templates");
// All of our other tests stub out i18n activity;
// here we do a quick sanity check on the engine itself.
// `i18n.js` initializes FormatJS and is imported by

View File

@ -67,6 +67,8 @@ 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();
@ -80,11 +82,6 @@ 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);