Skip to content

Instantly share code, notes, and snippets.

@ThaddeusJiang
Last active July 27, 2018 07:06
Show Gist options
  • Save ThaddeusJiang/094c0cf5df422f6578e5f7ad52e5533d to your computer and use it in GitHub Desktop.
Save ThaddeusJiang/094c0cf5df422f6578e5f7ad52e5533d to your computer and use it in GitHub Desktop.
These options in your package.json Jest configuration are not currently supported by Create React App

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment