In a create-react-app/[email protected] project, I'm trying to generate a coverage report using jest-junit. Unfortunately, it fails with the following:
$ yarn run test --coverage
Failed to write coverage reports:
ERROR: Error: Invalid report format [jest-junit]
STACK: Error: Invalid report format [jest-junit]
at Object.module.exports.create (D:\Users\username\Documents\Project\node_modules\istanbul-api\lib\input-error.js:6:15)
at Reporter.add (D:\Users\username\Documents\Project\node_modules\istanbul-api\lib\reporter.js:51:30)
at D:\Users\username\Documents\Project\node_modules\istanbul-api\lib\reporter.js:62:18
at Array.forEach (<anonymous>)
at Reporter.addAll (D:\Users\username\Documents\Project\node_modules\istanbul-api\lib\reporter.js:61:14)
at D:\Users\username\Documents\Project\node_modules\jest-cli\build\reporters\coverage_reporter.js:180:18
at Generator.next (<anonymous>)
at step (D:\Users\username\Documents\Project\node_modules\jest-cli\build\reporters\coverage_reporter.js:75:30)
at D:\Users\username\Documents\Project\node_modules\jest-cli\build\reporters\coverage_reporter.js:86:15
at process._tickCallback (internal/process/next_tick.js:68:7)
I encounter no errors if I run yarn run test. The following configuration block was added to the project's package.json file:
{
...
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!src/**/*.d.ts",
"!src/**/__stories__/",
"!<rootDir>/node_modules/"
],
"coverageReporters": [
"jest-junit"
]
}
...
}
Has anyone successfully configured jest-junit in a create-react-app@2 project?