facebook/create-react-app#2474 (comment)
You should be able to pass it as a command line option. Since it doesn't seem to make sense for non-CI runs, you might as well do it like this:
"test": "react-scripts test",
"test:ci": "react-scripts test --testResultsProcessor ./node_modules/jest-junit",
and then set your CI server to run npm run test:ci
.
Hope this helps!
使用 codecov 集成测试覆盖率报告,相关配置
遇到的 error
package.json
"test:ci": "cross-env CI=1 react-scripts test --coverageDirectory ./coverage/ --collectCoverage true",
.travis.yml
language: node_js
node_js:
- 6
- 8
- 10
cache:
directories:
- node_modules
install:
- npm install -g codecov
script:
- npm run build
- npm run test:ci
- codecov