Introduction to Codecov
Codecov is an open source test result display platform. Many open source projects on Github use Codecov to display single test results. Codecov supports Github account login and will also synchronize projects in Github.
The role of Codecov
- Visualized results, connected to github, providing small badges
- Automatically merge test results and run them in parallel
Introduction to Travis CI
Travis CI is a managed, distributed continuous integration tool mainly used to build and automatically test projects. When you push a piece of code to github, Travis will automatically test it according to your pre-configured test file and put back the pass or fail results. It only supports Github and does not support other code hosting services.
Travis simple steps to use
- github authorization and panel
- Get the github token
- Configuration project.travis.yml
- other
Steps for usage
- Install dependencies
yarn add nyc codecov -D
- Adding
package.json
script
"scripts": {
"test:unit": "nyc vue-cli-service test:unit",
"coverage": "nyc report --report=text-lcov > coverage.lcov && codecov"
},
- Script
.travis.yml
_
langeuage: node_js
node_js:
- '14'
cache:
directories:
- node_modules
install:
- npm install
script:
- npm run test:unit
after_success:
- npm run coverage
-
Log in to codecov with your Github account
and click on the warehouse to get the corresponding token for use in the next step.
-
Log in to Travis with your Github account, synchronize the warehouse on Github, find the corresponding warehouse and click in to
set the token, as follows
-
Click Trigger build to build the project
-
View Results
Badge
more github small icons
testing report