使用 Jest 做单元测试
"test": "cross-env CI=1 react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom",
"test:coverage": "npm test -- --coverage",
// 关键
"test:ci": "npm run test:coverage --coverageDirectory=coverage --collectCoverage",
language: node_js
node_js:
- 8
- 10
cache:
directories:
- node_modules
install:
# 不用在 local 安装, 其实也可以安装成 dev 依赖
# 暂时使用这个。 FIXME:
- npm install -g codecov
script:
- npm run build
- npm run test:ci
- codecov
https://github.com/ThaddeusJiang/react-mobile-wrapper/pull/1/files