From 7b03d48798a4dd2e550ef9e0f488581e1d383fdd Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Mon, 30 Nov 2020 14:46:45 -0800 Subject: [PATCH] zjsunit: Deglobalize assert. Signed-off-by: Anders Kaseorg --- .eslintrc.json | 1 - frontend_tests/node_tests/activity.js | 2 ++ frontend_tests/node_tests/alert_words.js | 2 ++ frontend_tests/node_tests/alert_words_ui.js | 2 ++ frontend_tests/node_tests/billing.js | 3 ++- frontend_tests/node_tests/billing_helpers.js | 1 + frontend_tests/node_tests/blueslip_stacktrace.js | 2 ++ frontend_tests/node_tests/bot_data.js | 2 ++ frontend_tests/node_tests/buddy_data.js | 2 ++ frontend_tests/node_tests/buddy_list.js | 2 ++ frontend_tests/node_tests/channel.js | 2 ++ frontend_tests/node_tests/color_data.js | 2 ++ frontend_tests/node_tests/colorspace.js | 2 ++ frontend_tests/node_tests/common.js | 2 ++ frontend_tests/node_tests/components.js | 2 ++ frontend_tests/node_tests/compose.js | 2 ++ frontend_tests/node_tests/compose_actions.js | 2 ++ frontend_tests/node_tests/compose_fade.js | 2 ++ frontend_tests/node_tests/compose_pm_pill.js | 2 ++ frontend_tests/node_tests/compose_ui.js | 2 ++ frontend_tests/node_tests/composebox_typeahead.js | 2 ++ frontend_tests/node_tests/copy_and_paste.js | 2 ++ frontend_tests/node_tests/dispatch.js | 2 ++ frontend_tests/node_tests/dispatch_subs.js | 2 ++ frontend_tests/node_tests/drafts.js | 2 ++ frontend_tests/node_tests/dropdown_list_widget.js | 2 ++ frontend_tests/node_tests/echo.js | 2 ++ frontend_tests/node_tests/emoji.js | 2 ++ frontend_tests/node_tests/emoji_picker.js | 2 ++ frontend_tests/node_tests/fenced_code.js | 2 ++ frontend_tests/node_tests/fetch_status.js | 2 ++ frontend_tests/node_tests/filter.js | 2 ++ frontend_tests/node_tests/fold_dict.js | 2 ++ frontend_tests/node_tests/general.js | 2 ++ frontend_tests/node_tests/hash_util.js | 2 ++ frontend_tests/node_tests/hashchange.js | 2 ++ frontend_tests/node_tests/hotkey.js | 2 ++ frontend_tests/node_tests/i18n.js | 2 ++ frontend_tests/node_tests/input_pill.js | 2 ++ frontend_tests/node_tests/lazy_set.js | 2 ++ frontend_tests/node_tests/lightbox.js | 2 ++ frontend_tests/node_tests/list_cursor.js | 2 ++ frontend_tests/node_tests/list_render.js | 2 ++ frontend_tests/node_tests/markdown.js | 2 ++ frontend_tests/node_tests/message_edit.js | 2 ++ frontend_tests/node_tests/message_events.js | 2 ++ frontend_tests/node_tests/message_fetch.js | 2 ++ frontend_tests/node_tests/message_flags.js | 2 ++ frontend_tests/node_tests/message_list.js | 1 + frontend_tests/node_tests/message_list_data.js | 2 ++ frontend_tests/node_tests/message_list_view.js | 2 ++ frontend_tests/node_tests/message_store.js | 2 ++ frontend_tests/node_tests/muting.js | 2 ++ frontend_tests/node_tests/narrow.js | 2 ++ frontend_tests/node_tests/narrow_activate.js | 2 ++ frontend_tests/node_tests/narrow_local.js | 2 ++ frontend_tests/node_tests/narrow_state.js | 2 ++ frontend_tests/node_tests/narrow_unread.js | 2 ++ frontend_tests/node_tests/notifications.js | 2 ++ frontend_tests/node_tests/password.js | 2 ++ frontend_tests/node_tests/people.js | 2 ++ frontend_tests/node_tests/people_errors.js | 2 ++ frontend_tests/node_tests/pm_conversations.js | 2 ++ frontend_tests/node_tests/pm_list.js | 2 ++ frontend_tests/node_tests/poll_widget.js | 2 ++ frontend_tests/node_tests/popovers.js | 2 ++ frontend_tests/node_tests/presence.js | 2 ++ frontend_tests/node_tests/reactions.js | 2 ++ frontend_tests/node_tests/recent_senders.js | 2 ++ frontend_tests/node_tests/recent_topics.js | 2 ++ frontend_tests/node_tests/rendered_markdown.js | 2 ++ frontend_tests/node_tests/rtl.js | 2 ++ frontend_tests/node_tests/schema.js | 2 ++ frontend_tests/node_tests/scroll_util.js | 2 ++ frontend_tests/node_tests/search.js | 2 ++ frontend_tests/node_tests/search_legacy.js | 2 ++ frontend_tests/node_tests/search_pill.js | 2 ++ frontend_tests/node_tests/search_suggestion.js | 2 ++ frontend_tests/node_tests/search_suggestion_legacy.js | 2 ++ frontend_tests/node_tests/server_events.js | 2 ++ frontend_tests/node_tests/settings_bots.js | 2 ++ frontend_tests/node_tests/settings_data.js | 2 ++ frontend_tests/node_tests/settings_emoji.js | 2 ++ frontend_tests/node_tests/settings_muting.js | 2 ++ frontend_tests/node_tests/settings_org.js | 2 ++ frontend_tests/node_tests/settings_profile_fields.js | 2 ++ frontend_tests/node_tests/settings_user_groups.js | 2 ++ frontend_tests/node_tests/spoilers.js | 2 ++ frontend_tests/node_tests/stream_data.js | 2 ++ frontend_tests/node_tests/stream_edit.js | 2 ++ frontend_tests/node_tests/stream_events.js | 2 ++ frontend_tests/node_tests/stream_list.js | 2 ++ frontend_tests/node_tests/stream_pill.js | 2 ++ frontend_tests/node_tests/stream_search.js | 1 + frontend_tests/node_tests/stream_sort.js | 2 ++ frontend_tests/node_tests/stream_topic_history.js | 2 ++ frontend_tests/node_tests/submessage.js | 2 ++ frontend_tests/node_tests/subs.js | 2 ++ frontend_tests/node_tests/support.js | 1 + frontend_tests/node_tests/timerender.js | 2 ++ frontend_tests/node_tests/top_left_corner.js | 2 ++ frontend_tests/node_tests/topic_generator.js | 2 ++ frontend_tests/node_tests/topic_list_data.js | 2 ++ frontend_tests/node_tests/transmit.js | 2 ++ frontend_tests/node_tests/typeahead.js | 2 ++ frontend_tests/node_tests/typeahead_helper.js | 2 ++ frontend_tests/node_tests/typing_data.js | 2 ++ frontend_tests/node_tests/typing_status.js | 2 ++ frontend_tests/node_tests/ui.js | 2 ++ frontend_tests/node_tests/unread.js | 2 ++ frontend_tests/node_tests/upgrade.js | 3 ++- frontend_tests/node_tests/upload.js | 2 ++ frontend_tests/node_tests/user_events.js | 2 ++ frontend_tests/node_tests/user_groups.js | 2 ++ frontend_tests/node_tests/user_pill.js | 2 ++ frontend_tests/node_tests/user_status.js | 2 ++ frontend_tests/node_tests/util.js | 2 ++ frontend_tests/node_tests/vdom.js | 2 ++ frontend_tests/node_tests/widgetize.js | 2 ++ frontend_tests/node_tests/zblueslip.js | 2 ++ frontend_tests/node_tests/zjquery.js | 2 ++ frontend_tests/zjsunit/index.js | 2 -- frontend_tests/zjsunit/markdown_assert.js | 2 ++ frontend_tests/zjsunit/zjquery.js | 2 ++ 124 files changed, 240 insertions(+), 5 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 4fc061010d..8b256ce349 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -361,7 +361,6 @@ { "files": ["frontend_tests/**"], "globals": { - "assert": false, "document": false, "reset_module": false, "set_global": false, diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.js index c2eaf80696..dd5dac640c 100644 --- a/frontend_tests/node_tests/activity.js +++ b/frontend_tests/node_tests/activity.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); const window_stub = $.create("window-stub"); set_global("to_$", () => window_stub); diff --git a/frontend_tests/node_tests/alert_words.js b/frontend_tests/node_tests/alert_words.js index 698ef4e3eb..c3f00f4088 100644 --- a/frontend_tests/node_tests/alert_words.js +++ b/frontend_tests/node_tests/alert_words.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const params = { alert_words: ["alertone", "alerttwo", "alertthree", "al*rt.*s", ".+", "emoji"], }; diff --git a/frontend_tests/node_tests/alert_words_ui.js b/frontend_tests/node_tests/alert_words_ui.js index 4f65657666..3d7f9b305b 100644 --- a/frontend_tests/node_tests/alert_words_ui.js +++ b/frontend_tests/node_tests/alert_words_ui.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); set_global("channel", {}); diff --git a/frontend_tests/node_tests/billing.js b/frontend_tests/node_tests/billing.js index 5dba519f68..a3c3de5db3 100644 --- a/frontend_tests/node_tests/billing.js +++ b/frontend_tests/node_tests/billing.js @@ -1,10 +1,11 @@ "use strict"; -const noop = () => {}; +const {strict: assert} = require("assert"); const fs = require("fs"); const {JSDOM} = require("jsdom"); +const noop = () => {}; const template = fs.readFileSync("templates/corporate/billing.html", "utf-8"); const dom = new JSDOM(template, {pretendToBeVisual: true}); const document = dom.window.document; diff --git a/frontend_tests/node_tests/billing_helpers.js b/frontend_tests/node_tests/billing_helpers.js index 54ee1b43eb..978435ef32 100644 --- a/frontend_tests/node_tests/billing_helpers.js +++ b/frontend_tests/node_tests/billing_helpers.js @@ -1,5 +1,6 @@ "use strict"; +const {strict: assert} = require("assert"); const fs = require("fs"); const JQuery = require("jquery"); diff --git a/frontend_tests/node_tests/blueslip_stacktrace.js b/frontend_tests/node_tests/blueslip_stacktrace.js index fb99707110..a21d9e1c64 100644 --- a/frontend_tests/node_tests/blueslip_stacktrace.js +++ b/frontend_tests/node_tests/blueslip_stacktrace.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const blueslip_stacktrace = zrequire("blueslip_stacktrace"); run_test("clean_path", () => { diff --git a/frontend_tests/node_tests/bot_data.js b/frontend_tests/node_tests/bot_data.js index 7ecab7d0f0..d4e594e20f 100644 --- a/frontend_tests/node_tests/bot_data.js +++ b/frontend_tests/node_tests/bot_data.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _settings_bots = { render_bots: () => {}, }; diff --git a/frontend_tests/node_tests/buddy_data.js b/frontend_tests/node_tests/buddy_data.js index d0ab500bb0..b36d751a05 100644 --- a/frontend_tests/node_tests/buddy_data.js +++ b/frontend_tests/node_tests/buddy_data.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); const _page_params = {}; diff --git a/frontend_tests/node_tests/buddy_list.js b/frontend_tests/node_tests/buddy_list.js index a1232af8af..bd71d7ef3f 100644 --- a/frontend_tests/node_tests/buddy_list.js +++ b/frontend_tests/node_tests/buddy_list.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/channel.js b/frontend_tests/node_tests/channel.js index 124b1ba14d..6b87121305 100644 --- a/frontend_tests/node_tests/channel.js +++ b/frontend_tests/node_tests/channel.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); set_global("$", {}); diff --git a/frontend_tests/node_tests/color_data.js b/frontend_tests/node_tests/color_data.js index b09974b90b..dce99ec987 100644 --- a/frontend_tests/node_tests/color_data.js +++ b/frontend_tests/node_tests/color_data.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("color_data"); run_test("pick_color", () => { diff --git a/frontend_tests/node_tests/colorspace.js b/frontend_tests/node_tests/colorspace.js index cbc423ce47..1eccb53e12 100644 --- a/frontend_tests/node_tests/colorspace.js +++ b/frontend_tests/node_tests/colorspace.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("colorspace"); run_test("sRGB_to_linear", () => { diff --git a/frontend_tests/node_tests/common.js b/frontend_tests/node_tests/common.js index f2dfa1343f..2cdc1cf256 100644 --- a/frontend_tests/node_tests/common.js +++ b/frontend_tests/node_tests/common.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const noop = () => {}; set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/components.js b/frontend_tests/node_tests/components.js index 081ff02fa5..81299fda1b 100644 --- a/frontend_tests/node_tests/components.js +++ b/frontend_tests/node_tests/components.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); zrequire("keydown_util"); diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index d37fd0026a..f438f4d68d 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const {JSDOM} = require("jsdom"); const rewiremock = require("rewiremock/node"); diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.js index f9b7611089..8007f66297 100644 --- a/frontend_tests/node_tests/compose_actions.js +++ b/frontend_tests/node_tests/compose_actions.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const noop = function () {}; const return_false = function () { return false; diff --git a/frontend_tests/node_tests/compose_fade.js b/frontend_tests/node_tests/compose_fade.js index cb2039508c..3198ae15b5 100644 --- a/frontend_tests/node_tests/compose_fade.js +++ b/frontend_tests/node_tests/compose_fade.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("stream_data"); const people = zrequire("people"); zrequire("compose_fade"); diff --git a/frontend_tests/node_tests/compose_pm_pill.js b/frontend_tests/node_tests/compose_pm_pill.js index 95f6a2f611..9fb7e37437 100644 --- a/frontend_tests/node_tests/compose_pm_pill.js +++ b/frontend_tests/node_tests/compose_pm_pill.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/compose_ui.js b/frontend_tests/node_tests/compose_ui.js index 97541e4002..cd3ce813d0 100644 --- a/frontend_tests/node_tests/compose_ui.js +++ b/frontend_tests/node_tests/compose_ui.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const autosize = require("autosize"); zrequire("compose_ui"); diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.js index b5be5ba9e6..7711a124a0 100644 --- a/frontend_tests/node_tests/composebox_typeahead.js +++ b/frontend_tests/node_tests/composebox_typeahead.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const emoji = zrequire("emoji", "shared/js/emoji"); const typeahead = zrequire("typeahead", "shared/js/typeahead"); zrequire("compose_state"); diff --git a/frontend_tests/node_tests/copy_and_paste.js b/frontend_tests/node_tests/copy_and_paste.js index 1cb65caeb7..a5efdab187 100644 --- a/frontend_tests/node_tests/copy_and_paste.js +++ b/frontend_tests/node_tests/copy_and_paste.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + global.stub_out_jquery(); set_global("page_params", { diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js index 1163094905..80d4db25c4 100644 --- a/frontend_tests/node_tests/dispatch.js +++ b/frontend_tests/node_tests/dispatch.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const noop = function () {}; const events = require("./lib/events"); diff --git a/frontend_tests/node_tests/dispatch_subs.js b/frontend_tests/node_tests/dispatch_subs.js index 5c439afcfe..b7df0b384f 100644 --- a/frontend_tests/node_tests/dispatch_subs.js +++ b/frontend_tests/node_tests/dispatch_subs.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const events = require("./lib/events"); const event_fixtures = events.fixtures; diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js index fd86d4f06b..3166e979fc 100644 --- a/frontend_tests/node_tests/drafts.js +++ b/frontend_tests/node_tests/drafts.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const XDate = require("xdate"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/dropdown_list_widget.js b/frontend_tests/node_tests/dropdown_list_widget.js index 21d033299b..91022c0c00 100644 --- a/frontend_tests/node_tests/dropdown_list_widget.js +++ b/frontend_tests/node_tests/dropdown_list_widget.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("dropdown_list_widget"); zrequire("scroll_util"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/echo.js b/frontend_tests/node_tests/echo.js index c6feae6758..0df5ef8610 100644 --- a/frontend_tests/node_tests/echo.js +++ b/frontend_tests/node_tests/echo.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); set_global("markdown", {}); set_global("local_message", { diff --git a/frontend_tests/node_tests/emoji.js b/frontend_tests/node_tests/emoji.js index 55ae29baae..81a37dc030 100644 --- a/frontend_tests/node_tests/emoji.js +++ b/frontend_tests/node_tests/emoji.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json"); const events = require("./lib/events"); diff --git a/frontend_tests/node_tests/emoji_picker.js b/frontend_tests/node_tests/emoji_picker.js index f30c1a5b65..2c2c79a3a6 100644 --- a/frontend_tests/node_tests/emoji_picker.js +++ b/frontend_tests/node_tests/emoji_picker.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); const emoji = zrequire("emoji", "shared/js/emoji"); diff --git a/frontend_tests/node_tests/fenced_code.js b/frontend_tests/node_tests/fenced_code.js index 5d90ab2369..50c18d3f85 100644 --- a/frontend_tests/node_tests/fenced_code.js +++ b/frontend_tests/node_tests/fenced_code.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const fenced_code = zrequire("fenced_code", "shared/js/fenced_code"); run_test("get_unused_fence", () => { diff --git a/frontend_tests/node_tests/fetch_status.js b/frontend_tests/node_tests/fetch_status.js index 3ae0437b70..5c5eb02c22 100644 --- a/frontend_tests/node_tests/fetch_status.js +++ b/frontend_tests/node_tests/fetch_status.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const FetchStatus = zrequire("fetch_status"); set_global("message_scroll", { hide_loading_older: () => {}, diff --git a/frontend_tests/node_tests/filter.js b/frontend_tests/node_tests/filter.js index 2cc26ce623..73be82a877 100644 --- a/frontend_tests/node_tests/filter.js +++ b/frontend_tests/node_tests/filter.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("unread"); zrequire("stream_data"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/fold_dict.js b/frontend_tests/node_tests/fold_dict.js index 493c310712..24fb5d1884 100644 --- a/frontend_tests/node_tests/fold_dict.js +++ b/frontend_tests/node_tests/fold_dict.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const {FoldDict} = zrequire("fold_dict"); run_test("basic", () => { diff --git a/frontend_tests/node_tests/general.js b/frontend_tests/node_tests/general.js index 7d3f6ad367..39d9425913 100644 --- a/frontend_tests/node_tests/general.js +++ b/frontend_tests/node_tests/general.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + // This is a general tour of how to write node tests that // may also give you some quick insight on how the Zulip // browser app is constructed. Let's start with testing diff --git a/frontend_tests/node_tests/hash_util.js b/frontend_tests/node_tests/hash_util.js index 97c82ca576..217790b2d3 100644 --- a/frontend_tests/node_tests/hash_util.js +++ b/frontend_tests/node_tests/hash_util.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("hash_util"); zrequire("stream_data"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.js index c713a433f6..52ee398e44 100644 --- a/frontend_tests/node_tests/hashchange.js +++ b/frontend_tests/node_tests/hashchange.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); const window_stub = $.create("window-stub"); set_global("location", { diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.js index 8768baf23d..3293489661 100644 --- a/frontend_tests/node_tests/hotkey.js +++ b/frontend_tests/node_tests/hotkey.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + // Important note on these tests: // // The way the Zulip hotkey tests work is as follows. First, we set diff --git a/frontend_tests/node_tests/i18n.js b/frontend_tests/node_tests/i18n.js index 5a60898028..ee5762e18c 100644 --- a/frontend_tests/node_tests/i18n.js +++ b/frontend_tests/node_tests/i18n.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("templates"); // We download our translations in `page_params` (which diff --git a/frontend_tests/node_tests/input_pill.js b/frontend_tests/node_tests/input_pill.js index 3409a720c7..90c3922f3a 100644 --- a/frontend_tests/node_tests/input_pill.js +++ b/frontend_tests/node_tests/input_pill.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); zrequire("input_pill"); diff --git a/frontend_tests/node_tests/lazy_set.js b/frontend_tests/node_tests/lazy_set.js index c1caba4d05..f33508e769 100644 --- a/frontend_tests/node_tests/lazy_set.js +++ b/frontend_tests/node_tests/lazy_set.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const {LazySet} = zrequire("lazy_set"); /* diff --git a/frontend_tests/node_tests/lightbox.js b/frontend_tests/node_tests/lightbox.js index e89251fbf5..508aa02f98 100644 --- a/frontend_tests/node_tests/lightbox.js +++ b/frontend_tests/node_tests/lightbox.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("rows"); zrequire("lightbox"); diff --git a/frontend_tests/node_tests/list_cursor.js b/frontend_tests/node_tests/list_cursor.js index d3ce3922c7..ec006d8d16 100644 --- a/frontend_tests/node_tests/list_cursor.js +++ b/frontend_tests/node_tests/list_cursor.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("list_cursor"); run_test("config errors", () => { diff --git a/frontend_tests/node_tests/list_render.js b/frontend_tests/node_tests/list_render.js index 384150030f..2dcd5ee6f1 100644 --- a/frontend_tests/node_tests/list_render.js +++ b/frontend_tests/node_tests/list_render.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("list_render"); // We need these stubs to get by instanceof checks. diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js index 5eb530293b..f2f2ec1acb 100644 --- a/frontend_tests/node_tests/markdown.js +++ b/frontend_tests/node_tests/markdown.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("hash_util"); const emoji = zrequire("emoji", "shared/js/emoji"); diff --git a/frontend_tests/node_tests/message_edit.js b/frontend_tests/node_tests/message_edit.js index be132278ff..775389586b 100644 --- a/frontend_tests/node_tests/message_edit.js +++ b/frontend_tests/node_tests/message_edit.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("document", null); set_global("page_params", { realm_community_topic_editing_limit_seconds: 86400, diff --git a/frontend_tests/node_tests/message_events.js b/frontend_tests/node_tests/message_events.js index a53161b8d3..a30885de7c 100644 --- a/frontend_tests/node_tests/message_events.js +++ b/frontend_tests/node_tests/message_events.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("message_events"); zrequire("message_store"); zrequire("muting"); diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.js index 92f0ea6f82..690cae239a 100644 --- a/frontend_tests/node_tests/message_fetch.js +++ b/frontend_tests/node_tests/message_fetch.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/message_flags.js b/frontend_tests/node_tests/message_flags.js index aa15926c94..18087079fa 100644 --- a/frontend_tests/node_tests/message_flags.js +++ b/frontend_tests/node_tests/message_flags.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("unread"); zrequire("unread_ops"); zrequire("message_flags"); diff --git a/frontend_tests/node_tests/message_list.js b/frontend_tests/node_tests/message_list.js index 14beb57898..75a21a98ab 100644 --- a/frontend_tests/node_tests/message_list.js +++ b/frontend_tests/node_tests/message_list.js @@ -1,5 +1,6 @@ "use strict"; +const {strict: assert} = require("assert"); // These unit tests for static/js/message_list.js emphasize the model-ish // aspects of the MessageList class. We have to stub out a few functions // related to views and events to get the tests working. diff --git a/frontend_tests/node_tests/message_list_data.js b/frontend_tests/node_tests/message_list_data.js index 5a10682dfe..874e8c130f 100644 --- a/frontend_tests/node_tests/message_list_data.js +++ b/frontend_tests/node_tests/message_list_data.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("unread"); zrequire("Filter", "js/filter"); diff --git a/frontend_tests/node_tests/message_list_view.js b/frontend_tests/node_tests/message_list_view.js index 90d96df366..b2cb072578 100644 --- a/frontend_tests/node_tests/message_list_view.js +++ b/frontend_tests/node_tests/message_list_view.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/message_store.js b/frontend_tests/node_tests/message_store.js index e948bb704a..87a93bd985 100644 --- a/frontend_tests/node_tests/message_store.js +++ b/frontend_tests/node_tests/message_store.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const util = zrequire("util"); zrequire("pm_conversations"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/muting.js b/frontend_tests/node_tests/muting.js index 0a0b0ace35..b9ceab6da8 100644 --- a/frontend_tests/node_tests/muting.js +++ b/frontend_tests/node_tests/muting.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("timerender"); zrequire("muting"); zrequire("stream_data"); diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.js index ee8856d021..887f16662e 100644 --- a/frontend_tests/node_tests/narrow.js +++ b/frontend_tests/node_tests/narrow.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); zrequire("hash_util"); zrequire("hashchange"); diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.js index c958e5434d..17b8bcc82c 100644 --- a/frontend_tests/node_tests/narrow_activate.js +++ b/frontend_tests/node_tests/narrow_activate.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const util = zrequire("util"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/narrow_local.js b/frontend_tests/node_tests/narrow_local.js index 8194b84354..3833b0c8e2 100644 --- a/frontend_tests/node_tests/narrow_local.js +++ b/frontend_tests/node_tests/narrow_local.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("Filter", "js/filter"); zrequire("FetchStatus", "js/fetch_status"); zrequire("MessageListData", "js/message_list_data"); diff --git a/frontend_tests/node_tests/narrow_state.js b/frontend_tests/node_tests/narrow_state.js index a6928204e0..fce2426b8b 100644 --- a/frontend_tests/node_tests/narrow_state.js +++ b/frontend_tests/node_tests/narrow_state.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const people = zrequire("people"); zrequire("Filter", "js/filter"); zrequire("stream_data"); diff --git a/frontend_tests/node_tests/narrow_unread.js b/frontend_tests/node_tests/narrow_unread.js index 3131e2ed93..c7dae7ed77 100644 --- a/frontend_tests/node_tests/narrow_unread.js +++ b/frontend_tests/node_tests/narrow_unread.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("Filter", "js/filter"); const people = zrequire("people"); zrequire("stream_data"); diff --git a/frontend_tests/node_tests/notifications.js b/frontend_tests/node_tests/notifications.js index e91f5c207d..cf08b473ea 100644 --- a/frontend_tests/node_tests/notifications.js +++ b/frontend_tests/node_tests/notifications.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const rewiremock = require("rewiremock/node"); // Dependencies diff --git a/frontend_tests/node_tests/password.js b/frontend_tests/node_tests/password.js index 745f0df0bb..9cd8d9177d 100644 --- a/frontend_tests/node_tests/password.js +++ b/frontend_tests/node_tests/password.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("zxcvbn", zrequire("zxcvbn", "zxcvbn")); zrequire("common"); diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js index 9c8ad4935f..e10ed32292 100644 --- a/frontend_tests/node_tests/people.js +++ b/frontend_tests/node_tests/people.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); const moment = require("moment-timezone"); const rewiremock = require("rewiremock/node"); diff --git a/frontend_tests/node_tests/people_errors.js b/frontend_tests/node_tests/people_errors.js index b4e12019f3..370238a68d 100644 --- a/frontend_tests/node_tests/people_errors.js +++ b/frontend_tests/node_tests/people_errors.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const people = zrequire("people"); const return_false = function () { diff --git a/frontend_tests/node_tests/pm_conversations.js b/frontend_tests/node_tests/pm_conversations.js index b9b8a377dc..52849a5483 100644 --- a/frontend_tests/node_tests/pm_conversations.js +++ b/frontend_tests/node_tests/pm_conversations.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const pmc = zrequire("pm_conversations"); run_test("partners", () => { diff --git a/frontend_tests/node_tests/pm_list.js b/frontend_tests/node_tests/pm_list.js index e0108114af..ec02a4d629 100644 --- a/frontend_tests/node_tests/pm_list.js +++ b/frontend_tests/node_tests/pm_list.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); set_global("narrow_state", {}); diff --git a/frontend_tests/node_tests/poll_widget.js b/frontend_tests/node_tests/poll_widget.js index 8f0c10e077..ff11a0f551 100644 --- a/frontend_tests/node_tests/poll_widget.js +++ b/frontend_tests/node_tests/poll_widget.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("poll_widget"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index 34649b1036..dec862f8f1 100644 --- a/frontend_tests/node_tests/popovers.js +++ b/frontend_tests/node_tests/popovers.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const rewiremock = require("rewiremock/node"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/presence.js b/frontend_tests/node_tests/presence.js index 1c371f69d1..38c92562cf 100644 --- a/frontend_tests/node_tests/presence.js +++ b/frontend_tests/node_tests/presence.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const XDate = require("xdate"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/reactions.js b/frontend_tests/node_tests/reactions.js index fd96260aa8..32a42953c1 100644 --- a/frontend_tests/node_tests/reactions.js +++ b/frontend_tests/node_tests/reactions.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("document", "document-stub"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/recent_senders.js b/frontend_tests/node_tests/recent_senders.js index b5dd2fc157..ca22bbaee1 100644 --- a/frontend_tests/node_tests/recent_senders.js +++ b/frontend_tests/node_tests/recent_senders.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const rs = zrequire("recent_senders"); let next_id = 0; diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js index 9188a37592..b59e9e765d 100644 --- a/frontend_tests/node_tests/recent_topics.js +++ b/frontend_tests/node_tests/recent_topics.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("message_util"); const noop = () => {}; diff --git a/frontend_tests/node_tests/rendered_markdown.js b/frontend_tests/node_tests/rendered_markdown.js index 7ef9d3f72e..d71111b196 100644 --- a/frontend_tests/node_tests/rendered_markdown.js +++ b/frontend_tests/node_tests/rendered_markdown.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const rm = zrequire("rendered_markdown"); const people = zrequire("people"); zrequire("user_groups"); diff --git a/frontend_tests/node_tests/rtl.js b/frontend_tests/node_tests/rtl.js index 1c758c83bb..79bf8d478d 100644 --- a/frontend_tests/node_tests/rtl.js +++ b/frontend_tests/node_tests/rtl.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const rtl = zrequire("rtl"); run_test("get_direction", () => { diff --git a/frontend_tests/node_tests/schema.js b/frontend_tests/node_tests/schema.js index 2d620047c3..c77c4a7f95 100644 --- a/frontend_tests/node_tests/schema.js +++ b/frontend_tests/node_tests/schema.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("schema"); run_test("basics", () => { diff --git a/frontend_tests/node_tests/scroll_util.js b/frontend_tests/node_tests/scroll_util.js index a07f110059..0e6dc9ad88 100644 --- a/frontend_tests/node_tests/scroll_util.js +++ b/frontend_tests/node_tests/scroll_util.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("scroll_util"); set_global("ui", { get_scroll_element: (element) => element, diff --git a/frontend_tests/node_tests/search.js b/frontend_tests/node_tests/search.js index 506822f491..d599631dba 100644 --- a/frontend_tests/node_tests/search.js +++ b/frontend_tests/node_tests/search.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("page_params", { search_pills_enabled: true, }); diff --git a/frontend_tests/node_tests/search_legacy.js b/frontend_tests/node_tests/search_legacy.js index 2a2c06c415..b334d9f94c 100644 --- a/frontend_tests/node_tests/search_legacy.js +++ b/frontend_tests/node_tests/search_legacy.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("page_params", { search_pills_enabled: false, }); diff --git a/frontend_tests/node_tests/search_pill.js b/frontend_tests/node_tests/search_pill.js index c588f3e4ab..2eaeef7088 100644 --- a/frontend_tests/node_tests/search_pill.js +++ b/frontend_tests/node_tests/search_pill.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("search_pill"); zrequire("input_pill"); zrequire("Filter", "js/filter"); diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.js index 47c0cce59f..7535360329 100644 --- a/frontend_tests/node_tests/search_suggestion.js +++ b/frontend_tests/node_tests/search_suggestion.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("page_params", { search_pills_enabled: true, }); diff --git a/frontend_tests/node_tests/search_suggestion_legacy.js b/frontend_tests/node_tests/search_suggestion_legacy.js index 3b0020541e..e9eeb717b2 100644 --- a/frontend_tests/node_tests/search_suggestion_legacy.js +++ b/frontend_tests/node_tests/search_suggestion_legacy.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("page_params", { search_pills_enabled: false, }); diff --git a/frontend_tests/node_tests/server_events.js b/frontend_tests/node_tests/server_events.js index 8c88c23369..376afcadb8 100644 --- a/frontend_tests/node_tests/server_events.js +++ b/frontend_tests/node_tests/server_events.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const noop = function () {}; set_global("document", {}); diff --git a/frontend_tests/node_tests/settings_bots.js b/frontend_tests/node_tests/settings_bots.js index 196dcf1143..a00deeef6a 100644 --- a/frontend_tests/node_tests/settings_bots.js +++ b/frontend_tests/node_tests/settings_bots.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const rewiremock = require("rewiremock/node"); set_global("page_params", { diff --git a/frontend_tests/node_tests/settings_data.js b/frontend_tests/node_tests/settings_data.js index 9261e11424..35587172df 100644 --- a/frontend_tests/node_tests/settings_data.js +++ b/frontend_tests/node_tests/settings_data.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const settings_data = zrequire("settings_data"); const settings_config = zrequire("settings_config"); diff --git a/frontend_tests/node_tests/settings_emoji.js b/frontend_tests/node_tests/settings_emoji.js index 743a4f7848..9cc9d08dd4 100644 --- a/frontend_tests/node_tests/settings_emoji.js +++ b/frontend_tests/node_tests/settings_emoji.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); set_global("upload_widget", {}); zrequire("settings_emoji"); diff --git a/frontend_tests/node_tests/settings_muting.js b/frontend_tests/node_tests/settings_muting.js index f80de13243..512341f7a6 100644 --- a/frontend_tests/node_tests/settings_muting.js +++ b/frontend_tests/node_tests/settings_muting.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); set_global("XDate", zrequire("XDate", "xdate")); diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index a14021230c..1d34dfa595 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const rewiremock = require("rewiremock/node"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/settings_profile_fields.js b/frontend_tests/node_tests/settings_profile_fields.js index e818ca9419..20de9b07bc 100644 --- a/frontend_tests/node_tests/settings_profile_fields.js +++ b/frontend_tests/node_tests/settings_profile_fields.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const rewiremock = require("rewiremock/node"); set_global("page_params", {}); diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.js index fa92a7f5aa..eceda65c76 100644 --- a/frontend_tests/node_tests/settings_user_groups.js +++ b/frontend_tests/node_tests/settings_user_groups.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); zrequire("user_pill"); diff --git a/frontend_tests/node_tests/spoilers.js b/frontend_tests/node_tests/spoilers.js index 81b48f6ebd..92aa26a805 100644 --- a/frontend_tests/node_tests/spoilers.js +++ b/frontend_tests/node_tests/spoilers.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); zrequire("spoilers"); diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js index 15681ecdf9..e3e7ba1e8c 100644 --- a/frontend_tests/node_tests/stream_data.js +++ b/frontend_tests/node_tests/stream_data.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); set_global("page_params", { diff --git a/frontend_tests/node_tests/stream_edit.js b/frontend_tests/node_tests/stream_edit.js index 9465cccc74..b965f04f90 100644 --- a/frontend_tests/node_tests/stream_edit.js +++ b/frontend_tests/node_tests/stream_edit.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const {LazySet} = zrequire("lazy_set"); const noop = () => {}; diff --git a/frontend_tests/node_tests/stream_events.js b/frontend_tests/node_tests/stream_events.js index a096a1c167..af853fc734 100644 --- a/frontend_tests/node_tests/stream_events.js +++ b/frontend_tests/node_tests/stream_events.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const noop = function () {}; const return_true = function () { return true; diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js index 92382e0470..de2b5ccf2c 100644 --- a/frontend_tests/node_tests/stream_list.js +++ b/frontend_tests/node_tests/stream_list.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("document", "document-stub"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/stream_pill.js b/frontend_tests/node_tests/stream_pill.js index ba8c489983..0b103981be 100644 --- a/frontend_tests/node_tests/stream_pill.js +++ b/frontend_tests/node_tests/stream_pill.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("stream_data"); zrequire("stream_pill"); diff --git a/frontend_tests/node_tests/stream_search.js b/frontend_tests/node_tests/stream_search.js index fbe49d960a..51a1bb3a78 100644 --- a/frontend_tests/node_tests/stream_search.js +++ b/frontend_tests/node_tests/stream_search.js @@ -1,5 +1,6 @@ "use strict"; +const {strict: assert} = require("assert"); // This tests the stream searching functionality which currently // lives in stream_list.js. diff --git a/frontend_tests/node_tests/stream_sort.js b/frontend_tests/node_tests/stream_sort.js index bba41a1a22..41e001589f 100644 --- a/frontend_tests/node_tests/stream_sort.js +++ b/frontend_tests/node_tests/stream_sort.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("stream_data"); zrequire("stream_sort"); diff --git a/frontend_tests/node_tests/stream_topic_history.js b/frontend_tests/node_tests/stream_topic_history.js index ddbbcb17a9..ba8a694c5b 100644 --- a/frontend_tests/node_tests/stream_topic_history.js +++ b/frontend_tests/node_tests/stream_topic_history.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("unread"); zrequire("stream_data"); zrequire("stream_topic_history"); diff --git a/frontend_tests/node_tests/submessage.js b/frontend_tests/node_tests/submessage.js index fa26f88eb7..973eabc537 100644 --- a/frontend_tests/node_tests/submessage.js +++ b/frontend_tests/node_tests/submessage.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("submessage"); set_global("channel", {}); diff --git a/frontend_tests/node_tests/subs.js b/frontend_tests/node_tests/subs.js index 483903dfc0..a5e614d00e 100644 --- a/frontend_tests/node_tests/subs.js +++ b/frontend_tests/node_tests/subs.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + global.stub_out_jquery(); set_global("ui", { diff --git a/frontend_tests/node_tests/support.js b/frontend_tests/node_tests/support.js index b81acc4ffb..7584e47f25 100644 --- a/frontend_tests/node_tests/support.js +++ b/frontend_tests/node_tests/support.js @@ -1,5 +1,6 @@ "use strict"; +const {strict: assert} = require("assert"); const fs = require("fs"); const {JSDOM} = require("jsdom"); diff --git a/frontend_tests/node_tests/timerender.js b/frontend_tests/node_tests/timerender.js index 9864393396..dc3e080433 100644 --- a/frontend_tests/node_tests/timerender.js +++ b/frontend_tests/node_tests/timerender.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const moment = require("moment"); const XDate = require("xdate"); diff --git a/frontend_tests/node_tests/top_left_corner.js b/frontend_tests/node_tests/top_left_corner.js index b1d1480a60..6fd6827dd4 100644 --- a/frontend_tests/node_tests/top_left_corner.js +++ b/frontend_tests/node_tests/top_left_corner.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); zrequire("Filter", "js/filter"); diff --git a/frontend_tests/node_tests/topic_generator.js b/frontend_tests/node_tests/topic_generator.js index 8ca1c2fbae..f646ea6d2a 100644 --- a/frontend_tests/node_tests/topic_generator.js +++ b/frontend_tests/node_tests/topic_generator.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const pm_conversations = zrequire("pm_conversations"); pm_conversations.recent = {}; diff --git a/frontend_tests/node_tests/topic_list_data.js b/frontend_tests/node_tests/topic_list_data.js index d3f3ad1060..3730dc5b14 100644 --- a/frontend_tests/node_tests/topic_list_data.js +++ b/frontend_tests/node_tests/topic_list_data.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); set_global("narrow_state", {}); diff --git a/frontend_tests/node_tests/transmit.js b/frontend_tests/node_tests/transmit.js index 1593fb8a2e..37baa5c7ea 100644 --- a/frontend_tests/node_tests/transmit.js +++ b/frontend_tests/node_tests/transmit.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const noop = function () {}; set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/typeahead.js b/frontend_tests/node_tests/typeahead.js index d1f1100573..51fadcf921 100644 --- a/frontend_tests/node_tests/typeahead.js +++ b/frontend_tests/node_tests/typeahead.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const typeahead = zrequire("typeahead", "shared/js/typeahead"); // The data structures here may be different for diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js index 43b0dbf7cb..a7ca2414f3 100644 --- a/frontend_tests/node_tests/typeahead_helper.js +++ b/frontend_tests/node_tests/typeahead_helper.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("page_params", {realm_is_zephyr_mirror_realm: false}); set_global("md5", (s) => "md5-" + s); diff --git a/frontend_tests/node_tests/typing_data.js b/frontend_tests/node_tests/typing_data.js index d1f2b8a768..82f1daec43 100644 --- a/frontend_tests/node_tests/typing_data.js +++ b/frontend_tests/node_tests/typing_data.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("typing_data"); run_test("basics", () => { diff --git a/frontend_tests/node_tests/typing_status.js b/frontend_tests/node_tests/typing_status.js index ffcda32a55..b8bd5abf14 100644 --- a/frontend_tests/node_tests/typing_status.js +++ b/frontend_tests/node_tests/typing_status.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("typing"); zrequire("people"); zrequire("compose_pm_pill"); diff --git a/frontend_tests/node_tests/ui.js b/frontend_tests/node_tests/ui.js index 8ed2e3eb26..e0efa634b4 100644 --- a/frontend_tests/node_tests/ui.js +++ b/frontend_tests/node_tests/ui.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const ui = zrequire("ui"); set_global("navigator", { diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js index db28811b91..0559a7b17d 100644 --- a/frontend_tests/node_tests/unread.js +++ b/frontend_tests/node_tests/unread.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const _ = require("lodash"); zrequire("muting"); diff --git a/frontend_tests/node_tests/upgrade.js b/frontend_tests/node_tests/upgrade.js index 7aa4be0d24..44c69d9baf 100644 --- a/frontend_tests/node_tests/upgrade.js +++ b/frontend_tests/node_tests/upgrade.js @@ -1,10 +1,11 @@ "use strict"; -const noop = () => {}; +const {strict: assert} = require("assert"); const fs = require("fs"); const {JSDOM} = require("jsdom"); +const noop = () => {}; const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8"); const dom = new JSDOM(template, {pretendToBeVisual: true}); const document = dom.window.document; diff --git a/frontend_tests/node_tests/upload.js b/frontend_tests/node_tests/upload.js index 5370c554b8..fb887827a3 100644 --- a/frontend_tests/node_tests/upload.js +++ b/frontend_tests/node_tests/upload.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const rewiremock = require("rewiremock/node"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/user_events.js b/frontend_tests/node_tests/user_events.js index fc326e37b6..61c232c1fb 100644 --- a/frontend_tests/node_tests/user_events.js +++ b/frontend_tests/node_tests/user_events.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/user_groups.js b/frontend_tests/node_tests/user_groups.js index 3a7a47dbd4..888cff1516 100644 --- a/frontend_tests/node_tests/user_groups.js +++ b/frontend_tests/node_tests/user_groups.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("user_groups"); run_test("user_groups", () => { diff --git a/frontend_tests/node_tests/user_pill.js b/frontend_tests/node_tests/user_pill.js index 1c628a5f0a..6388a36d22 100644 --- a/frontend_tests/node_tests/user_pill.js +++ b/frontend_tests/node_tests/user_pill.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const people = zrequire("people"); set_global("md5", (s) => "md5-" + s); zrequire("user_pill"); diff --git a/frontend_tests/node_tests/user_status.js b/frontend_tests/node_tests/user_status.js index 434d99b205..2bf9c7a003 100644 --- a/frontend_tests/node_tests/user_status.js +++ b/frontend_tests/node_tests/user_status.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("channel", {}); zrequire("user_status"); diff --git a/frontend_tests/node_tests/util.js b/frontend_tests/node_tests/util.js index f0f57b875c..23130b9fb4 100644 --- a/frontend_tests/node_tests/util.js +++ b/frontend_tests/node_tests/util.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const {JSDOM} = require("jsdom"); const _ = require("lodash"); diff --git a/frontend_tests/node_tests/vdom.js b/frontend_tests/node_tests/vdom.js index 0ca5b50494..4e2b9a5d47 100644 --- a/frontend_tests/node_tests/vdom.js +++ b/frontend_tests/node_tests/vdom.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + zrequire("vdom"); run_test("basics", () => { diff --git a/frontend_tests/node_tests/widgetize.js b/frontend_tests/node_tests/widgetize.js index aa40cb0695..1ec8d7261f 100644 --- a/frontend_tests/node_tests/widgetize.js +++ b/frontend_tests/node_tests/widgetize.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + set_global("$", global.make_zjquery()); set_global("poll_widget", {}); set_global("todo_widget", {}); diff --git a/frontend_tests/node_tests/zblueslip.js b/frontend_tests/node_tests/zblueslip.js index 10373f8839..e7a1963f92 100644 --- a/frontend_tests/node_tests/zblueslip.js +++ b/frontend_tests/node_tests/zblueslip.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + /* This test module actually tests our test code, particularly zblueslip, and diff --git a/frontend_tests/node_tests/zjquery.js b/frontend_tests/node_tests/zjquery.js index 0a2184316b..0b45e211b2 100644 --- a/frontend_tests/node_tests/zjquery.js +++ b/frontend_tests/node_tests/zjquery.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + /* This test module actually tests our test code, particularly zjquery, and diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js index f005abb9b2..bfd6b50e8d 100644 --- a/frontend_tests/zjsunit/index.js +++ b/frontend_tests/zjsunit/index.js @@ -25,8 +25,6 @@ require("@babel/register")({ plugins: ["rewire-ts"], }); -global.assert = require("assert").strict; - // Create a helper function to avoid sneaky delays in tests. function immediate(f) { return () => f(); diff --git a/frontend_tests/zjsunit/markdown_assert.js b/frontend_tests/zjsunit/markdown_assert.js index 75c5afb423..49566cbd7f 100644 --- a/frontend_tests/zjsunit/markdown_assert.js +++ b/frontend_tests/zjsunit/markdown_assert.js @@ -22,6 +22,8 @@ * HTML. This makes it easier to spot relevant differences. */ +const {strict: assert} = require("assert"); + const {JSDOM} = require("jsdom"); const _ = require("lodash"); diff --git a/frontend_tests/zjsunit/zjquery.js b/frontend_tests/zjsunit/zjquery.js index 8e4945473e..03b17f01a4 100644 --- a/frontend_tests/zjsunit/zjquery.js +++ b/frontend_tests/zjsunit/zjquery.js @@ -1,5 +1,7 @@ "use strict"; +const {strict: assert} = require("assert"); + const noop = function () {}; class Event {