Documentation: missing instructions if setupTests.js is added after an eject
See original GitHub issueinitializing-test-environment doesn’t explain that
"setupTestFrameworkScriptFile": "<rootDir>/src/setupTests.js",
needs to be added to package.json
if src/setupTests.js
is created after the app has been “ejected” as createJestConfig only adds this configuration if the file is present (makes sense).
Standard template being:
{
…
"jest": {
"setupFiles": [
…
],
"setupTestFrameworkScriptFile": "<rootDir>/src/setupTests.js",
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:16 (3 by maintainers)
Top Results From Across the Web
How to use jest.config.js with create-react-app - Stack Overflow
For me appending -- --config=jest.config.js worked. So the whole string react-scripts test -- --config jest.config.js in your case.
Read more >How To Set Up a React Project with Create React App
Starting a new JavaScript project with React used to be a complicated process. But now, Create React App includes all the JavaScript ......
Read more >create-react-app - Breword 文档集合
#1721 Fix hot reloading for WebpackDevServer after eject. (@gaearon) ... #1222 Disable gh-page setup instruction if scripts.deploy has been added. (@n3tr).
Read more >Don't eject your Create React App | by Adam Laycock - Medium
If you found yourself on this page because you want to eject your ... is missing a feature that I need, so I'm...
Read more >learning / learning-dashboard · GitLab
Changing the HTML; Adding Assets Outside of the Module System; When to Use the public ... Read instructions below for using assets from...
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
I have the same problem as Doug. src/setupTests.js and it doesn’t work. Yet if I place the code in the test files themselves, it works.
Documented in https://github.com/facebookincubator/create-react-app/commit/1c8a7f3fecc60cd1516ed3a28f274945de90b3db.
@dougbacelar Unfortunately we can’t help without a reproducing project.