Config 'testTimeout' not working inside 'projects' config
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:3
- Comments:5 (1 by maintainers)
Top Results From Across the Web
testTimeout config not working in projects · Issue #9696 - GitHub
Use this config and write a test taking more than 1 ms. module.exports = { projects: [ { testEnvironment ...
Read more >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
The bail config option can be used here to have Jest stop running tests ... This will collect coverage information for all the...
Read more >Testing Your Application - Quarkus
This allows you to run tests while having the application running in parallel. Changing the test port. You can configure the ports used...
Read more >Test runner - Storybook
Test runner offers zero-config support for Storybook. ... your project, you should be able to migrate them into Storybook's test-runner without any issues....
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

I don’t think this is fixed… We encountered the same issue on version 26.4.2.
see also https://github.com/facebook/jest/issues/9696, which suggests hoisting the testTimeout setting up a level out of the project config as a workaround (provided you’re OK with the same timeout across all test projects).