testTimeout config not working in projects
See original GitHub issue🐛 Bug Report
The configuration testTimeout (https://jestjs.io/docs/en/configuration#testtimeout-number) does not work in projects (https://jestjs.io/docs/en/configuration#projects-arraystring--projectconfig)
To Reproduce
Use this config and write a test taking more than 1 ms.
module.exports = {
projects: [
{
testEnvironment: 'node',
testTimeout: 1,
},
],
};
Expected behavior
I expect each it(), beforeEach() etc. to time out after 1 ms.
Note that if you move the testTimeout: 1, outside of the projects array the config does kick in. I.e. this works:
module.exports = {
testTimeout: 1,
projects: [
{
testEnvironment: 'node',
},
],
};
Original implementation: https://github.com/facebook/jest/issues/6216
Link to repl or repo (highly encouraged)
const { promisify } = require('util');
const sleep = promisify(setTimeout);
describe('suite A', () => {
it('1', async () => {
await sleep(2000);
expect(true).toBeTruthy();
});
});
envinfo
System:
OS: Linux 4.4 Ubuntu 16.04.5 LTS (Xenial Xerus)
CPU: (4) x64 Intel(R) Xeon(R) Gold 6132 CPU @ 2.60GHz
Binaries:
Node: 12.13.0 - ~/.config/nvm/12.13.0/bin/node
npm: 6.12.0 - ~/.config/nvm/12.13.0/bin/npm
npmPackages:
jest: 25.1.0 => 25.1.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:10 (2 by maintainers)
Top Results From Across the Web
Configure jest timeout once for all tests - Stack Overflow
The issue I am facing is I am running a series of tests against an API that is very slow, 5-15 second response...
Read more >Configuring Jest
When the projects configuration is provided with an array of paths or glob patterns, Jest will run tests in all of the specified...
Read more >Configure unit tests by using a .runsettings file - Microsoft Learn
runsettings file in your solution and select one as the active test settings file as needed. Specify a run settings file in the...
Read more >Test runner | Detox
There are many third-party solutions for running tests, so we're happy to not ... The integration with a test runner is a matter...
Read more >Configuring Vitest
To configure vitest itself, add test property in your Vite config. ... Vitest uses workers not only for running tests in parallel, ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Also, is there a reason why
jest.setTimeout()works for bothtest()andbeforeAll()(all before/after hooks) whereastestTimeoutdoes not (it only affectstest())?Coming from jasmine runner, this seems like a gap in being able to use
testTimeoutas a replacement forjasmine.DEFAULT_TIMEOUT_INTERVAL