Created by: cpojer
This changes create-jest-config
to take in the app's configuration so that people can decide to overwrite the defaults if they like.
I recommend people to use the node environment and not bother with jsdom, however people might have existing code that accesses DOM APIs. In such cases people can put
"jest": {
"testEnvironment": "jest-environment-jsdom"
}
into their config and npm run test
will merge the default config and the app config together. If someone decides to eject, the custom config will be kept in-tact when we write the default config into package.json
.
I was unsure how to test my changes to test/eject so I figured I'll add a Jest test to scripts
which can be invoked using npm run test-scripts
. I used a snapshot test to lock in the Jest config and validated that it is correct. I also enjoy how meta it is to use snapshots in Jest to test a feature for Jest integration into a project that is promoting snapshot testing. Anyway, people can now write tests for stuff in scripts/
to make sure we don't regress.
Fixes #338 (closed)