t.timeout is ignored in test.before #2888
Answered
by
novemberborn
fungiboletus
asked this question in
Q&A
-
import test from 'ava';
import { setTimeout } from 'timers';
test.before(async (t) => {
t.timeout(60_000);
await new Promise<void>((resolve) => setTimeout(() => resolve(), 50_000));
});
test('Works', (t) => {
t.is(1, 1);
}); Running the following code will fail instead of waiting 50 seconds. t.timeout should perhaps be removed from the TypeScript definition of the t parameter in the test.before callback. But it would also be nice to be able to specify a timeout in a before block. |
Beta Was this translation helpful? Give feedback.
Answered by
novemberborn
Nov 4, 2021
Replies: 1 comment 1 reply
-
Could you elaborate on how the code fails? In AVA 3, the global timeout (which has a default shorter than 60 seconds) is not extended when you use |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
fungiboletus
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Could you elaborate on how the code fails?
In AVA 3, the global timeout (which has a default shorter than 60 seconds) is not extended when you use
t.timeout()
. That's fixed in AVA 4 (pre-release).