diff --git a/.eslintrc.json b/.eslintrc.json index cf3876cbde..fc52b7310f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -228,7 +228,6 @@ "resize": false, "rows": false, "rtl": false, - "run_test": false, "schema": false, "scroll_bar": false, "scroll_util": false, diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.js index b11bacc60d..9d585ae6da 100644 --- a/frontend_tests/node_tests/activity.js +++ b/frontend_tests/node_tests/activity.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/alert_words.js b/frontend_tests/node_tests/alert_words.js index 4b13cb1eb7..22008f0a3d 100644 --- a/frontend_tests/node_tests/alert_words.js +++ b/frontend_tests/node_tests/alert_words.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); 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 ece0270848..ebbadbc041 100644 --- a/frontend_tests/node_tests/alert_words_ui.js +++ b/frontend_tests/node_tests/alert_words_ui.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/billing.js b/frontend_tests/node_tests/billing.js index d5e161ca72..c50fa94d4b 100644 --- a/frontend_tests/node_tests/billing.js +++ b/frontend_tests/node_tests/billing.js @@ -6,6 +6,7 @@ const fs = require("fs"); const {JSDOM} = require("jsdom"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const noop = () => {}; diff --git a/frontend_tests/node_tests/billing_helpers.js b/frontend_tests/node_tests/billing_helpers.js index 9aa178bfca..64d445fc97 100644 --- a/frontend_tests/node_tests/billing_helpers.js +++ b/frontend_tests/node_tests/billing_helpers.js @@ -7,6 +7,7 @@ const JQuery = require("jquery"); const {JSDOM} = require("jsdom"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8"); diff --git a/frontend_tests/node_tests/blueslip_stacktrace.js b/frontend_tests/node_tests/blueslip_stacktrace.js index a821469ef2..482b76c4b7 100644 --- a/frontend_tests/node_tests/blueslip_stacktrace.js +++ b/frontend_tests/node_tests/blueslip_stacktrace.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const blueslip_stacktrace = zrequire("blueslip_stacktrace"); diff --git a/frontend_tests/node_tests/bot_data.js b/frontend_tests/node_tests/bot_data.js index b4bbfbcb09..d69866bdc2 100644 --- a/frontend_tests/node_tests/bot_data.js +++ b/frontend_tests/node_tests/bot_data.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const _settings_bots = { render_bots: () => {}, diff --git a/frontend_tests/node_tests/buddy_data.js b/frontend_tests/node_tests/buddy_data.js index 1aa2c69125..84da506caa 100644 --- a/frontend_tests/node_tests/buddy_data.js +++ b/frontend_tests/node_tests/buddy_data.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const _page_params = {}; diff --git a/frontend_tests/node_tests/buddy_list.js b/frontend_tests/node_tests/buddy_list.js index 47def15628..9c9a8df007 100644 --- a/frontend_tests/node_tests/buddy_list.js +++ b/frontend_tests/node_tests/buddy_list.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/channel.js b/frontend_tests/node_tests/channel.js index d0525e1bcd..9f08ed1da1 100644 --- a/frontend_tests/node_tests/channel.js +++ b/frontend_tests/node_tests/channel.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); set_global("$", {}); diff --git a/frontend_tests/node_tests/color_data.js b/frontend_tests/node_tests/color_data.js index da93028267..37ba0b9397 100644 --- a/frontend_tests/node_tests/color_data.js +++ b/frontend_tests/node_tests/color_data.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("color_data"); diff --git a/frontend_tests/node_tests/colorspace.js b/frontend_tests/node_tests/colorspace.js index 8b5621ba6a..4717480ba2 100644 --- a/frontend_tests/node_tests/colorspace.js +++ b/frontend_tests/node_tests/colorspace.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("colorspace"); diff --git a/frontend_tests/node_tests/common.js b/frontend_tests/node_tests/common.js index d7fe48b12f..3bd1435315 100644 --- a/frontend_tests/node_tests/common.js +++ b/frontend_tests/node_tests/common.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const noop = () => {}; diff --git a/frontend_tests/node_tests/components.js b/frontend_tests/node_tests/components.js index 4aa216ca20..5563fa07f7 100644 --- a/frontend_tests/node_tests/components.js +++ b/frontend_tests/node_tests/components.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("keydown_util"); zrequire("components"); diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index a305ed8ccd..63c855ca88 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -7,6 +7,7 @@ const rewiremock = require("rewiremock/node"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const events = require("./lib/events"); diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.js index 1f79c3f656..16dcf22619 100644 --- a/frontend_tests/node_tests/compose_actions.js +++ b/frontend_tests/node_tests/compose_actions.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const noop = function () {}; diff --git a/frontend_tests/node_tests/compose_fade.js b/frontend_tests/node_tests/compose_fade.js index 61305c89b3..f98eeba5cf 100644 --- a/frontend_tests/node_tests/compose_fade.js +++ b/frontend_tests/node_tests/compose_fade.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("stream_data"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/compose_pm_pill.js b/frontend_tests/node_tests/compose_pm_pill.js index e004d3fa16..a05df8ed5c 100644 --- a/frontend_tests/node_tests/compose_pm_pill.js +++ b/frontend_tests/node_tests/compose_pm_pill.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/compose_ui.js b/frontend_tests/node_tests/compose_ui.js index 06775489f1..3cd0c0ddf4 100644 --- a/frontend_tests/node_tests/compose_ui.js +++ b/frontend_tests/node_tests/compose_ui.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const autosize = require("autosize"); const {set_global, with_field, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("compose_ui"); diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.js index 83dfdf12f1..f1d3b57ea5 100644 --- a/frontend_tests/node_tests/composebox_typeahead.js +++ b/frontend_tests/node_tests/composebox_typeahead.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const emoji = zrequire("emoji", "shared/js/emoji"); diff --git a/frontend_tests/node_tests/copy_and_paste.js b/frontend_tests/node_tests/copy_and_paste.js index fb81f4b03d..1b6963f82c 100644 --- a/frontend_tests/node_tests/copy_and_paste.js +++ b/frontend_tests/node_tests/copy_and_paste.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const {JSDOM} = require("jsdom"); const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); stub_out_jquery(); diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js index 109edb264a..22ab5a244a 100644 --- a/frontend_tests/node_tests/dispatch.js +++ b/frontend_tests/node_tests/dispatch.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {make_stub, with_stub} = require("../zjsunit/stub"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const noop = function () {}; diff --git a/frontend_tests/node_tests/dispatch_subs.js b/frontend_tests/node_tests/dispatch_subs.js index 7e256c5354..b58aaec871 100644 --- a/frontend_tests/node_tests/dispatch_subs.js +++ b/frontend_tests/node_tests/dispatch_subs.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {make_stub, with_stub} = require("../zjsunit/stub"); +const {run_test} = require("../zjsunit/test"); const events = require("./lib/events"); diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js index 3ace9b93a6..feb1cddd63 100644 --- a/frontend_tests/node_tests/drafts.js +++ b/frontend_tests/node_tests/drafts.js @@ -6,6 +6,7 @@ const XDate = require("xdate"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, with_field, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/dropdown_list_widget.js b/frontend_tests/node_tests/dropdown_list_widget.js index 7232e2291f..2a0d4be6bc 100644 --- a/frontend_tests/node_tests/dropdown_list_widget.js +++ b/frontend_tests/node_tests/dropdown_list_widget.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("dropdown_list_widget"); diff --git a/frontend_tests/node_tests/echo.js b/frontend_tests/node_tests/echo.js index d647f3cbf8..3775959b64 100644 --- a/frontend_tests/node_tests/echo.js +++ b/frontend_tests/node_tests/echo.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/emoji.js b/frontend_tests/node_tests/emoji.js index 51d0f767af..5a6a86364c 100644 --- a/frontend_tests/node_tests/emoji.js +++ b/frontend_tests/node_tests/emoji.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json"); diff --git a/frontend_tests/node_tests/emoji_picker.js b/frontend_tests/node_tests/emoji_picker.js index 29a07d49b0..ccb6bfc380 100644 --- a/frontend_tests/node_tests/emoji_picker.js +++ b/frontend_tests/node_tests/emoji_picker.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const emoji = zrequire("emoji", "shared/js/emoji"); zrequire("emoji_picker"); diff --git a/frontend_tests/node_tests/fenced_code.js b/frontend_tests/node_tests/fenced_code.js index 2bc56da6d1..25634765ff 100644 --- a/frontend_tests/node_tests/fenced_code.js +++ b/frontend_tests/node_tests/fenced_code.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const fenced_code = zrequire("fenced_code", "shared/js/fenced_code"); diff --git a/frontend_tests/node_tests/fetch_status.js b/frontend_tests/node_tests/fetch_status.js index 144d946e22..41222d6662 100644 --- a/frontend_tests/node_tests/fetch_status.js +++ b/frontend_tests/node_tests/fetch_status.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const FetchStatus = zrequire("fetch_status"); set_global("message_scroll", { diff --git a/frontend_tests/node_tests/filter.js b/frontend_tests/node_tests/filter.js index 64d51b58c8..8b8f6dee3d 100644 --- a/frontend_tests/node_tests/filter.js +++ b/frontend_tests/node_tests/filter.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("unread"); diff --git a/frontend_tests/node_tests/fold_dict.js b/frontend_tests/node_tests/fold_dict.js index 6c6cbff6cf..f65baa4cd3 100644 --- a/frontend_tests/node_tests/fold_dict.js +++ b/frontend_tests/node_tests/fold_dict.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {FoldDict} = zrequire("fold_dict"); diff --git a/frontend_tests/node_tests/general.js b/frontend_tests/node_tests/general.js index 1ff02953de..2d90206cbe 100644 --- a/frontend_tests/node_tests/general.js +++ b/frontend_tests/node_tests/general.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); // This is a general tour of how to write node tests that // may also give you some quick insight on how the Zulip diff --git a/frontend_tests/node_tests/hash_util.js b/frontend_tests/node_tests/hash_util.js index a8b9872296..45af680614 100644 --- a/frontend_tests/node_tests/hash_util.js +++ b/frontend_tests/node_tests/hash_util.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("hash_util"); diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.js index 4b3077e431..a9cf225f78 100644 --- a/frontend_tests/node_tests/hashchange.js +++ b/frontend_tests/node_tests/hashchange.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.js index 215b2da522..f265413732 100644 --- a/frontend_tests/node_tests/hotkey.js +++ b/frontend_tests/node_tests/hotkey.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {set_global, with_overrides, zrequire} = require("../zjsunit/namespace"); const {with_stub} = require("../zjsunit/stub"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); // Important note on these tests: diff --git a/frontend_tests/node_tests/i18n.js b/frontend_tests/node_tests/i18n.js index 69be53840f..28027c53bc 100644 --- a/frontend_tests/node_tests/i18n.js +++ b/frontend_tests/node_tests/i18n.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("templates"); diff --git a/frontend_tests/node_tests/input_pill.js b/frontend_tests/node_tests/input_pill.js index f8da5866f7..109f34e933 100644 --- a/frontend_tests/node_tests/input_pill.js +++ b/frontend_tests/node_tests/input_pill.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/keydown_util.js b/frontend_tests/node_tests/keydown_util.js index b42b9cd244..782419b7ae 100644 --- a/frontend_tests/node_tests/keydown_util.js +++ b/frontend_tests/node_tests/keydown_util.js @@ -1,6 +1,7 @@ "use strict"; const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/lazy_set.js b/frontend_tests/node_tests/lazy_set.js index d3e1557636..e7c184cdfa 100644 --- a/frontend_tests/node_tests/lazy_set.js +++ b/frontend_tests/node_tests/lazy_set.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {LazySet} = zrequire("lazy_set"); diff --git a/frontend_tests/node_tests/lightbox.js b/frontend_tests/node_tests/lightbox.js index 345536186e..fb1b8bedda 100644 --- a/frontend_tests/node_tests/lightbox.js +++ b/frontend_tests/node_tests/lightbox.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("rows"); diff --git a/frontend_tests/node_tests/list_cursor.js b/frontend_tests/node_tests/list_cursor.js index b3446fd535..cac0fe6583 100644 --- a/frontend_tests/node_tests/list_cursor.js +++ b/frontend_tests/node_tests/list_cursor.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("list_cursor"); diff --git a/frontend_tests/node_tests/list_render.js b/frontend_tests/node_tests/list_render.js index 827a2eb135..be36ecf377 100644 --- a/frontend_tests/node_tests/list_render.js +++ b/frontend_tests/node_tests/list_render.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("list_render"); diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js index b04fb9a91f..b93e0218a6 100644 --- a/frontend_tests/node_tests/markdown.js +++ b/frontend_tests/node_tests/markdown.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_cases.json"); const markdown_assert = require("../zjsunit/markdown_assert"); const {set_global, with_field, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("hash_util"); diff --git a/frontend_tests/node_tests/markdown_katex.js b/frontend_tests/node_tests/markdown_katex.js index b209214aa1..10e02045ac 100644 --- a/frontend_tests/node_tests/markdown_katex.js +++ b/frontend_tests/node_tests/markdown_katex.js @@ -10,6 +10,7 @@ const rewiremock = require("rewiremock/node"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const markdown_config = zrequire("markdown_config"); diff --git a/frontend_tests/node_tests/message_edit.js b/frontend_tests/node_tests/message_edit.js index f3d21383ad..7a9f32253c 100644 --- a/frontend_tests/node_tests/message_edit.js +++ b/frontend_tests/node_tests/message_edit.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); set_global("document", null); set_global("page_params", { diff --git a/frontend_tests/node_tests/message_events.js b/frontend_tests/node_tests/message_events.js index 450591cd0c..2886c230cf 100644 --- a/frontend_tests/node_tests/message_events.js +++ b/frontend_tests/node_tests/message_events.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("message_events"); diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.js index bb70c26345..ad9a8c8b51 100644 --- a/frontend_tests/node_tests/message_fetch.js +++ b/frontend_tests/node_tests/message_fetch.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/message_flags.js b/frontend_tests/node_tests/message_flags.js index af8530162d..c4cafc26c7 100644 --- a/frontend_tests/node_tests/message_flags.js +++ b/frontend_tests/node_tests/message_flags.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("unread"); zrequire("unread_ops"); diff --git a/frontend_tests/node_tests/message_list.js b/frontend_tests/node_tests/message_list.js index 59808cf3fd..43c2edda51 100644 --- a/frontend_tests/node_tests/message_list.js +++ b/frontend_tests/node_tests/message_list.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace"); const {with_stub} = require("../zjsunit/stub"); +const {run_test} = require("../zjsunit/test"); // 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 034c46eb5d..039241edb6 100644 --- a/frontend_tests/node_tests/message_list_data.js +++ b/frontend_tests/node_tests/message_list_data.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("unread"); diff --git a/frontend_tests/node_tests/message_list_view.js b/frontend_tests/node_tests/message_list_view.js index 41a8702e37..a311799759 100644 --- a/frontend_tests/node_tests/message_list_view.js +++ b/frontend_tests/node_tests/message_list_view.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/message_store.js b/frontend_tests/node_tests/message_store.js index b317826fb4..54b7714cae 100644 --- a/frontend_tests/node_tests/message_store.js +++ b/frontend_tests/node_tests/message_store.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {with_stub} = require("../zjsunit/stub"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const util = zrequire("util"); diff --git a/frontend_tests/node_tests/muting.js b/frontend_tests/node_tests/muting.js index 9ea92d6c79..b793248160 100644 --- a/frontend_tests/node_tests/muting.js +++ b/frontend_tests/node_tests/muting.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("timerender"); zrequire("muting"); diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.js index 56f222d889..93a14ae095 100644 --- a/frontend_tests/node_tests/narrow.js +++ b/frontend_tests/node_tests/narrow.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.js index 051ef95789..92e76c47af 100644 --- a/frontend_tests/node_tests/narrow_activate.js +++ b/frontend_tests/node_tests/narrow_activate.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const util = zrequire("util"); diff --git a/frontend_tests/node_tests/narrow_local.js b/frontend_tests/node_tests/narrow_local.js index 8a4bdd97bd..9f8da69ed6 100644 --- a/frontend_tests/node_tests/narrow_local.js +++ b/frontend_tests/node_tests/narrow_local.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("Filter", "js/filter"); zrequire("FetchStatus", "js/fetch_status"); diff --git a/frontend_tests/node_tests/narrow_state.js b/frontend_tests/node_tests/narrow_state.js index 3518734a1e..4b7b377c1c 100644 --- a/frontend_tests/node_tests/narrow_state.js +++ b/frontend_tests/node_tests/narrow_state.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const people = zrequire("people"); zrequire("Filter", "js/filter"); diff --git a/frontend_tests/node_tests/narrow_unread.js b/frontend_tests/node_tests/narrow_unread.js index 08b638e33b..55c415df0a 100644 --- a/frontend_tests/node_tests/narrow_unread.js +++ b/frontend_tests/node_tests/narrow_unread.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("Filter", "js/filter"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/notifications.js b/frontend_tests/node_tests/notifications.js index ef343d721b..8fd2df5e64 100644 --- a/frontend_tests/node_tests/notifications.js +++ b/frontend_tests/node_tests/notifications.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const rewiremock = require("rewiremock/node"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); // Dependencies diff --git a/frontend_tests/node_tests/password.js b/frontend_tests/node_tests/password.js index e55a679d36..7743085c53 100644 --- a/frontend_tests/node_tests/password.js +++ b/frontend_tests/node_tests/password.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); 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 ca717c2483..b04ef093c8 100644 --- a/frontend_tests/node_tests/people.js +++ b/frontend_tests/node_tests/people.js @@ -7,6 +7,7 @@ const moment = require("moment-timezone"); const rewiremock = require("rewiremock/node"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const people = rewiremock.proxy(() => zrequire("people"), { "moment-timezone": () => moment("20130208T080910"), diff --git a/frontend_tests/node_tests/people_errors.js b/frontend_tests/node_tests/people_errors.js index 24b32537f0..771fa82ee6 100644 --- a/frontend_tests/node_tests/people_errors.js +++ b/frontend_tests/node_tests/people_errors.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/pm_conversations.js b/frontend_tests/node_tests/pm_conversations.js index 70e4c14b9e..0df2ae440a 100644 --- a/frontend_tests/node_tests/pm_conversations.js +++ b/frontend_tests/node_tests/pm_conversations.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const pmc = zrequire("pm_conversations"); diff --git a/frontend_tests/node_tests/pm_list.js b/frontend_tests/node_tests/pm_list.js index e09f267d59..46caf52601 100644 --- a/frontend_tests/node_tests/pm_list.js +++ b/frontend_tests/node_tests/pm_list.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, with_field, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/poll_widget.js b/frontend_tests/node_tests/poll_widget.js index e7707adb75..b359edf6cd 100644 --- a/frontend_tests/node_tests/poll_widget.js +++ b/frontend_tests/node_tests/poll_widget.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("poll_widget"); diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index f57375f92c..20e977bb5d 100644 --- a/frontend_tests/node_tests/popovers.js +++ b/frontend_tests/node_tests/popovers.js @@ -6,6 +6,7 @@ const rewiremock = require("rewiremock/node"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/presence.js b/frontend_tests/node_tests/presence.js index 7079a6f13f..c6d5ebf03a 100644 --- a/frontend_tests/node_tests/presence.js +++ b/frontend_tests/node_tests/presence.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const XDate = require("xdate"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const people = zrequire("people"); zrequire("presence"); diff --git a/frontend_tests/node_tests/reactions.js b/frontend_tests/node_tests/reactions.js index 2700fed9e0..d2383be758 100644 --- a/frontend_tests/node_tests/reactions.js +++ b/frontend_tests/node_tests/reactions.js @@ -5,6 +5,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 {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("document", "document-stub"); diff --git a/frontend_tests/node_tests/recent_senders.js b/frontend_tests/node_tests/recent_senders.js index 48923606bb..91a36da59e 100644 --- a/frontend_tests/node_tests/recent_senders.js +++ b/frontend_tests/node_tests/recent_senders.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const rs = zrequire("recent_senders"); diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js index 2f33ca4ea6..2b1e156926 100644 --- a/frontend_tests/node_tests/recent_topics.js +++ b/frontend_tests/node_tests/recent_topics.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {stub_templates} = require("../zjsunit/handlebars"); const {reset_module, set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("message_util"); diff --git a/frontend_tests/node_tests/rendered_markdown.js b/frontend_tests/node_tests/rendered_markdown.js index fcbf6e0145..6ff50cf72e 100644 --- a/frontend_tests/node_tests/rendered_markdown.js +++ b/frontend_tests/node_tests/rendered_markdown.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const rm = zrequire("rendered_markdown"); diff --git a/frontend_tests/node_tests/rtl.js b/frontend_tests/node_tests/rtl.js index 27425c852a..5afa936ed9 100644 --- a/frontend_tests/node_tests/rtl.js +++ b/frontend_tests/node_tests/rtl.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const rtl = zrequire("rtl"); diff --git a/frontend_tests/node_tests/schema.js b/frontend_tests/node_tests/schema.js index 135a3a0147..e72ec55ae6 100644 --- a/frontend_tests/node_tests/schema.js +++ b/frontend_tests/node_tests/schema.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("schema"); diff --git a/frontend_tests/node_tests/scroll_util.js b/frontend_tests/node_tests/scroll_util.js index 7a103a231d..3d522840c4 100644 --- a/frontend_tests/node_tests/scroll_util.js +++ b/frontend_tests/node_tests/scroll_util.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("scroll_util"); set_global("ui", { diff --git a/frontend_tests/node_tests/search.js b/frontend_tests/node_tests/search.js index f9c1505fd3..19c0fd3c8e 100644 --- a/frontend_tests/node_tests/search.js +++ b/frontend_tests/node_tests/search.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("page_params", { diff --git a/frontend_tests/node_tests/search_legacy.js b/frontend_tests/node_tests/search_legacy.js index edd7ec30ce..4181c3b060 100644 --- a/frontend_tests/node_tests/search_legacy.js +++ b/frontend_tests/node_tests/search_legacy.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("page_params", { diff --git a/frontend_tests/node_tests/search_pill.js b/frontend_tests/node_tests/search_pill.js index 99aee16a93..ce4b7e614a 100644 --- a/frontend_tests/node_tests/search_pill.js +++ b/frontend_tests/node_tests/search_pill.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("search_pill"); zrequire("input_pill"); diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.js index 826c6c2c9a..d173a090fd 100644 --- a/frontend_tests/node_tests/search_suggestion.js +++ b/frontend_tests/node_tests/search_suggestion.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); 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 eb713617e4..9a391c7b7d 100644 --- a/frontend_tests/node_tests/search_suggestion_legacy.js +++ b/frontend_tests/node_tests/search_suggestion_legacy.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); 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 233822379e..312b1a4800 100644 --- a/frontend_tests/node_tests/server_events.js +++ b/frontend_tests/node_tests/server_events.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const noop = function () {}; diff --git a/frontend_tests/node_tests/settings_bots.js b/frontend_tests/node_tests/settings_bots.js index e977824cd5..7a9a224977 100644 --- a/frontend_tests/node_tests/settings_bots.js +++ b/frontend_tests/node_tests/settings_bots.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const rewiremock = require("rewiremock/node"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("page_params", { diff --git a/frontend_tests/node_tests/settings_data.js b/frontend_tests/node_tests/settings_data.js index c42798c97a..b360d65a33 100644 --- a/frontend_tests/node_tests/settings_data.js +++ b/frontend_tests/node_tests/settings_data.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); 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 4853990d4a..d9f9bd61e6 100644 --- a/frontend_tests/node_tests/settings_emoji.js +++ b/frontend_tests/node_tests/settings_emoji.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/settings_muting.js b/frontend_tests/node_tests/settings_muting.js index d73278d588..e5b2791213 100644 --- a/frontend_tests/node_tests/settings_muting.js +++ b/frontend_tests/node_tests/settings_muting.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index 2f46f5d8d4..f40cec8e4b 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -6,6 +6,7 @@ const rewiremock = require("rewiremock/node"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/settings_profile_fields.js b/frontend_tests/node_tests/settings_profile_fields.js index 6245c3bdff..9b761149fb 100644 --- a/frontend_tests/node_tests/settings_profile_fields.js +++ b/frontend_tests/node_tests/settings_profile_fields.js @@ -6,6 +6,7 @@ const rewiremock = require("rewiremock/node"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); 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 c9b5f5ebbb..47b25736a0 100644 --- a/frontend_tests/node_tests/settings_user_groups.js +++ b/frontend_tests/node_tests/settings_user_groups.js @@ -6,6 +6,7 @@ const _ = require("lodash"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); zrequire("user_pill"); diff --git a/frontend_tests/node_tests/spoilers.js b/frontend_tests/node_tests/spoilers.js index 88d468a373..5876677239 100644 --- a/frontend_tests/node_tests/spoilers.js +++ b/frontend_tests/node_tests/spoilers.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js index 3a40d4fe65..07a06cc0a7 100644 --- a/frontend_tests/node_tests/stream_data.js +++ b/frontend_tests/node_tests/stream_data.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); set_global("page_params", { is_admin: false, diff --git a/frontend_tests/node_tests/stream_edit.js b/frontend_tests/node_tests/stream_edit.js index 88ec8b0a9c..ad1723ab73 100644 --- a/frontend_tests/node_tests/stream_edit.js +++ b/frontend_tests/node_tests/stream_edit.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const {LazySet} = zrequire("lazy_set"); diff --git a/frontend_tests/node_tests/stream_events.js b/frontend_tests/node_tests/stream_events.js index 222850a11e..035a4b2fbd 100644 --- a/frontend_tests/node_tests/stream_events.js +++ b/frontend_tests/node_tests/stream_events.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); const {make_stub, with_stub} = require("../zjsunit/stub"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const noop = function () {}; diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js index 15398908a1..c842359a33 100644 --- a/frontend_tests/node_tests/stream_list.js +++ b/frontend_tests/node_tests/stream_list.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("document", "document-stub"); diff --git a/frontend_tests/node_tests/stream_pill.js b/frontend_tests/node_tests/stream_pill.js index 7b946f736c..2f1138b7c0 100644 --- a/frontend_tests/node_tests/stream_pill.js +++ b/frontend_tests/node_tests/stream_pill.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); 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 54a481aaac..3451ff55eb 100644 --- a/frontend_tests/node_tests/stream_search.js +++ b/frontend_tests/node_tests/stream_search.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); // 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 a3d42f7dd3..a1c059f1ec 100644 --- a/frontend_tests/node_tests/stream_sort.js +++ b/frontend_tests/node_tests/stream_sort.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); 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 236a2f7acd..aaac339290 100644 --- a/frontend_tests/node_tests/stream_topic_history.js +++ b/frontend_tests/node_tests/stream_topic_history.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("unread"); zrequire("stream_data"); diff --git a/frontend_tests/node_tests/submessage.js b/frontend_tests/node_tests/submessage.js index 3bac735476..1d716d26a9 100644 --- a/frontend_tests/node_tests/submessage.js +++ b/frontend_tests/node_tests/submessage.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("submessage"); diff --git a/frontend_tests/node_tests/subs.js b/frontend_tests/node_tests/subs.js index 8f8262b64f..2a6d353612 100644 --- a/frontend_tests/node_tests/subs.js +++ b/frontend_tests/node_tests/subs.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, stub_out_jquery, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); stub_out_jquery(); diff --git a/frontend_tests/node_tests/support.js b/frontend_tests/node_tests/support.js index dee7c8ec31..6ff0ee3a8b 100644 --- a/frontend_tests/node_tests/support.js +++ b/frontend_tests/node_tests/support.js @@ -6,6 +6,7 @@ const fs = require("fs"); const {JSDOM} = require("jsdom"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const template = fs.readFileSync("templates/analytics/realm_details.html", "utf-8"); diff --git a/frontend_tests/node_tests/timerender.js b/frontend_tests/node_tests/timerender.js index feca73335c..a2362379f3 100644 --- a/frontend_tests/node_tests/timerender.js +++ b/frontend_tests/node_tests/timerender.js @@ -6,6 +6,7 @@ const moment = require("moment"); const XDate = require("xdate"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/top_left_corner.js b/frontend_tests/node_tests/top_left_corner.js index 6e3ddfc3de..6c8794400f 100644 --- a/frontend_tests/node_tests/top_left_corner.js +++ b/frontend_tests/node_tests/top_left_corner.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/topic_generator.js b/frontend_tests/node_tests/topic_generator.js index 26e1f92211..656363460d 100644 --- a/frontend_tests/node_tests/topic_generator.js +++ b/frontend_tests/node_tests/topic_generator.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); 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 05610f24c6..ee510c8298 100644 --- a/frontend_tests/node_tests/topic_list_data.js +++ b/frontend_tests/node_tests/topic_list_data.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); set_global("narrow_state", {}); set_global("unread", {}); diff --git a/frontend_tests/node_tests/transmit.js b/frontend_tests/node_tests/transmit.js index c8cbd4d35a..88770b6ed3 100644 --- a/frontend_tests/node_tests/transmit.js +++ b/frontend_tests/node_tests/transmit.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const noop = function () {}; diff --git a/frontend_tests/node_tests/typeahead.js b/frontend_tests/node_tests/typeahead.js index 9a65a6aeb8..eacf84ea85 100644 --- a/frontend_tests/node_tests/typeahead.js +++ b/frontend_tests/node_tests/typeahead.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const typeahead = zrequire("typeahead", "shared/js/typeahead"); diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js index dc009f5856..99f0180766 100644 --- a/frontend_tests/node_tests/typeahead_helper.js +++ b/frontend_tests/node_tests/typeahead_helper.js @@ -4,6 +4,7 @@ const {strict: assert} = require("assert"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); 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 4dbb039906..809a5a98b8 100644 --- a/frontend_tests/node_tests/typing_data.js +++ b/frontend_tests/node_tests/typing_data.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("typing_data"); diff --git a/frontend_tests/node_tests/typing_status.js b/frontend_tests/node_tests/typing_status.js index 4cb360a475..4440f53a0a 100644 --- a/frontend_tests/node_tests/typing_status.js +++ b/frontend_tests/node_tests/typing_status.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("typing"); zrequire("people"); diff --git a/frontend_tests/node_tests/ui.js b/frontend_tests/node_tests/ui.js index 31ab1202a0..27962ed349 100644 --- a/frontend_tests/node_tests/ui.js +++ b/frontend_tests/node_tests/ui.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const ui = zrequire("ui"); diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.js index 501f63b559..0cc9d43409 100644 --- a/frontend_tests/node_tests/ui_init.js +++ b/frontend_tests/node_tests/ui_init.js @@ -4,6 +4,7 @@ const rewiremock = require("rewiremock/node"); const {stub_templates} = require("../zjsunit/handlebars"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); /* diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js index f0aa8487ad..49e8bb3dec 100644 --- a/frontend_tests/node_tests/unread.js +++ b/frontend_tests/node_tests/unread.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const _ = require("lodash"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("muting"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/upgrade.js b/frontend_tests/node_tests/upgrade.js index 70798efd9a..e6000971a0 100644 --- a/frontend_tests/node_tests/upgrade.js +++ b/frontend_tests/node_tests/upgrade.js @@ -6,6 +6,7 @@ const fs = require("fs"); const {JSDOM} = require("jsdom"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); const noop = () => {}; diff --git a/frontend_tests/node_tests/upload.js b/frontend_tests/node_tests/upload.js index 6ebb60f797..d976b02ffb 100644 --- a/frontend_tests/node_tests/upload.js +++ b/frontend_tests/node_tests/upload.js @@ -5,6 +5,7 @@ const {strict: assert} = require("assert"); const rewiremock = require("rewiremock/node"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/user_events.js b/frontend_tests/node_tests/user_events.js index 298370d8d3..66c56f36b5 100644 --- a/frontend_tests/node_tests/user_events.js +++ b/frontend_tests/node_tests/user_events.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/user_groups.js b/frontend_tests/node_tests/user_groups.js index a86b28d2da..5be9713179 100644 --- a/frontend_tests/node_tests/user_groups.js +++ b/frontend_tests/node_tests/user_groups.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("user_groups"); diff --git a/frontend_tests/node_tests/user_pill.js b/frontend_tests/node_tests/user_pill.js index 6e1168f4bc..0650fa7c99 100644 --- a/frontend_tests/node_tests/user_pill.js +++ b/frontend_tests/node_tests/user_pill.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const people = zrequire("people"); set_global("md5", (s) => "md5-" + s); diff --git a/frontend_tests/node_tests/user_status.js b/frontend_tests/node_tests/user_status.js index 82e6171504..4339c94a3f 100644 --- a/frontend_tests/node_tests/user_status.js +++ b/frontend_tests/node_tests/user_status.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); set_global("channel", {}); zrequire("user_status"); diff --git a/frontend_tests/node_tests/util.js b/frontend_tests/node_tests/util.js index 4c6a831f7a..c7749cadf4 100644 --- a/frontend_tests/node_tests/util.js +++ b/frontend_tests/node_tests/util.js @@ -6,6 +6,7 @@ const {JSDOM} = require("jsdom"); const _ = require("lodash"); const {set_global, with_field, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/vdom.js b/frontend_tests/node_tests/vdom.js index f20e18b3c6..eaf438250b 100644 --- a/frontend_tests/node_tests/vdom.js +++ b/frontend_tests/node_tests/vdom.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); zrequire("vdom"); diff --git a/frontend_tests/node_tests/widgetize.js b/frontend_tests/node_tests/widgetize.js index 82bde87327..8b7009228d 100644 --- a/frontend_tests/node_tests/widgetize.js +++ b/frontend_tests/node_tests/widgetize.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global, zrequire} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); set_global("$", make_zjquery()); diff --git a/frontend_tests/node_tests/zblueslip.js b/frontend_tests/node_tests/zblueslip.js index e7a1963f92..4110059812 100644 --- a/frontend_tests/node_tests/zblueslip.js +++ b/frontend_tests/node_tests/zblueslip.js @@ -2,6 +2,8 @@ const {strict: assert} = require("assert"); +const {run_test} = require("../zjsunit/test"); + /* 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 6d53a3c883..4641db9b08 100644 --- a/frontend_tests/node_tests/zjquery.js +++ b/frontend_tests/node_tests/zjquery.js @@ -3,6 +3,7 @@ const {strict: assert} = require("assert"); const {set_global} = require("../zjsunit/namespace"); +const {run_test} = require("../zjsunit/test"); const {make_zjquery} = require("../zjsunit/zjquery"); /* diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js index 5aa8184d66..b5a6fa5cf0 100644 --- a/frontend_tests/zjsunit/index.js +++ b/frontend_tests/zjsunit/index.js @@ -9,6 +9,7 @@ const _ = require("lodash"); const handlebars = require("./handlebars"); const stub_i18n = require("./i18n"); const namespace = require("./namespace"); +const test = require("./test"); const {make_zblueslip} = require("./zblueslip"); require("@babel/register")({ @@ -66,29 +67,13 @@ function short_tb(tb) { return lines.splice(0, i + 1).join("\n") + "\n(...)\n"; } -let current_file_name; - function run_one_module(file) { console.info("running test " + path.basename(file, ".js")); - current_file_name = file; + test.set_current_file_name(file); require(file); } -global.run_test = (label, f) => { - if (files.length === 1) { - console.info(" test: " + label); - } - try { - namespace.with_overrides(f); - } catch (error) { - console.info("-".repeat(50)); - console.info(`test failed: ${current_file_name} > ${label}`); - console.info(); - throw error; - } - // defensively reset blueslip after each test. - blueslip.reset(); -}; +test.set_verbose(files.length === 1); try { files.forEach((file) => { diff --git a/frontend_tests/zjsunit/test.js b/frontend_tests/zjsunit/test.js new file mode 100644 index 0000000000..ab1e28fc3a --- /dev/null +++ b/frontend_tests/zjsunit/test.js @@ -0,0 +1,30 @@ +"use strict"; + +const namespace = require("./namespace"); + +let current_file_name; +let verbose = false; + +exports.set_current_file_name = (value) => { + current_file_name = value; +}; + +exports.set_verbose = (value) => { + verbose = value; +}; + +exports.run_test = (label, f) => { + if (verbose) { + console.info(" test: " + label); + } + try { + namespace.with_overrides(f); + } catch (error) { + console.info("-".repeat(50)); + console.info(`test failed: ${current_file_name} > ${label}`); + console.info(); + throw error; + } + // defensively reset blueslip after each test. + blueslip.reset(); +};