From 596a2996cf777809fdefdb05a73a5b6253a5c285 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Wed, 22 May 2024 08:08:27 -0600 Subject: feat(cli): Add slow test warning (#23874) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Co-authored-by: Bartek IwaƄczuk --- cli/lsp/testing/execution.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cli/lsp/testing') 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 -- cgit v1.2.3