An example repository for showing how to generate the codecov reports with Karma testing framework
An example repository for showing how to generate the codecov reports with Karma testing framework.
First, git init
and npm init
and then,
npm install --save-dev karma karma-coverage codecov
karma init
And then edit karma.conf.js and modify preprocessor
, reporters
and coverageReporter
properties.
preprocessor: {
'src/**/*.js': ['coverage']
},
reporters: ['progress', 'coverage'],
coverageReporter: {
reporters: [{type: 'lcov'}]
},
Note If you prefer to use browserify
in testing, you should check karma-browserify
and browserify-istanbul
and don't use coverage
preprocessor directly which doesn't work with karma-browserify
.
And then add scripts to package.json
"scripts": {
"test": "karma start karma.conf.js",
"codecov": "codecov"
},
And then edit circle.yml
(for example).
test:
post:
- npm run codecov
And then turn on the repository setting on circle-ci UI and push the change to github and you'll see the coverage report on codecov.io website.