ava: Have the global timeout take into account `t.timeout()` durations
What you’re trying to do
I appreciate that having a global timeout in order to catch unexpected behavior in a test and not consume too much CI resources. However, some tests take a long time intentionally, and I would like to be able to use t.timeout()
to explicitly override the global timeouts for just one test. Right now, you can only override the global timeouts if then t.timeout()
is shorter than the global timeout. It would be nice if it overrides when t.timeout()
is longer as well.
I think I am not the only one, as I found this question referring to the same problem.
Why you can’t use AVA for this
There is no way to have a global timeout that is something like 10s and a timeout for a particular test that is longer, like 30s.
And maybe how you think AVA could handle this
I’m not sure how the timeouts are coded, it might be a one-liner 😃
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 11
- Comments: 20 (17 by maintainers)
Commits related to this issue
- tests ~ replace and increase 'ava' global test timeout - use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global... — committed to rivy/js.os-paths by rivy 3 years ago
- tests ~ replace and increase 'ava' global test timeout - use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global... — committed to rivy/js.os-paths by rivy 3 years ago
- tests ~ replace and increase 'ava' global test timeout - use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global... — committed to rivy/js.os-paths by rivy 3 years ago
- tests ~ increase 'ava' global test timeout - use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global timeout; th... — committed to rivy/js.xdg-portable by rivy 3 years ago
- tests ~ increase 'ava' global test timeout - use global timeout instead of individual test timeouts # Discussion Individual test timeouts (`t.timeout(...)`) do *not* increase the global timeout; th... — committed to rivy/js.xdg-portable by rivy 3 years ago
- Have the global timeout take into account t.timeout() durations Fixes #2384. Co-authored-by: Mark Wubben <mark@novemberborn.net> — committed to avajs/ava by OhYash 3 years ago
I just ran into this, and it took longer than I’d like to admit to realize this was the issue. We have two tests that are much slower (~2m), while the other tests are below the default 10s. I wanted to only mark to “slow” tests to use a higher timeout, instead of needing to set
t.timeout()
for every test.Would be awesome to have this issue solved! 😄
The global timeout is a “stop tests in case they’re stuck” kind of timeout.
I suppose we could interpret that as “stop tests in case they’re stuck, but don’t worry for the next 30 seconds since the test will fail if it’s stuck anyway”.
The workers will have to send a message to the main process whenever a per-test timeout starts, with the timeout duration. And then in the main process we’d have to make sure we don’t stop tests because they’re stuck until that duration has passed.
This should work with multiple
t.timeout()
calls, of course.I don’t think it’s quite a one-liner, but this approach is consistent with what the global timeout is there for, so let’s do it.
Hey there, I came in after seeing the issue on Rysolv.
Seeing nobody else has announced of them picking this up, guess I’ll give it a try.
As per my understanding after some local testing: Presently,
t.timeout(ms)
allows us to set up a smaller per-test timeout within the global timeout limit and not beyond it, we need it to allow longer than the global timeout.I’m going through the code as I write this. And #2384 comment makes sense looking at
api.js
andtest.js
.