Allow configuring reporters for Jest
Created by: jsyrjala
Would it be possible to add functionality to configure custom reporters for Jest, without doing an eject?
This kind of functionality is already implemented for coverage tools https://github.com/facebookincubator/create-react-app/issues/1785
My use case: I am running builds in Jenkins, and I would like to create JUnit XML formatted test reports so that the test results are nicely integrated with Jenkins UI.
I tried using this: https://www.npmjs.com/package/jest-junit and configured package.json
like this
"jest": {
"testResultsProcessor": "./node_modules/jest-junit"
}
The end result is this:
Out of the box, Create React App only supports overriding these Jest options:
• collectCoverageFrom
• coverageReporters
• coverageThreshold
• snapshotSerializers.
These options in your package.json Jest configuration are not currently supported by Create React App:
• testResultsProcessor
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.
There is another reporter package that is seems to do similar thing: https://github.com/michaelleeallen/jest-junit-reporter