diff --git a/.gitignore b/.gitignore index 6349ee8..5a5f5f1 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ examples/public/google* *.geany *~ *.swp +coverage diff --git a/Gruntfile.js b/Gruntfile.js index d7e2c9f..17b2f0b 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -16,14 +16,42 @@ module.exports = function(grunt) { reporter: 'spec', ui: 'tdd' } + }, + 'mocha_istanbul': { + coveralls: { + src: [ 'test/lib', 'test/lib/utils' ], + options: { + coverage: true, + legend: true, + check: { + lines: 98, + statements: 97 + }, + root: './lib', + reportFormats: ['lcov'] + } + } } }) + + grunt.event.on('coverage', function(lcov, done){ + require('coveralls').handleInput(lcov, function(error) { + if (error) { + console.log(error) + return done(error) + } + done() + }) + }) // Load the plugins grunt.loadNpmTasks('grunt-contrib-jshint') grunt.loadNpmTasks('grunt-mocha-cli') + grunt.loadNpmTasks('grunt-mocha-istanbul') // Configure tasks + grunt.registerTask('coveralls', ['mocha_istanbul:coveralls']) grunt.registerTask('default', ['test']) - grunt.registerTask('test', ['mochacli', 'jshint']) -} + + grunt.registerTask('test', ['mochacli', 'jshint', 'coveralls']) +} \ No newline at end of file diff --git a/README.md b/README.md index 093f815..1583b02 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ See the XMPP-FTW demo repository - https://github.com/xmpp-ftw/xmpp-ftw-demo # Build status [![Build Status](https://secure.travis-ci.org/xmpp-ftw/xmpp-ftw-muc.png)](http://travis-ci.org/xmpp-ftw/xmpp-ftw-muc) - +[![Coverage Status](https://img.shields.io/coveralls/xmpp-ftw/xmpp-ftw-muc.svg)](https://coveralls.io/r/xmpp-ftw/xmpp-ftw-muc) # Install ``` @@ -24,7 +24,3 @@ npm i --save xmpp-ftw-muc ``` npm test ``` - - -[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/xmpp-ftw/xmpp-ftw-muc/trend.png)](https://bitdeli.com/free "Bitdeli Badge") - diff --git a/package.json b/package.json index 9c2c947..793f1f1 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,9 @@ "ltx": "0.x" }, "devDependencies": { + "coveralls": "^2.11.2", + "grunt-mocha-istanbul": "^2.2.0", + "istanbul": "^0.3.2", "mocha": "~1.8.1", "should": "~1.2.2", "xmpp-ftw": "1.x",