diff options
author | Matt Mastracci <matthew@mastracci.com> | 2024-05-22 08:08:27 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-22 08:08:27 -0600 |
commit | 596a2996cf777809fdefdb05a73a5b6253a5c285 (patch) | |
tree | aba11527acb26f3fa3176944498fb8521a6368a7 /cli/lsp/testing | |
parent | 7ab7a14db74b037ca8b035a04c28ac0b6e30e716 (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 'cli/lsp/testing')
-rw-r--r-- | cli/lsp/testing/execution.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cli/lsp/testing/execution.rs b/cli/lsp/testing/execution.rs index 29b6a4f19..f56f5010f 100644 --- a/cli/lsp/testing/execution.rs +++ b/cli/lsp/testing/execution.rs @@ -353,6 +353,9 @@ impl TestRun { test::TestEvent::Output(_, output) => { reporter.report_output(&output); } + test::TestEvent::Slow(id, elapsed) => { + reporter.report_slow(tests.read().get(&id).unwrap(), elapsed); + } test::TestEvent::Result(id, result, elapsed) => { if tests_with_result.insert(id) { let description = tests.read().get(&id).unwrap().clone(); @@ -610,6 +613,8 @@ impl LspTestReporter { self.progress(lsp_custom::TestRunProgressMessage::Started { test }); } + fn report_slow(&mut self, _desc: &test::TestDescription, _elapsed: u64) {} + fn report_output(&mut self, output: &[u8]) { let test = self .current_test |