Skip to content
This repository was archived by the owner on Oct 21, 2020. It is now read-only.

Commit

Permalink
Add codeclimate coverage reports
Browse files Browse the repository at this point in the history
We use a mocha reporter to generate an lcov file which can be uploaded
to code climate. the uploader needs an environment variable which contains
a token for codeclimate. This variable was added as an encrypted value
to the travis yaml file.
  • Loading branch information
micha149 committed Dec 22, 2014
1 parent e17ee2c commit 6389b8c
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 40 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
src-cov/
docs/output
coverage.html
coverage.lcov
8 changes: 6 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
language: node_js
node_js:
- "0.10"
- '0.10'
before_script:
- npm install -g grunt-cli
- npm install -g grunt-cli
script: "grunt travis"
env:
global:
secure: X4UaHLMI8Z+HyOAtSzC9vz40rUL8ySEo+TKZs3diy7t3HgYNwTZ7oyTLSvYY+Jyumf85mFQhjJx+AwhUKOkgCW3JLzjZbQ1eFAHfxtpHDkFr6zvhuDwfM3LaivAOD3l8fMknMdkGtWhJVbANtmOOs+5f0RamQJX7m3t6y7n6zEI=
24 changes: 22 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,32 @@ module.exports = function(grunt) {
},
src: ['test/**/*Test.js']
},
coverage: {
"html-coverage": {
options: {
reporter: 'html-cov',
require: "test/setup.js",
quiet: true,
captureFile: 'coverage.html'
},
src: ['test/**/*Test.js']
},
"lcov-coverage": {
options: {
reporter: 'mocha-lcov-reporter',
require: "test/setup.js",
quiet: true,
captureFile: 'coverage.lcov'
},
src: ['test/**/*Test.js']
}
},

shell: {
options: {
stderr: false
},
"upload-coverage-report": {
command: './node_modules/.bin/codeclimate < coverage.lcov'
}
},

Expand Down Expand Up @@ -65,6 +83,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mocha-test');
grunt.loadNpmTasks('grunt-jsduck');
grunt.loadNpmTasks('grunt-shell');

grunt.registerTask('instrument', 'Enalbles instrumentation of source files for code coverage', function() {
require('blanket')({
Expand All @@ -75,7 +94,8 @@ module.exports = function(grunt) {
// Default task(s).
grunt.registerTask('default', 'Run jshint and unit tests', ['jshint', 'mochaTest:default']);
grunt.registerTask('unit', 'Run unit tests only, but with verbose output', ['mochaTest:unitOnly']);
grunt.registerTask('coverage', 'Run tests and create code coverage', ['instrument', 'mochaTest:default', 'mochaTest:coverage']);
grunt.registerTask('coverage', 'Run tests and create code coverage', ['instrument', 'mochaTest:default', 'mochaTest:html-coverage']);
grunt.registerTask('travis', 'Task run by travis ci', ['jshint', 'instrument', 'mochaTest:default', 'mochaTest:lcov-coverage', 'shell:upload-coverage-report']);
grunt.registerTask('docs', 'Create API documentation', ['jsduck']);

};
75 changes: 39 additions & 36 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
{
"name": "homelib",
"version": "0.1.0",
"author": "Michael van Engelshoven <[email protected]>",
"description": "A home automation framework for knx/eib",
"contributors": [],
"repository": {
"type": "git",
"url": "https://github.com/micha149/homelib.git"
},
"dependencies": {
"async": "^0.8.0",
"implementjs": "^0.3.0",
"suncalc": "^1.4.0",
"underscore": "^1.6.0"
},
"devDependencies": {
"sinon": "1.9.0",
"mocha": "~1.18.2",
"chai": "~1.9.1",
"sinon-chai": "~2.5.0",
"grunt": "~0.4.4",
"grunt-contrib-jshint": "~0.9.2",
"grunt-mocha-test": "~0.10.0",
"grunt-jsduck": "~1.0.1",
"blanket": "~1.1.5",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-watch": "~0.6.1"
},
"main": "./homelib.js",
"scripts": {
"test": "grunt"
},
"license": "MIT",
"engines": {
"node": ">=0.9.2"
}
"name": "homelib",
"version": "0.1.0",
"author": "Michael van Engelshoven <[email protected]>",
"description": "A home automation framework for knx/eib",
"contributors": [],
"repository": {
"type": "git",
"url": "https://github.com/micha149/homelib.git"
},
"dependencies": {
"async": "^0.8.0",
"implementjs": "^0.3.0",
"suncalc": "^1.4.0",
"underscore": "^1.6.0"
},
"devDependencies": {
"blanket": "~1.1.5",
"chai": "~1.9.1",
"codeclimate-test-reporter": "0.0.4",
"grunt": "~0.4.4",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-jshint": "~0.9.2",
"grunt-contrib-watch": "~0.6.1",
"grunt-jsduck": "~1.0.1",
"grunt-mocha-test": "~0.10.0",
"grunt-shell": "^1.1.1",
"mocha": "~1.18.2",
"mocha-lcov-reporter": "0.0.1",
"sinon": "1.9.0",
"sinon-chai": "~2.5.0"
},
"main": "./homelib.js",
"scripts": {
"test": "grunt"
},
"license": "MIT",
"engines": {
"node": ">=0.9.2"
}
}

0 comments on commit 6389b8c

Please sign in to comment.