jest: Defining test timeout as a config parameter
🚀 Feature Proposal
I’d like to propose introducing a new config parameter config called timeout
, that would accept a number or a string.
Motivation
To set a global timeout different than Jest’s default, one must use a setupTestFrameworkScriptFile
config and create a new file. This is a bit cumbersome, isn’t it?
It would also play nice with the API we have for already: jest.setTimeout(number)
.
Example
"jest": {
"timeout": 60000
}
Pitch
Why does this feature belong in the Jest core platform?
It is a config change, duh.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 93
- Comments: 18 (8 by maintainers)
Having a flag like ‘disable timeouts’ on the cli to help debugging makes more sense to me than being able to set a timeout
I can’t believe this doesn’t exist? How is it even possible to use a step debugger if every test times out after 5s?
Anyone working on this issue? If no, I pick up.
@SimenB @krzkaczor so we could have a single
--timeout
flag that would take a number orInfinity
for no-timeout at all, what do you think?Yes and it is landed in 24.9.0
I think that users should be able to:
@thymikee what do you think about it? I can try implementing these.
@ert78gb Is this issue covered by your PR?
@thymikee I think
0
is more obvious (mocha does it as well).@bluedusk you can always just drop somewhere
jest.setTimeout(2137*1000);
or something similar.Could this parameter be added to the CLI as well? Reason for this is that when I use a debugger to step through code, I would like to set it to infinite (or very high). But I don’t want to change this setting in our config, because then this change might be committed by accident…
Or is it possible to point to a different config via another cli parameter?
Makes sense. Should the name be
testTimeout
or something to be clear this is not a global test suite timeout, but per test?