I am wondering how would I set up a global timeout for all my JestJS tests within package.json?
The default 5000ms is not sufficient for my tests. I don't want to be doing the following code for each of my tests:
it('should return foo', () => { .. }, timeout);
You can add testTimeout
to your jest configuration
package.json
"jest": {
"testTimeout": 10000,
}
or as a CLI option
package.json
"scripts": {
"test": "jest --testTimeout=10000"
}
● Validation Warning:
Unknown option "testTimeout" with value 10000 was found. This is probably a typing mistake. Fixing it will remove this message.
you should upgrade jest
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With