Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(cli): Add slow test warning #23874

Merged
merged 4 commits into from
May 22, 2024
Merged

Conversation

mmastrac
Copy link
Contributor

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)

@mmastrac mmastrac requested a review from bartlomieju May 17, 2024 21:36
@bartlomieju
Copy link
Member

@dsherret does this satisfy the needs you had to debug Node.js compat tests?

@bartlomieju bartlomieju requested a review from dsherret May 20, 2024 12:46
@bartlomieju bartlomieju added this to the 1.44 milestone May 20, 2024
mmastrac and others added 3 commits May 21, 2024 09:54
Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
Signed-off-by: Matt Mastracci <matthew@mastracci.com>
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, this is great! Let's wait until v1.44 to merge it.

@mmastrac mmastrac merged commit 596a299 into denoland:main May 22, 2024
17 checks passed
@Leokuma
Copy link

Leokuma commented May 30, 2024

Would it make sense to add a timeout option to Deno.test() and in step()? If the test takes longer than timeout, it fails.

Deno.test({
  timeout: 1_000_000_000, // ns
  name: "example test",
  fn() {
    assertEquals("world", "world")
  }
})

It's already possible to do that manually by measuring the time spent and then throwing, but a timeout option would be so ergonomic it might be worth it.

@bartlomieju
Copy link
Member

@Leokuma it's covered by #11133. And yes, this is something we want to add.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants