I would like to output the results of my jest testing to a file format like JUnit without ejecting from react-scripts.
By using the --json
command I can output it to JSON but I was hoping to get a format that Jenkins can process by default.
I cant seem to find if this is supported and I don't want to eject from Create React App, is there another way?
You shouldn't need to do anything fancy. Just install jest-junit
and then run with the additional reporters
flag:
yarn test --reporters=jest-junit
You can also add it to the jest
settings of package.json
. Probably something like this:
{
"name": "your-package",
"jest": {
"coverageReporters": ["jest-junit"]
}
}