summaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
Diffstat (limited to 'cli')
-rw-r--r--cli/js/40_testing.js1
-rw-r--r--cli/tests/integration/test_tests.rs5
-rw-r--r--cli/tests/testdata/test/replace_timers.js7
-rw-r--r--cli/tests/testdata/test/replace_timers.js.out7
4 files changed, 20 insertions, 0 deletions
diff --git a/cli/js/40_testing.js b/cli/js/40_testing.js
index 90a725fca..c073b1c18 100644
--- a/cli/js/40_testing.js
+++ b/cli/js/40_testing.js
@@ -5,6 +5,7 @@ const ops = core.ops;
import { setExitHandler } from "ext:runtime/30_os.js";
import { Console } from "ext:deno_console/01_console.js";
import { serializePermissions } from "ext:runtime/10_permissions.js";
+import { setTimeout } from "ext:deno_web/02_timers.js";
import { assert } from "ext:deno_web/00_infra.js";
const primordials = globalThis.__bootstrap.primordials;
const {
diff --git a/cli/tests/integration/test_tests.rs b/cli/tests/integration/test_tests.rs
index 57acb723e..bcf050adf 100644
--- a/cli/tests/integration/test_tests.rs
+++ b/cli/tests/integration/test_tests.rs
@@ -529,6 +529,11 @@ itest!(test_no_lock {
output: "lockfile/basic/test.nolock.out",
});
+itest!(test_replace_timers {
+ args: "test test/replace_timers.js",
+ output: "test/replace_timers.js.out",
+});
+
#[test]
fn test_with_glob_config() {
let context = TestContextBuilder::new().cwd("test").build();
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])
+