Skip to content

Commit

Permalink
test(coverage): add coverage and coveralls.io integration
Browse files Browse the repository at this point in the history
  • Loading branch information
bostrom committed Jan 5, 2017
1 parent 7c245a2 commit fdd5de6
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ results
lib
node_modules
components
coverage
bower_components
npm-debug.log
.idea
19 changes: 19 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ module.exports = function(grunt) {
autoWatch: true
}
},
coveralls: {
// Options relevant to all targets
options: {
// When true, grunt-coveralls will only print a warning rather than
// an error, to prevent CI builds from failing unnecessarily (e.g. if
// coveralls.io is down). Optional, defaults to false.
force: false
},

restangular: {
// LCOV coverage file (can be string, glob or array)
src: 'coverage/**/lcov.info',
options: {
// Any options for just this target
}
},
},
changelog: {
options: {
dest: 'CHANGELOG.md'
Expand All @@ -111,6 +128,8 @@ module.exports = function(grunt) {

grunt.loadNpmTasks('grunt-zip');

grunt.loadNpmTasks('grunt-coveralls');


// Default task.
grunt.registerTask('default', ['build']);
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Restangular

[![Build Status](https://travis-ci.org/mgonto/restangular.svg?branch=master)](https://travis-ci.org/mgonto/restangular)
[![Coverage Status](https://coveralls.io/repos/github/mgonto/restangular/badge.svg?branch=master)](https://coveralls.io/github/mgonto/restangular?branch=master)
[![PayPayl donate button](https://img.shields.io/badge/paypal-donate-yellow.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=martin%40gon%2eto&lc=US&item_name=Martin%20Gontovnikas&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted "Donate once-off to this project using Paypal")
[![Donate on Gittip](http://img.shields.io/gittip/mgonto.svg)](https://www.gittip.com/mgonto/)
<a href="https://twitter.com/intent/tweet?hashtags=&original_referer=http%3A%2F%2Fgit.luolix.top%2F&text=Check+out+Restangular%2C+a+service+for+%23AngularJS+that+makes+it+easy+to+use+Rest+APIs&tw_p=tweetbutton&url=https%3A%2F%2Fgit.luolix.top%2Fmgonto%2Frestangular" target="_blank">
Expand Down
17 changes: 15 additions & 2 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = function (config) {

// test results reporter to use
// possible values: 'dots', 'progress', 'junit'
reporters: ['mocha'],
reporters: ['mocha', 'coverage'],


// web server port
Expand Down Expand Up @@ -70,7 +70,20 @@ module.exports = function (config) {

// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false
singleRun: false,

preprocessors: {
// source files, that you wanna generate coverage for
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'src/**/*.js': ['coverage']
},

// optionally, configure the reporter
coverageReporter: {
type: 'lcov',
dir : 'coverage/'
}

});
};
8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,19 @@
"devDependencies": {
"angular-mocks": "^1.4.8",
"grunt": "^0.4.5",
"grunt-bower": "*",
"grunt-bower-task": "*",
"grunt-cli": ">= 0.1.7",
"grunt-contrib-concat": "*",
"grunt-contrib-jshint": "*",
"grunt-contrib-uglify": "*",
"grunt-bower": "*",
"grunt-bower-task": "*",
"grunt-karma": "latest",
"grunt-conventional-changelog": "0.0.12",
"grunt-coveralls": "^1.0.1",
"grunt-karma": "latest",
"grunt-zip": "*",
"karma": "^0.13.19",
"karma-chrome-launcher": "~v2.0.0",
"karma-coverage": "^1.1.1",
"karma-firefox-launcher": "~v1.0.0",
"karma-jasmine": "~0.1.5",
"karma-mocha-reporter": "0.2.8",
Expand Down

0 comments on commit fdd5de6

Please sign in to comment.