summaryrefslogtreecommitdiff
path: root/cli/tests/testdata
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2023-08-04 22:29:04 +0900
committerGitHub <noreply@github.com>2023-08-04 22:29:04 +0900
commit8a175a780a43b4cec7adfff5adbc65d8784aa4ed (patch)
treef341f4624402ded312b0c89659d5a135ac01cd35 /cli/tests/testdata
parent6405b5f454e140b0d79b603b0627debd246c7b9f (diff)
fix(test): make test runner work when global setTimeout is replaced (#20052)
Diffstat (limited to 'cli/tests/testdata')
-rw-r--r--cli/tests/testdata/test/replace_timers.js7
-rw-r--r--cli/tests/testdata/test/replace_timers.js.out7
2 files changed, 14 insertions, 0 deletions
diff --git a/cli/tests/testdata/test/replace_timers.js b/cli/tests/testdata/test/replace_timers.js
new file mode 100644
index 000000000..692f1d671
--- /dev/null
+++ b/cli/tests/testdata/test/replace_timers.js
@@ -0,0 +1,7 @@
+Deno.test("foo", async (t) => {
+ globalThis.setTimeout = () => {};
+ globalThis.clearTimeout = () => {};
+ globalThis.setInterval = () => {};
+ globalThis.clearInterval = () => {};
+ await t.step("bar", () => {});
+});
diff --git a/cli/tests/testdata/test/replace_timers.js.out b/cli/tests/testdata/test/replace_timers.js.out
new file mode 100644
index 000000000..81beb5ebe
--- /dev/null
+++ b/cli/tests/testdata/test/replace_timers.js.out
@@ -0,0 +1,7 @@
+running 1 test from ./test/replace_timers.js
+foo ...
+ bar ... ok ([WILDCARD])
+foo ... ok ([WILDCARD])
+
+ok | 1 passed (1 step) | 0 failed ([WILDCARD])
+