summaryrefslogtreecommitdiff
path: root/tests/specs
diff options
context:
space:
mode:
authorMatt Mastracci <matthew@mastracci.com>2024-05-22 08:08:27 -0600
committerGitHub <noreply@github.com>2024-05-22 08:08:27 -0600
commit596a2996cf777809fdefdb05a73a5b6253a5c285 (patch)
treeaba11527acb26f3fa3176944498fb8521a6368a7 /tests/specs
parent7ab7a14db74b037ca8b035a04c28ac0b6e30e716 (diff)
feat(cli): Add slow test warning (#23874)
By default, uses a 60 second timeout, backing off 2x each time (can be overridden using the hidden `DENO_SLOW_TEST_TIMEOUT` which we implement only really for spec testing. ``` Deno.test(async function test() { await new Promise(r => setTimeout(r, 130_000)); }); ``` ``` $ target/debug/deno test /tmp/test_slow.ts Check file:///tmp/test_slow.ts running 1 test from ../../../../../../tmp/test_slow.ts test ...'test' is running very slowly (1m0s) 'test' is running very slowly (2m0s) ok (2m10s) ok | 1 passed | 0 failed (2m10s) ``` --------- Signed-off-by: Matt Mastracci <matthew@mastracci.com> Co-authored-by: Bartek IwaƄczuk <biwanczuk@gmail.com>
Diffstat (limited to 'tests/specs')
-rw-r--r--tests/specs/test/slow_test/__test__.jsonc8
-rw-r--r--tests/specs/test/slow_test/main.js4
-rw-r--r--tests/specs/test/slow_test/main.out3
3 files changed, 15 insertions, 0 deletions
diff --git a/tests/specs/test/slow_test/__test__.jsonc b/tests/specs/test/slow_test/__test__.jsonc
new file mode 100644
index 000000000..114b0c2c1
--- /dev/null
+++ b/tests/specs/test/slow_test/__test__.jsonc
@@ -0,0 +1,8 @@
+{
+ "args": "test main.js",
+ "envs": {
+ "DENO_SLOW_TEST_TIMEOUT": "1"
+ },
+ "output": "main.out",
+ "exitCode": 0
+}
diff --git a/tests/specs/test/slow_test/main.js b/tests/specs/test/slow_test/main.js
new file mode 100644
index 000000000..830d2bf79
--- /dev/null
+++ b/tests/specs/test/slow_test/main.js
@@ -0,0 +1,4 @@
+Deno.test(async function test() {
+ // We want to get at least one slow test warning
+ await new Promise((r) => setTimeout(r, 3_000));
+});
diff --git a/tests/specs/test/slow_test/main.out b/tests/specs/test/slow_test/main.out
new file mode 100644
index 000000000..43b3d36f7
--- /dev/null
+++ b/tests/specs/test/slow_test/main.out
@@ -0,0 +1,3 @@
+running 1 test from [WILDCARD]
+test ...'test' has been running for over (1s)
+[WILDCARD]