node test runner: Prevent Handlebars quirks.

We re-require templates.ts before testing each
new test module during the node tests.

This makes it so that if we make mocks in two
different tests, where such mocks influence
how the Handlebars helpers work, then both
tests will have registered their own copies
of the Handlebars helpers.
This commit is contained in:
Steve Howell
2025-01-07 01:43:51 +00:00
committed by Tim Abbott
parent 09716c624f
commit b87d64cd8a
2 changed files with 3 additions and 4 deletions

View File

@@ -20,10 +20,6 @@ page_params.translation_data = {
"<p>Le canal <b>{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 interfere with following tests.
require("../src/templates.ts");
// All of our other tests stub out i18n activity;
// here we do a quick sanity check on the engine itself.
// `i18n.ts` initializes FormatJS and is imported by

View File

@@ -128,6 +128,9 @@ test.set_verbose(files.length === 1);
namespace.mock_esm("../../src/page_params", zpage_params);
require("../../src/page_params.ts");
// Make sure we re-register our Handlebars helpers.
require("../../src/templates.ts");
try {
await run_one_module(file);
blueslip.reset();