mirror of https://github.com/zulip/zulip.git
node_tests: Refresh templates.js import for every test.
Translation handlebars helpers were not getting changed when we mock static/js/i18n.ts and then unmock it in a different test. We mock i18n.ts for every test except node_tests/i18n.js. So, running any code that calls the registered handlebar helpers related to translations before running i18n test will run the helper functions registered with mocked i18n module. The subsequent tests too would use those functions registered with mocked i18n module. This causes the i18n test to fail as we expect the registered helpers to use actual i18n.ts instead of a mock if we have code that would call the registered translation helpers in tests that run before i18n.
This commit is contained in:
parent
29b354346b
commit
55b2b1c25d
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue