I am building a react project which has 2 separate Jest configs for my frontend and backend tests. My frontend tests use React Testing Library which requires the "jsdom" test environment and my backend tests use mongoose which requires the "node" test environment. I am trying to use the jest "projects" config in my package.json in order to run the two testing suites simultaneously with their respective environments like so:
{
"jest": {
"projects": [
"backend/config/jest.config.js",
"src/jest.config.js"
]
}
}
However, when I try to run the tests, I get this message:
Out of the box, Create React App only supports overriding these Jest options:
• clearMocks
• collectCoverageFrom
• coveragePathIgnorePatterns
• coverageReporters
• coverageThreshold
• displayName
• extraGlobals
• globalSetup
• globalTeardown
• moduleNameMapper
• resetMocks
• resetModules
• restoreMocks
• snapshotSerializers
• transform
• transformIgnorePatterns
• watchPathIgnorePatterns.
These options in your package.json Jest configuration are not currently supported by Create React App:
• projects
If you wish to override other Jest options, you need to eject from the default setup. You can do so by running npm run eject but remember that this is a one-way operation. You may also file an issue with Create React App to discuss supporting more options out of the box.
I'm not quite sure what do to here. Any way to make the jest "projects" option work the create-react-app?