mirror of https://github.com/zulip/zulip.git
tests: Rename the Node tests to *.cjs.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
30eabb9d6c
commit
687f1b1651
|
@ -381,9 +381,9 @@ node test fixtures and our OpenAPI documentation.
|
|||
#### Node testing
|
||||
|
||||
Once you've completed backend testing, be sure to add an example event
|
||||
in `web/tests/lib/events.js`, a test of the
|
||||
in `web/tests/lib/events.cjs`, a test of the
|
||||
`server_events_dispatch.js` code for that event in
|
||||
`web/tests/dispatch.test.js`, and verify your example
|
||||
`web/tests/dispatch.test.cjs`, and verify your example
|
||||
against the two versions of the schema that you declared above using
|
||||
`tools/check-schemas`.
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ message is sent). As a result, we try to make sure that
|
|||
The Python-Markdown implementation is tested by
|
||||
`zerver/tests/test_markdown.py`, and the marked.js implementation and
|
||||
`markdown.contains_backend_only_syntax` are tested by
|
||||
`web/tests/markdown.test.js`.
|
||||
`web/tests/markdown.test.cjs`.
|
||||
|
||||
A shared set of fixed test data ("test fixtures") is present in
|
||||
`zerver/tests/fixtures/markdown_test_cases.json`, and is automatically used
|
||||
|
|
|
@ -18,7 +18,7 @@ name when debugging something.
|
|||
|
||||
The JS unit tests are written to work with node. You can find them
|
||||
in `web/tests`. Here is an example test from
|
||||
`web/tests/stream_data.test.js`:
|
||||
`web/tests/stream_data.test.cjs`:
|
||||
|
||||
```js
|
||||
(function test_get_by_id() {
|
||||
|
@ -45,7 +45,7 @@ there are, you should strive to follow the patterns of the existing tests
|
|||
and add your own tests.
|
||||
|
||||
A good first test to read is
|
||||
[example1.js](https://github.com/zulip/zulip/blob/main/web/tests/example1.test.js).
|
||||
[example1.test.cjs](https://github.com/zulip/zulip/blob/main/web/tests/example1.test.cjs).
|
||||
(And then there are several other example files.)
|
||||
|
||||
## How the node tests work
|
||||
|
@ -60,10 +60,10 @@ those slow down the tests a lot, and often don't add much value.
|
|||
Instead, the preferred model for our unit tests is to mock DOM
|
||||
manipulations (which in Zulip are almost exclusively done via
|
||||
`jQuery`) using a custom library
|
||||
[zjquery](https://github.com/zulip/zulip/blob/main/web/tests/lib/zjquery.js).
|
||||
[zjquery](https://github.com/zulip/zulip/blob/main/web/tests/lib/zjquery.cjs).
|
||||
|
||||
The
|
||||
[unit test file](https://github.com/zulip/zulip/blob/main/web/tests/zjquery.test.js)
|
||||
[unit test file](https://github.com/zulip/zulip/blob/main/web/tests/zjquery.test.cjs)
|
||||
for `zjquery` is designed to be also serve as nice documentation for
|
||||
how to use `zjquery`, and is **highly recommended reading** for anyone
|
||||
working on or debugging the Zulip node tests.
|
||||
|
@ -149,7 +149,7 @@ narrow_state.stream = function () {
|
|||
|
||||
## Creating new test modules
|
||||
|
||||
The test runner (`index.js`) automatically runs all .js files in the
|
||||
The test runner (`index.cjs`) automatically runs all .test.cjs files in the
|
||||
`web/tests` directory, so you can simply start editing a file
|
||||
in that directory to create a new test.
|
||||
|
||||
|
@ -278,7 +278,7 @@ These instructions assume you're using the Vagrant development environment.
|
|||
1. **Set the `Node.js interpreter path` to `/usr/local/bin/node`**
|
||||
1. Hit `OK` 2 times to get back to the `Run/Debug Configurations` window.
|
||||
1. Under `Working Directory` select the root `zulip` directory.
|
||||
1. Under `JavaScript file`, enter `web/tests/lib/index.js`
|
||||
1. Under `JavaScript file`, enter `web/tests/lib/index.cjs`
|
||||
-- this is the root script for Zulip's node unit tests.
|
||||
|
||||
Congratulations! You've now set up the integration.
|
||||
|
@ -288,7 +288,7 @@ Congratulations! You've now set up the integration.
|
|||
To use Webstorm to debug a given node test file, do the following:
|
||||
|
||||
1. Under `Application parameters` choose the node test file that you
|
||||
are trying to test (e.g., `web/tests/message_store.test.js`).
|
||||
are trying to test (e.g., `web/tests/message_store.test.cjs`).
|
||||
1. Under `Path Mappings`, set `Project Root` to `/srv/zulip`
|
||||
(i.e. where the `zulip` Git repository is mounted in the Vagrant guest).
|
||||
1. Use the WebStorm debugger; see [this overview][webstorm-debugging]
|
||||
|
|
|
@ -62,7 +62,7 @@ organization in Zulip). The following files are involved in the process:
|
|||
|
||||
- `web/e2e-tests/admin.test.ts`: end-to-end tests for the organization
|
||||
admin settings pages.
|
||||
- `web/tests/dispatch.test.js`
|
||||
- `web/tests/dispatch.test.cjs`
|
||||
|
||||
**Documentation**
|
||||
|
||||
|
@ -668,11 +668,11 @@ frontend tests: [node-based unit tests](../testing/testing-with-node.md) and
|
|||
|
||||
At the minimum, if you created a new function to update UI in
|
||||
`settings_org.ts`, you will need to mock that function in
|
||||
`web/tests/dispatch.test.js`. Add the name of the UI
|
||||
`web/tests/dispatch.test.cjs`. Add the name of the UI
|
||||
function you created to the following object with `noop` as the value:
|
||||
|
||||
```js
|
||||
// web/tests/dispatch.test.js
|
||||
// web/tests/dispatch.test.cjs
|
||||
|
||||
set_global('settings_org', {
|
||||
update_email_change_display: noop,
|
||||
|
|
|
@ -23,7 +23,7 @@ TOOLS_DIR = os.path.dirname(os.path.abspath(__file__))
|
|||
sys.path.insert(0, os.path.dirname(TOOLS_DIR))
|
||||
ROOT_DIR = os.path.dirname(TOOLS_DIR)
|
||||
|
||||
EVENTS_JS = "web/tests/lib/events.js"
|
||||
EVENTS_JS = "web/tests/lib/events.cjs"
|
||||
|
||||
# check for the venv
|
||||
from tools.lib import sanity_check
|
||||
|
|
|
@ -207,7 +207,7 @@ js_rules = RuleList(
|
|||
"exclude_pattern": r"(const |\S)style ?=",
|
||||
"description": "Avoid using the `style=` attribute; we prefer styling in CSS files",
|
||||
"exclude": {
|
||||
"web/tests/copy_and_paste.test.js",
|
||||
"web/tests/copy_and_paste.test.cjs",
|
||||
},
|
||||
"good_lines": ["#my-style {color: blue;}", "const style =", 'some_style = "test"'],
|
||||
"bad_lines": ['<p style="color: blue;">Foo</p>', 'style = "color: blue;"'],
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
"use strict";
|
||||
|
||||
const events = require("../../web/tests/lib/events.js");
|
||||
const events = require("../../web/tests/lib/events.cjs");
|
||||
|
||||
console.info(JSON.stringify(events.fixtures, null, 4));
|
||||
|
|
|
@ -20,7 +20,7 @@ sanity_check.check_venv(__file__)
|
|||
import orjson
|
||||
from zulint.printer import BOLDRED, CYAN, ENDC, GREEN
|
||||
|
||||
INDEX_JS = os.path.join(ROOT_DIR, "web/tests/lib/index.js")
|
||||
INDEX_JS = os.path.join(ROOT_DIR, "web/tests/lib/index.cjs")
|
||||
NODE_COVERAGE_PATH = os.path.join(ROOT_DIR, "var/node-coverage/coverage-final.json")
|
||||
|
||||
# Ideally, we wouldn't need this line, but it seems to be required to
|
||||
|
@ -29,7 +29,7 @@ os.chdir(ROOT_DIR)
|
|||
|
||||
USAGE = """
|
||||
tools/test-js-with-node - to run all tests
|
||||
tools/test-js-with-node util.test.js activity.test.js - to run just a couple tests
|
||||
tools/test-js-with-node util.test.cjs activity.test.cjs - to run just a couple tests
|
||||
tools/test-js-with-node --coverage - to generate coverage report
|
||||
"""
|
||||
|
||||
|
@ -291,14 +291,14 @@ EXEMPT_FILES = make_set(
|
|||
"web/src/zcommand.ts",
|
||||
"web/src/zform.js",
|
||||
"web/src/zulip_test.ts",
|
||||
"web/tests/lib/example_user.js",
|
||||
"web/tests/lib/mdiff.js",
|
||||
"web/tests/lib/real_jquery.js",
|
||||
"web/tests/lib/zjquery_element.js",
|
||||
"web/tests/lib/zpage_billing_params.js",
|
||||
"web/tests/lib/example_user.cjs",
|
||||
"web/tests/lib/mdiff.cjs",
|
||||
"web/tests/lib/real_jquery.cjs",
|
||||
"web/tests/lib/zjquery_element.cjs",
|
||||
"web/tests/lib/zpage_billing_params.cjs",
|
||||
# There are some important functions which are not called right now but will
|
||||
# be reused when we add tests for dropdown widget so it doesn't make sense to remove them.
|
||||
"web/tests/recent_view.test.js",
|
||||
"web/tests/recent_view.test.cjs",
|
||||
]
|
||||
)
|
||||
|
||||
|
@ -362,8 +362,8 @@ def print_error(msg: str) -> None:
|
|||
|
||||
def clean_file(orig_fn: str) -> str:
|
||||
fn = orig_fn
|
||||
if not fn.endswith(".test.js"):
|
||||
fn += ".test.js"
|
||||
if not fn.endswith(".test.cjs"):
|
||||
fn += ".test.cjs"
|
||||
if "web/tests/" not in fn:
|
||||
fn = os.path.join(ROOT_DIR, "web", "tests", fn)
|
||||
fn = os.path.abspath(fn)
|
||||
|
@ -381,7 +381,7 @@ def clean_files(fns: list[str]) -> list[str]:
|
|||
def run_tests_via_node_js() -> int:
|
||||
os.environ["TZ"] = "UTC"
|
||||
|
||||
# The index.js test runner is the real "driver" here, and we launch
|
||||
# The index.cjs test runner is the real "driver" here, and we launch
|
||||
# with either nyc or node, depending on whether we want coverage
|
||||
# reports. Running under nyc is slower and creates funny
|
||||
# tracebacks, so you generally want to get coverage reports only
|
||||
|
@ -393,7 +393,7 @@ def run_tests_via_node_js() -> int:
|
|||
parallel = 1
|
||||
files = individual_files
|
||||
else:
|
||||
files = sorted(glob.glob(os.path.join(ROOT_DIR, "web/tests/*.test.js")))
|
||||
files = sorted(glob.glob(os.path.join(ROOT_DIR, "web/tests/*.test.cjs")))
|
||||
|
||||
test_files = clean_files(files)
|
||||
|
||||
|
@ -417,14 +417,15 @@ def run_tests_via_node_js() -> int:
|
|||
coverage_dir = os.path.join(ROOT_DIR, "var/node-coverage")
|
||||
|
||||
nyc = os.path.join(ROOT_DIR, "node_modules/.bin/nyc")
|
||||
command = [nyc, "--extension", ".hbs", "--extension", ".ts"]
|
||||
command = [nyc]
|
||||
command += [f"--extension={ext}" for ext in [".cjs", ".cts", ".hbs", ".mjs", ".mts", ".ts"]]
|
||||
command += ["--report-dir", coverage_dir]
|
||||
command += ["--temp-directory", coverage_dir]
|
||||
command += ["-r=lcov", "-r=json", "-r=text-summary"]
|
||||
command += node_tests_cmd
|
||||
else:
|
||||
# Normal testing, no coverage analysis.
|
||||
# Run the index.js test runner, which runs all the other tests.
|
||||
# Run the index.cjs test runner, which runs all the other tests.
|
||||
command = node_tests_cmd
|
||||
|
||||
try:
|
||||
|
@ -473,8 +474,8 @@ def enforce_proper_coverage(coverage_json: Any) -> bool:
|
|||
*glob.glob("web/src/*.js"),
|
||||
*glob.glob("web/src/*.ts"),
|
||||
*glob.glob("web/src/billing/*.js"),
|
||||
*glob.glob("web/tests/*.js"),
|
||||
*glob.glob("web/tests/lib/*.js"),
|
||||
*glob.glob("web/tests/*.cjs"),
|
||||
*glob.glob("web/tests/lib/*.cjs"),
|
||||
}
|
||||
missing_files = sorted(EXEMPT_FILES - all_js_files)
|
||||
assert not missing_files, f"Missing files should be removed from EXEMPT_FILES: {missing_files}"
|
||||
|
|
|
@ -8,12 +8,12 @@ const {
|
|||
buddy_list_add_user_matching_view,
|
||||
buddy_list_add_other_user,
|
||||
stub_buddy_list_elements,
|
||||
} = require("./lib/buddy_list.js");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
} = require("./lib/buddy_list.cjs");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
const $window_stub = $.create("window-stub");
|
||||
set_global("to_$", () => $window_stub);
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
set_global("page_params", {
|
||||
is_spectator: false,
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {$t} = require("./lib/i18n.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {$t} = require("./lib/i18n.cjs");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const channel = mock_esm("../src/channel");
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const blueslip_stacktrace = zrequire("blueslip_stacktrace");
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const bot_data = zrequire("bot_data");
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {make_stub} = require("./lib/stub.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {make_stub} = require("./lib/stub.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
|
||||
window.location.hash = "#bogus";
|
||||
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
mock_esm("../src/settings_data", {
|
||||
user_can_access_all_other_users: () => true,
|
||||
|
@ -35,7 +35,7 @@ const user_settings = {};
|
|||
initialize_user_settings({user_settings});
|
||||
|
||||
// The buddy_data module is mostly tested indirectly through
|
||||
// activity.test.js, but we should feel free to add direct tests
|
||||
// activity.test.cjs, but we should feel free to add direct tests
|
||||
// here.
|
||||
|
||||
const selma = {
|
|
@ -10,11 +10,11 @@ const {
|
|||
buddy_list_add_user_matching_view,
|
||||
buddy_list_add_other_user,
|
||||
stub_buddy_list_elements,
|
||||
} = require("./lib/buddy_list.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
} = require("./lib/buddy_list.cjs");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const padded_widget = mock_esm("../src/padded_widget");
|
||||
const message_viewport = mock_esm("../src/message_viewport");
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_jquery, mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const {mock_jquery, mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
const xhr_401 = {
|
||||
status: 401,
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const color_data = zrequire("color_data");
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
mock_esm("tippy.js", {
|
||||
default(arg) {
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {$t} = require("./lib/i18n.js");
|
||||
const {mock_jquery, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const {$t} = require("./lib/i18n.cjs");
|
||||
const {mock_jquery, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
|
||||
let env;
|
||||
|
|
@ -4,11 +4,11 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const MockDate = require("mockdate");
|
||||
|
||||
const {mock_banners} = require("./lib/compose_banner.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
const user_groups = zrequire("user_groups");
|
||||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_banners} = require("./lib/compose_banner.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const user_groups = zrequire("user_groups");
|
||||
|
|
@ -3,9 +3,9 @@
|
|||
// Setup
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
// Mocking and stubbing things
|
||||
set_global("document", "document-stub");
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_jquery, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {mock_jquery, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
mock_jquery((selector) => {
|
||||
switch (selector) {
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const input_pill = mock_esm("../src/input_pill");
|
||||
const people = zrequire("people");
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const compose_pm_pill = mock_esm("../src/compose_pm_pill");
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {$t} = require("./lib/i18n.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {$t} = require("./lib/i18n.cjs");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
set_global("navigator", {});
|
||||
|
|
@ -2,12 +2,12 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_banners} = require("./lib/compose_banner.js");
|
||||
const {$t} = require("./lib/i18n.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||
const {$t} = require("./lib/i18n.cjs");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const compose_banner = zrequire("compose_banner");
|
||||
const compose_pm_pill = zrequire("compose_pm_pill");
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const events = require("./lib/events.js");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const events = require("./lib/events.cjs");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
const channel = mock_esm("../src/channel");
|
||||
const compose_closed_ui = mock_esm("../src/compose_closed_ui");
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_banners} = require("./lib/compose_banner.js");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
let autosize_called;
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const copy_and_paste = zrequire("copy_and_paste");
|
||||
const stream_data = zrequire("stream_data");
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
set_global("navigator", {
|
||||
userAgent: "",
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const events = require("./lib/events.js");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
||||
const {make_stub} = require("./lib/stub.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const events = require("./lib/events.cjs");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||
const {make_stub} = require("./lib/stub.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
const event_fixtures = events.fixtures;
|
||||
const test_message = events.test_message;
|
||||
|
@ -865,7 +865,7 @@ run_test("submessage", ({override}) => {
|
|||
});
|
||||
});
|
||||
|
||||
// For subscriptions, see dispatch_subs.test.js
|
||||
// For subscriptions, see dispatch_subs.test.cjs
|
||||
|
||||
run_test("typing", ({override}) => {
|
||||
// Simulate that we are not typing.
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const events = require("./lib/events.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {make_stub} = require("./lib/stub.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const events = require("./lib/events.cjs");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {make_stub} = require("./lib/stub.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
|
||||
const event_fixtures = events.fixtures;
|
||||
const test_user = events.test_user;
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_banners} = require("./lib/compose_banner.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_banners} = require("./lib/compose_banner.cjs");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const user_pill = mock_esm("../src/user_pill");
|
||||
const messages_overlay_ui = mock_esm("../src/messages_overlay_ui");
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const MockDate = require("mockdate");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {make_stub} = require("./lib/stub.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {make_stub} = require("./lib/stub.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
|
||||
const compose_notifications = mock_esm("../src/compose_notifications");
|
||||
const markdown = mock_esm("../src/markdown");
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const events = require("./lib/events.js");
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const events = require("./lib/events.cjs");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
|
||||
const emoji_codes = zrequire("../../static/generated/emoji/emoji_codes.json");
|
||||
|
|
@ -4,8 +4,8 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {zrequire, set_global} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire, set_global} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const emoji = zrequire("emoji");
|
||||
const emoji_picker = zrequire("emoji_picker");
|
|
@ -9,10 +9,10 @@
|
|||
// become clear as you keep reading.
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {make_stream} = require("./lib/example_stream.js");
|
||||
const {make_user} = require("./lib/example_user.js");
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {make_stream} = require("./lib/example_stream.cjs");
|
||||
const {make_user} = require("./lib/example_user.cjs");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
// We will use our special zrequire helper to import the
|
||||
// Zulip code. We use zrequire instead of require,
|
||||
|
@ -43,7 +43,7 @@ const isaac = make_user({
|
|||
|
||||
// The `people` object is a very fundamental object in the
|
||||
// Zulip app. You can learn a lot more about it by reading
|
||||
// the tests in people.test.js in the same directory as this file.
|
||||
// the tests in people.test.cjs in the same directory as this file.
|
||||
|
||||
// Let's exercise the code and use assert to verify it works!
|
||||
assert.ok(!people.is_known_user_id(isaac.user_id));
|
||||
|
@ -74,4 +74,4 @@ run_test("verify stream_data persists stream color", () => {
|
|||
const sub = stream_data.get_sub_by_name("Denmark");
|
||||
assert.equal(sub.color, "a1a1a1");
|
||||
});
|
||||
// See example2.test.js in this directory.
|
||||
// See example2.test.cjs in this directory.
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {make_stream} = require("./lib/example_stream.js");
|
||||
const {make_user} = require("./lib/example_user.js");
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {make_stream} = require("./lib/example_stream.cjs");
|
||||
const {make_user} = require("./lib/example_user.cjs");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
// Hopefully the basic patterns for testing data-oriented modules
|
||||
// are starting to become apparent. To reinforce that, we will present
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {make_stream} = require("./lib/example_stream.js");
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {make_stream} = require("./lib/example_stream.cjs");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
// In the Zulip app you can narrow your message stream by topic, by
|
||||
// sender, by direct message recipient, by search keywords, etc.
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {make_bot} = require("./lib/example_user.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const {make_bot} = require("./lib/example_user.cjs");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
|
||||
/*
|
||||
|
||||
|
@ -24,7 +24,7 @@ const {run_test, noop} = require("./lib/test.js");
|
|||
you are interested, all of these objects have test
|
||||
suites that have 100% line coverage on the modules
|
||||
that implement those objects. For example, you can look
|
||||
at people.test.js in this directory for more tests on the
|
||||
at people.test.cjs in this directory for more tests on the
|
||||
people object.
|
||||
|
||||
We can quickly review some testing concepts:
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {make_user} = require("./lib/example_user.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const {make_user} = require("./lib/example_user.cjs");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
|
||||
/*
|
||||
Our test from an earlier example verifies that the update events
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {make_stub} = require("./lib/stub.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const {make_stub} = require("./lib/stub.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
|
||||
/*
|
||||
The previous example was a bit extreme. Generally we just
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {make_stream} = require("./lib/example_stream.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {make_stream} = require("./lib/example_stream.cjs");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
/*
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {make_user} = require("./lib/example_user.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {make_user} = require("./lib/example_user.cjs");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
mock_esm("../src/settings_data", {
|
||||
user_can_access_all_other_users: () => true,
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const fenced_code = zrequire("../shared/src/fenced_code");
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
mock_esm("../src/message_feed_loading", {
|
||||
hide_loading_older() {},
|
|
@ -4,11 +4,11 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const {parseOneAddress} = require("email-addresses");
|
||||
|
||||
const {mock_esm, with_overrides, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const {mock_esm, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
const message_store = mock_esm("../src/message_store");
|
||||
const user_topics = mock_esm("../src/user_topics");
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const {FoldDict} = zrequire("fold_dict");
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const gear_menu_util = zrequire("gear_menu_util");
|
||||
const {set_realm} = zrequire("state_data");
|
|
@ -4,8 +4,8 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const message_link_test_cases = require("../../zerver/tests/fixtures/message_link_test_cases.json");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const hash_parser = zrequire("hash_parser");
|
||||
const hash_util = zrequire("hash_util");
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
let $window_stub;
|
||||
set_global("to_$", () => $window_stub);
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
||||
const {make_stub} = require("./lib/stub.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||
const {make_stub} = require("./lib/stub.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
// Important note on these tests:
|
||||
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {unmock_module, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const {unmock_module, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
// We download our translations in `page_params` (which
|
||||
// are for the user's chosen language), so we simulate
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
set_global("document", {});
|
||||
class ClipboardEvent {}
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const internal_url = zrequire("../shared/src/internal_url");
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const keydown_util = zrequire("keydown_util");
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
|
||||
const {LazySet} = zrequire("lazy_set");
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
mock_esm("../src/resize", {
|
||||
resize_stream_filters_container() {},
|
|
@ -1,7 +1,7 @@
|
|||
"use strict";
|
||||
|
||||
const {noop} = require("./test.js");
|
||||
const $ = require("./zjquery.js");
|
||||
const {noop} = require("./test.cjs");
|
||||
const $ = require("./zjquery.cjs");
|
||||
|
||||
let users_matching_view = [];
|
||||
exports.buddy_list_add_user_matching_view = (user_id, $stub) => {
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const compose_banner = require("../../src/compose_banner.ts");
|
||||
|
||||
const {noop} = require("./test.js");
|
||||
const $ = require("./zjquery.js");
|
||||
const {noop} = require("./test.cjs");
|
||||
const $ = require("./zjquery.cjs");
|
||||
|
||||
exports.mock_banners = () => {
|
||||
// zjquery doesn't support `remove`, which is used when clearing the compose box.
|
|
@ -8,14 +8,14 @@ require("handlebars/runtime.js");
|
|||
const {JSDOM} = require("jsdom");
|
||||
const _ = require("lodash");
|
||||
|
||||
const handlebars = require("./handlebars.js");
|
||||
const stub_i18n = require("./i18n.js");
|
||||
const namespace = require("./namespace.js");
|
||||
const test = require("./test.js");
|
||||
const blueslip = require("./zblueslip.js");
|
||||
const zjquery = require("./zjquery.js");
|
||||
const zpage_billing_params = require("./zpage_billing_params.js");
|
||||
const zpage_params = require("./zpage_params.js");
|
||||
const handlebars = require("./handlebars.cjs");
|
||||
const stub_i18n = require("./i18n.cjs");
|
||||
const namespace = require("./namespace.cjs");
|
||||
const test = require("./test.cjs");
|
||||
const blueslip = require("./zblueslip.cjs");
|
||||
const zjquery = require("./zjquery.cjs");
|
||||
const zpage_billing_params = require("./zpage_billing_params.cjs");
|
||||
const zpage_params = require("./zpage_params.cjs");
|
||||
|
||||
process.env.NODE_ENV = "test";
|
||||
|
||||
|
@ -88,7 +88,7 @@ require("../../src/templates.js"); // register Zulip extensions
|
|||
async function run_one_module(file) {
|
||||
zjquery.clear_initialize_function();
|
||||
zjquery.clear_all_elements();
|
||||
console.info("running test " + path.basename(file, ".test.js"));
|
||||
console.info("running test " + path.basename(file, ".test.cjs"));
|
||||
test.set_current_file_name(file);
|
||||
test.suite.length = 0;
|
||||
require(file);
|
|
@ -27,7 +27,7 @@ const assert = require("node:assert/strict");
|
|||
const {JSDOM} = require("jsdom");
|
||||
const _ = require("lodash");
|
||||
|
||||
const mdiff = require("./mdiff.js");
|
||||
const mdiff = require("./mdiff.cjs");
|
||||
|
||||
// Module-level global instance of MarkdownComparer, initialized when needed
|
||||
let _markdownComparerInstance = null;
|
|
@ -6,7 +6,7 @@ const path = require("node:path");
|
|||
|
||||
const callsites = require("callsites");
|
||||
|
||||
const $ = require("./zjquery.js");
|
||||
const $ = require("./zjquery.cjs");
|
||||
|
||||
const new_globals = new Set();
|
||||
let old_globals = {};
|
||||
|
@ -18,7 +18,7 @@ const used_module_mocks = new Set();
|
|||
const used_templates = new Set();
|
||||
|
||||
const jquery_path = require.resolve("jquery");
|
||||
const real_jquery_path = require.resolve("./real_jquery.js");
|
||||
const real_jquery_path = require.resolve("./real_jquery.cjs");
|
||||
|
||||
let in_mid_render = false;
|
||||
let jquery_function;
|
|
@ -1,10 +1,10 @@
|
|||
"use strict";
|
||||
|
||||
const namespace = require("./namespace.js");
|
||||
const zblueslip = require("./zblueslip.js");
|
||||
const $ = require("./zjquery.js");
|
||||
const zpage_billing_params = require("./zpage_billing_params.js");
|
||||
const zpage_params = require("./zpage_params.js");
|
||||
const namespace = require("./namespace.cjs");
|
||||
const zblueslip = require("./zblueslip.cjs");
|
||||
const $ = require("./zjquery.cjs");
|
||||
const zpage_billing_params = require("./zpage_billing_params.cjs");
|
||||
const zpage_params = require("./zpage_params.cjs");
|
||||
|
||||
let current_file_name;
|
||||
let verbose = false;
|
|
@ -8,8 +8,8 @@ const assert = require("node:assert/strict");
|
|||
and then subsequent calls to $("#foo") get the
|
||||
same instance.
|
||||
*/
|
||||
const FakeElement = require("./zjquery_element.js");
|
||||
const FakeEvent = require("./zjquery_event.js");
|
||||
const FakeElement = require("./zjquery_element.cjs");
|
||||
const FakeEvent = require("./zjquery_event.cjs");
|
||||
|
||||
function verify_selector_for_zulip(selector) {
|
||||
const is_valid =
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const FakeEvent = require("./zjquery_event.js");
|
||||
const FakeEvent = require("./zjquery_event.cjs");
|
||||
|
||||
const noop = function () {};
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
|
||||
const linkifiers = zrequire("linkifiers");
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const {ListCursor} = zrequire("list_cursor");
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, mock_jquery, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, mock_jquery, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
// We need these stubs to get by instanceof checks.
|
||||
// The ListWidget library allows you to insert objects
|
|
@ -6,10 +6,10 @@ const katex = require("katex");
|
|||
|
||||
const markdown_test_cases = require("../../zerver/tests/fixtures/markdown_test_cases.json");
|
||||
|
||||
const markdown_assert = require("./lib/markdown_assert.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const markdown_assert = require("./lib/markdown_assert.cjs");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
const example_realm_linkifiers = [
|
||||
{
|
|
@ -4,8 +4,8 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const url_template_lib = require("url-template");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const markdown = zrequire("markdown");
|
||||
const linkifiers = zrequire("linkifiers");
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const message_edit = zrequire("message_edit");
|
||||
const people = zrequire("people");
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
const message_edit = mock_esm("../src/message_edit");
|
||||
const message_lists = mock_esm("../src/message_lists");
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {mock_esm, set_global, with_overrides, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const channel = mock_esm("../src/channel");
|
||||
const message_live_update = mock_esm("../src/message_live_update");
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {make_stub} = require("./lib/stub.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {make_stub} = require("./lib/stub.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
// These unit tests for web/src/message_list.ts emphasize the model-ish
|
||||
// aspects of the MessageList class. We have to stub out a few functions
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
|
||||
const user_topics = zrequire("user_topics");
|
||||
const muted_users = zrequire("muted_users");
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const _ = require("lodash");
|
||||
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
|
||||
set_global("document", "document-stub");
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test, noop} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const {mock_esm, set_global, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test, noop} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
|
||||
mock_esm("../src/settings_data", {
|
||||
user_can_access_all_other_users: () => true,
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
const hash_util = zrequire("hash_util");
|
||||
const compose_state = zrequire("compose_state");
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const muted_users = zrequire("muted_users");
|
||||
const {initialize_user_settings} = zrequire("user_settings");
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const all_messages_data = zrequire("../src/all_messages_data");
|
||||
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
const people = zrequire("people");
|
||||
const {Filter} = zrequire("../src/filter");
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const blueslip = require("./lib/zblueslip.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const blueslip = require("./lib/zblueslip.cjs");
|
||||
|
||||
mock_esm("../src/user_topics", {
|
||||
is_topic_muted: () => false,
|
|
@ -4,9 +4,9 @@ const assert = require("node:assert/strict");
|
|||
|
||||
const {addDays} = require("date-fns");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
page_params.is_spectator = false;
|
||||
|
|
@ -2,10 +2,10 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const $ = require("./lib/zjquery.js");
|
||||
const {page_params} = require("./lib/zpage_params.js");
|
||||
const {mock_esm, zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
const $ = require("./lib/zjquery.cjs");
|
||||
const {page_params} = require("./lib/zpage_params.cjs");
|
||||
|
||||
mock_esm("../src/electron_bridge");
|
||||
mock_esm("../src/spoilers", {hide_spoilers_in_notification() {}});
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const assert = require("node:assert/strict");
|
||||
|
||||
const {zrequire} = require("./lib/namespace.js");
|
||||
const {run_test} = require("./lib/test.js");
|
||||
const {zrequire} = require("./lib/namespace.cjs");
|
||||
const {run_test} = require("./lib/test.cjs");
|
||||
|
||||
const {password_quality, password_warning} = zrequire("password_quality");
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue