Allow to override `resetMocks` and `resetModules` Jest configuration?
See original GitHub issueI am wondering if you would be opened to allow overriding the resetMocks
and resetModules
options from Jest configuration? Currently, when trying to update them directly in the package.json
such as:
{
"jest": {
"resetMocks": true
}
}
I got a message telling me it is not configurable:
Out of the box, Create React App only supports overriding these Jest options:
• collectCoverageFrom
• coverageReporters
• coverageThreshold
• snapshotSerializers.
As an absent minded developer, I will always forget to restore a mock one day or another. And this parameter would save (the future) me a lot of time. Is there any particular reason to restrict these two options? Or is it just a lack waiting for a PR? 😃
Related Jest documentation: https://facebook.github.io/jest/docs/en/configuration.html#resetmocks-boolean
Issue Analytics
- State:
- Created 6 years ago
- Reactions:8
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Configuring Jest
To read TypeScript configuration files Jest requires ts-node . ... resetMocks [boolean]; resetModules [boolean]; resolver [string] ...
Read more >reactjs - How to make absolute import modules with ...
Out of the box, Create React App only supports overriding these Jest options: • clearMocks • collectCoverageFrom ...
Read more >Running Tests | Create React App
Jest is a Node-based runner. This means that the tests always run in a Node environment and not in a real browser. This...
Read more >Configuring package.json · Jest
Jest's configuration can be defined in the package.json file of your project or through ... preset [string]; resetMocks [boolean]; resetModules [boolean] ...
Read more >How to automatically reset mocks and restore spies in Jest
fn(). To guard your codebase against the overriding a method by reassigning it with jest.fn( .. ) , you could configure ...
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 FreeTop 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
Top GitHub Comments
https://github.com/facebookincubator/create-react-app/pull/3802
overriding
resetMocks
would be a really nice feature. I wish jest would let the user configure it via a command line argument, though.