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.

zjsunit: Deglobalize handlebars.

Anders Kaseorg83fedb405751
diff --git a/frontend_tests/node_tests/alert_words_ui.js b/frontend_tests/node_tests/alert_words_ui.js
index b7e4311af18..ece02708489 100644
--- a/frontend_tests/node_tests/alert_words_ui.js
+++ b/frontend_tests/node_tests/alert_words_ui.js
@@ -2,6 +2,7 @@
const {strict: assert} = require("assert");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -26,7 +27,7 @@ run_test("render_alert_words_ui", () => {
const alert_word_items = $.create("alert_word_items");
word_list.set_find_results(".alert-word-item", alert_word_items);
- global.stub_templates((name, args) => {
+ stub_templates((name, args) => {
assert.equal(name, "settings/alert_word_settings_item");
return "stub-" + args.word;
});
diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js
index f904533cf73..a305ed8ccd5 100644
--- a/frontend_tests/node_tests/compose.js
+++ b/frontend_tests/node_tests/compose.js
@@ -5,6 +5,7 @@ const {strict: assert} = require("assert");
const {JSDOM} = require("jsdom");
const rewiremock = require("rewiremock/node");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -156,7 +157,7 @@ run_test("validate_stream_message_address_info", () => {
sub.subscribed = false;
stream_data.add_sub(sub);
- global.stub_templates((template_name) => {
+ stub_templates((template_name) => {
assert.equal(template_name, "compose_not_subscribed");
return "compose_not_subscribed_stub";
});
@@ -220,7 +221,7 @@ run_test("validate", () => {
$("#zephyr-mirror-error").is = noop;
- global.stub_templates((fn) => {
+ stub_templates((fn) => {
assert.equal(fn, "input_pill");
return "<div>pill-html</div>";
});
@@ -393,7 +394,7 @@ run_test("validate_stream_message", () => {
assert.equal(stream_id, 101);
return 16;
};
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
assert.equal(template_name, "compose_all_everyone");
assert.equal(data.count, 16);
return "compose_all_everyone_stub";
@@ -988,7 +989,7 @@ run_test("warn_if_private_stream_is_linked", () => {
const checks = [
(function () {
let called;
- global.stub_templates((template_name, context) => {
+ stub_templates((template_name, context) => {
called = true;
assert.equal(template_name, "compose_private_stream_alert");
assert.equal(context.stream_name, "Denmark");
@@ -1283,7 +1284,7 @@ run_test("warn_if_mentioning_unsubscribed_user", () => {
(function () {
let called;
- global.stub_templates((template_name, context) => {
+ stub_templates((template_name, context) => {
called = true;
assert.equal(template_name, "compose_invite_users");
assert.equal(context.user_id, 34);
@@ -1344,7 +1345,7 @@ run_test("warn_if_mentioning_unsubscribed_user", () => {
// Now try to mention the same person again. The template should
// not render.
- global.stub_templates(noop);
+ stub_templates(noop);
compose.warn_if_mentioning_unsubscribed_user(mentioned);
assert.equal($("#compose_invite_users").visible(), true);
assert(looked_for_existing);
diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js
index b4194f2b9a7..3ace9b93a6f 100644
--- a/frontend_tests/node_tests/drafts.js
+++ b/frontend_tests/node_tests/drafts.js
@@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
const XDate = require("xdate");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -308,7 +309,7 @@ run_test("format_drafts", (override) => {
return stub_render_now(time, new XDate(1549958107000));
};
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
assert.equal(template_name, "draft_table_body");
// Tests formatting and sorting of drafts
assert.deepEqual(data.drafts, expected);
diff --git a/frontend_tests/node_tests/poll_widget.js b/frontend_tests/node_tests/poll_widget.js
index 45fbe9aff9b..e7707adb750 100644
--- a/frontend_tests/node_tests/poll_widget.js
+++ b/frontend_tests/node_tests/poll_widget.js
@@ -2,6 +2,7 @@
const {strict: assert} = require("assert");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -141,7 +142,7 @@ run_test("PollData my question", () => {
run_test("activate another person poll", () => {
people.is_my_user_id = return_false;
- global.stub_templates((template_name) => {
+ stub_templates((template_name) => {
if (template_name === "widgets/poll_widget") {
return "widgets/poll_widget";
}
@@ -290,7 +291,7 @@ run_test("activate own poll", () => {
$.clear_all_elements();
people.is_my_user_id = return_true;
- global.stub_templates((template_name) => {
+ stub_templates((template_name) => {
if (template_name === "widgets/poll_widget") {
return "widgets/poll_widget";
}
diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js
index 12f634c75b3..f57375f92c4 100644
--- a/frontend_tests/node_tests/popovers.js
+++ b/frontend_tests/node_tests/popovers.js
@@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
const rewiremock = require("rewiremock/node");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -144,7 +145,7 @@ run_test("sender_hover", (override) => {
return {};
};
- global.stub_templates((fn, opts) => {
+ stub_templates((fn, opts) => {
switch (fn) {
case "no_arrow_popover":
assert.deepEqual(opts, {
@@ -242,7 +243,7 @@ run_test("actions_popover", (override) => {
};
};
- global.stub_templates((fn, opts) => {
+ stub_templates((fn, opts) => {
// TODO: Test all the properties of the popover
switch (fn) {
case "actions_popover_content":
diff --git a/frontend_tests/node_tests/reactions.js b/frontend_tests/node_tests/reactions.js
index 1016509cbd1..2700fed9e00 100644
--- a/frontend_tests/node_tests/reactions.js
+++ b/frontend_tests/node_tests/reactions.js
@@ -2,6 +2,7 @@
const {strict: assert} = require("assert");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, with_field, zrequire} = require("../zjsunit/namespace");
const {with_stub} = require("../zjsunit/stub");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -388,7 +389,7 @@ run_test("add_and_remove_reaction", () => {
};
let template_called;
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
template_called = true;
assert.equal(template_name, "message_reaction");
assert.equal(data.class, "message_reaction reacted");
@@ -478,7 +479,7 @@ run_test("add_and_remove_reaction", () => {
};
template_called = false;
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
assert.equal(data.class, "message_reaction");
assert(data.is_realm_emoji);
template_called = true;
diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js
index d9335ba416b..2f33ca4ea62 100644
--- a/frontend_tests/node_tests/recent_topics.js
+++ b/frontend_tests/node_tests/recent_topics.js
@@ -2,6 +2,7 @@
const {strict: assert} = require("assert");
+const {stub_templates} = require("../zjsunit/handlebars");
const {reset_module, set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -310,7 +311,7 @@ run_test("test_recent_topics_launch", () => {
search_val: "",
};
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
if (template_name === "recent_topics_table") {
assert.deepEqual(data, expected);
} else if (template_name === "recent_topics_filters") {
@@ -343,7 +344,7 @@ run_test("test_filter_all", () => {
};
let row_data;
let i;
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
if (template_name === "recent_topic_row") {
// All the row will be processed.
i -= 1;
@@ -399,12 +400,12 @@ run_test("test_filter_unread", () => {
rt = reset_module("recent_topics");
- global.stub_templates(() => "<recent_topics table stub>");
+ stub_templates(() => "<recent_topics table stub>");
rt.process_messages(messages);
assert.equal(rt.inplace_rerender("1:topic-1"), true);
$("#recent_topics_filter_buttons").removeClass("btn-recent-selected");
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
assert.equal(template_name, "recent_topics_filters");
assert.equal(data.filter_unread, expected.filter_unread);
assert.equal(data.filter_participated, expected.filter_participated);
@@ -414,7 +415,7 @@ run_test("test_filter_unread", () => {
rt.set_filter("unread");
rt.update_filters_view();
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
if (template_name === "recent_topic_row") {
// All the row will be processed.
assert.deepEqual(data, row_data[i]);
@@ -462,7 +463,7 @@ run_test("test_filter_participated", () => {
let i = 0;
rt = reset_module("recent_topics");
- global.stub_templates(() => "<recent_topics table stub>");
+ stub_templates(() => "<recent_topics table stub>");
rt.process_messages(messages);
assert.equal(rt.inplace_rerender("1:topic-4"), true);
@@ -474,7 +475,7 @@ run_test("test_filter_participated", () => {
rt.set_filter("muted");
$("#recent_topics_filter_buttons").removeClass("btn-recent-selected");
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
assert.equal(template_name, "recent_topics_filters");
assert.equal(data.filter_unread, expected.filter_unread);
assert.equal(data.filter_participated, expected.filter_participated);
@@ -483,7 +484,7 @@ run_test("test_filter_participated", () => {
rt.set_filter("participated");
rt.update_filters_view();
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
if (template_name === "recent_topic_row") {
// All the row will be processed.
assert.deepEqual(data, row_data[i]);
@@ -502,7 +503,7 @@ run_test("test_filter_participated", () => {
run_test("test_update_unread_count", () => {
rt = reset_module("recent_topics");
rt.set_filter("all");
- global.stub_templates(() => "<recent_topics table stub>");
+ stub_templates(() => "<recent_topics table stub>");
rt.process_messages(messages);
// update a message
@@ -511,7 +512,7 @@ run_test("test_update_unread_count", () => {
});
// template rendering is tested in test_recent_topics_launch.
-global.stub_templates(() => "<recent_topics table stub>");
+stub_templates(() => "<recent_topics table stub>");
run_test("basic assertions", () => {
rt = reset_module("recent_topics");
diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js
index 8f264e631fe..2f46f5d8d4c 100644
--- a/frontend_tests/node_tests/settings_org.js
+++ b/frontend_tests/node_tests/settings_org.js
@@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
const rewiremock = require("rewiremock/node");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -42,7 +43,7 @@ const _page_params = {
const _realm_icon = {};
const _channel = {};
-global.stub_templates((name, data) => {
+stub_templates((name, data) => {
if (name === "settings/admin_realm_domains_list") {
assert(data.realm_domain.domain);
return "stub-domains-list";
diff --git a/frontend_tests/node_tests/settings_profile_fields.js b/frontend_tests/node_tests/settings_profile_fields.js
index a3052f140ce..6245c3bdffe 100644
--- a/frontend_tests/node_tests/settings_profile_fields.js
+++ b/frontend_tests/node_tests/settings_profile_fields.js
@@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
const rewiremock = require("rewiremock/node");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -59,7 +60,7 @@ function test_populate(opts) {
loading.destroy_indicator = () => {};
const template_data = [];
- global.stub_templates((fn, data) => {
+ stub_templates((fn, data) => {
assert.equal(fn, "admin_profile_field_list");
template_data.push(data);
return "whatever";
diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.js
index ec1897f3912..c9b5f5ebbb5 100644
--- a/frontend_tests/node_tests/settings_user_groups.js
+++ b/frontend_tests/node_tests/settings_user_groups.js
@@ -4,6 +4,7 @@ const {strict: assert} = require("assert");
const _ = require("lodash");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -132,7 +133,7 @@ run_test("populate_user_groups", () => {
let templates_render_called = false;
const fake_rendered_temp = $.create("fake_admin_user_group_list_template_rendered");
- global.stub_templates((template, args) => {
+ stub_templates((template, args) => {
assert.equal(template, "admin_user_group_list");
assert.equal(args.user_group.id, 1);
assert.equal(args.user_group.name, "Mobile");
@@ -375,7 +376,7 @@ run_test("with_external_user", () => {
return noop;
};
- global.stub_templates(() => noop);
+ stub_templates(() => noop);
people.get_by_user_id = function () {
return noop;
diff --git a/frontend_tests/node_tests/stream_edit.js b/frontend_tests/node_tests/stream_edit.js
index 5d0330ceefa..88ec8b0a9ce 100644
--- a/frontend_tests/node_tests/stream_edit.js
+++ b/frontend_tests/node_tests/stream_edit.js
@@ -2,13 +2,14 @@
const {strict: assert} = require("assert");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
const {LazySet} = zrequire("lazy_set");
const noop = () => {};
-global.stub_templates(() => noop);
+stub_templates(() => noop);
set_global("channel", {});
set_global("hashchange", {update_browser_history: noop});
diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js
index 1a9a724f48a..15398908a15 100644
--- a/frontend_tests/node_tests/stream_list.js
+++ b/frontend_tests/node_tests/stream_list.js
@@ -2,6 +2,7 @@
const {strict: assert} = require("assert");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -79,7 +80,7 @@ run_test("create_sidebar_row", () => {
devel_count.set_find_results(".value", devel_value);
devel_count.set_parent(sidebar_row);
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
assert.equal(template_name, "stream_sidebar_row");
assert.equal(data.uri, "#narrow/stream/100-devel");
return "<devel sidebar row>";
@@ -98,7 +99,7 @@ run_test("create_sidebar_row", () => {
social_count.set_find_results(".value", social_value);
social_count.set_parent(sidebar_row);
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
assert.equal(template_name, "stream_sidebar_row");
assert.equal(data.uri, "#narrow/stream/200-social");
return "<social sidebar row>";
@@ -144,7 +145,7 @@ run_test("create_sidebar_row", () => {
social.invite_only = true;
social.color = "#222222";
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
assert.equal(template_name, "stream_privacy");
assert.equal(data.invite_only, true);
assert.equal(data.dark_background, "dark_background");
@@ -673,7 +674,7 @@ run_test("rename_stream", () => {
const li_stub = $.create("li stub");
li_stub.length = 0;
- global.stub_templates((name, payload) => {
+ stub_templates((name, payload) => {
assert.equal(name, "stream_sidebar_row");
assert.deepEqual(payload, {
name: "Development",
@@ -721,7 +722,7 @@ run_test("refresh_pin", () => {
const li_stub = $.create("li stub");
li_stub.length = 0;
- global.stub_templates(() => ({to_$: () => li_stub}));
+ stub_templates(() => ({to_$: () => li_stub}));
stream_list.update_count_in_dom = noop;
$("#stream_filters").append = noop;
@@ -750,7 +751,7 @@ run_test("create_initial_sidebar_rows", () => {
stream_list.update_count_in_dom = noop;
- global.stub_templates((template_name, data) => {
+ stub_templates((template_name, data) => {
assert.equal(template_name, "stream_sidebar_row");
return "<div>stub-html-" + data.name;
});
diff --git a/frontend_tests/node_tests/subs.js b/frontend_tests/node_tests/subs.js
index eb66c37843b..8f8262b64fd 100644
--- a/frontend_tests/node_tests/subs.js
+++ b/frontend_tests/node_tests/subs.js
@@ -2,6 +2,7 @@
const {strict: assert} = require("assert");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -94,7 +95,7 @@ run_test("filter_table", () => {
let populated_subs;
- global.stub_templates((fn, data) => {
+ stub_templates((fn, data) => {
assert.equal(fn, "subscriptions");
populated_subs = data.subscriptions;
});
diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js
index 068d8d774d4..dc009f58568 100644
--- a/frontend_tests/node_tests/typeahead_helper.js
+++ b/frontend_tests/node_tests/typeahead_helper.js
@@ -2,6 +2,7 @@
const {strict: assert} = require("assert");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
set_global("page_params", {realm_is_zephyr_mirror_realm: false});
@@ -462,7 +463,7 @@ run_test("render_person when emails hidden", () => {
// Test render_person with regular person, under hidden email visibility case
page_params.is_admin = false;
let rendered = false;
- global.stub_templates((template_name, args) => {
+ stub_templates((template_name, args) => {
assert.equal(template_name, "typeahead_list_item");
assert.equal(args.primary, b_user_1.full_name);
assert.equal(args.secondary, undefined);
@@ -477,7 +478,7 @@ run_test("render_person", () => {
page_params.is_admin = true;
// Test render_person with regular person
let rendered = false;
- global.stub_templates((template_name, args) => {
+ stub_templates((template_name, args) => {
assert.equal(template_name, "typeahead_list_item");
assert.equal(args.primary, a_user.full_name);
assert.equal(args.secondary, a_user.email);
@@ -497,7 +498,7 @@ run_test("render_person", () => {
special_item_text: "special_text",
};
rendered = false;
- global.stub_templates((template_name, args) => {
+ stub_templates((template_name, args) => {
assert.equal(template_name, "typeahead_list_item");
assert.equal(args.primary, special_person.special_item_text);
rendered = true;
@@ -509,7 +510,7 @@ run_test("render_person", () => {
run_test("clear_rendered_person", () => {
let rendered = false;
- global.stub_templates((template_name, args) => {
+ stub_templates((template_name, args) => {
assert.equal(template_name, "typeahead_list_item");
assert.equal(args.primary, b_bot.full_name);
assert.equal(args.secondary, b_bot.email);
@@ -540,7 +541,7 @@ run_test("render_stream", () => {
stream_id: 42,
name: "Short Description",
};
- global.stub_templates((template_name, args) => {
+ stub_templates((template_name, args) => {
assert.equal(template_name, "typeahead_list_item");
assert.equal(args.primary, stream.name);
assert.equal(args.secondary, stream.description);
@@ -557,7 +558,7 @@ run_test("render_stream", () => {
stream_id: 43,
name: "Long Description",
};
- global.stub_templates((template_name, args) => {
+ stub_templates((template_name, args) => {
assert.equal(template_name, "typeahead_list_item");
assert.equal(args.primary, stream.name);
const short_desc = stream.description.slice(0, 35);
@@ -576,7 +577,7 @@ run_test("clear_rendered_stream", () => {
stream_id: 44,
name: "Stream To Be Cleared",
};
- global.stub_templates((template_name, args) => {
+ stub_templates((template_name, args) => {
assert.equal(template_name, "typeahead_list_item");
assert.equal(args.primary, stream.name);
assert.equal(args.secondary, stream.description);
@@ -609,7 +610,7 @@ run_test("render_emoji", () => {
}),
);
- global.stub_templates((template_name, args) => {
+ stub_templates((template_name, args) => {
assert.equal(template_name, "typeahead_list_item");
assert.deepEqual(args, {
primary: "thumbs up",
@@ -631,7 +632,7 @@ run_test("render_emoji", () => {
emoji_url: "TBD",
};
- global.stub_templates((template_name, args) => {
+ stub_templates((template_name, args) => {
assert.equal(template_name, "typeahead_list_item");
assert.deepEqual(args, {
primary: "realm emoji",
diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.js
index 46bdd880a42..501f63b559a 100644
--- a/frontend_tests/node_tests/ui_init.js
+++ b/frontend_tests/node_tests/ui_init.js
@@ -2,6 +2,7 @@
const rewiremock = require("rewiremock/node");
+const {stub_templates} = require("../zjsunit/handlebars");
const {set_global, zrequire} = require("../zjsunit/namespace");
const {make_zjquery} = require("../zjsunit/zjquery");
@@ -74,7 +75,7 @@ for (const mod of ignore_modules) {
}
util.is_mobile = () => false;
-global.stub_templates(() => "some-html");
+stub_templates(() => "some-html");
ui.get_scroll_element = (element) => element;
zrequire("alert_words");
diff --git a/frontend_tests/zjsunit/handlebars.js b/frontend_tests/zjsunit/handlebars.js
index 71aa47f189a..fa3a984d181 100644
--- a/frontend_tests/zjsunit/handlebars.js
+++ b/frontend_tests/zjsunit/handlebars.js
@@ -28,7 +28,7 @@ class ZJavaScriptCompiler extends hb.JavaScriptCompiler {
ZJavaScriptCompiler.prototype.compiler = ZJavaScriptCompiler;
hb.JavaScriptCompiler = ZJavaScriptCompiler;
-require.extensions[".hbs"] = (module, filename) => {
+function compile_hbs(module, filename) {
const code = fs.readFileSync(filename, "utf-8");
const name = path.relative(templates_path, filename).slice(0, -".hbs".length);
const pc = hb.precompile(code, {preventIndent: true, srcName: filename});
@@ -54,4 +54,8 @@ require.extensions[".hbs"] = (module, filename) => {
Buffer.from(out.map.toString()).toString("base64"),
filename,
);
+}
+
+exports.hook_require = () => {
+ require.extensions[".hbs"] = compile_hbs;
};
diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js
index f0ced3c81c0..f5bbd7b963b 100644
--- a/frontend_tests/zjsunit/index.js
+++ b/frontend_tests/zjsunit/index.js
@@ -44,7 +44,7 @@ global.window = new Proxy(global, {
global.to_$ = () => window;
// Set up Handlebars
-global.stub_templates = handlebars.stub_templates;
+handlebars.hook_require();
const noop = function () {};