From 7c286b00bbdbf4a3048c3e90adfb4d4f65dd3a44 Mon Sep 17 00:00:00 2001 From: Liran Tal Date: Wed, 19 Aug 2015 21:49:30 +0300 Subject: [PATCH] adding support for coveralls integration for mean.js to report live project code coverage information --- README.md | 1 + gruntfile.js | 12 +++++++++++- package.json | 3 ++- test.js | 6 +++--- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 5236b582..4e5ecf76 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,7 @@ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/meanjs/mean?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/meanjs/mean.svg?branch=master)](https://travis-ci.org/meanjs/mean) [![Dependencies Status](https://david-dm.org/meanjs/mean.svg)](https://david-dm.org/meanjs/mean) +[![Coverage Status](https://coveralls.io/repos/meanjs/mean/badge.svg?branch=master&service=github)](https://coveralls.io/github/meanjs/mean?branch=master) MEAN.JS is a full-stack JavaScript open-source solution, which provides a solid starting point for [MongoDB](http://www.mongodb.org/), [Node.js](http://www.nodejs.org/), [Express](http://expressjs.com/), and [AngularJS](http://angularjs.org/) based applications. The idea is to solve the common issues with connecting those frameworks, build a robust framework to support daily development needs, and help developers use better practices while working with popular JavaScript components. diff --git a/gruntfile.js b/gruntfile.js index d8d2ce1b..5f7c0e9b 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -184,10 +184,11 @@ module.exports = function (grunt) { coverage: true, require: 'test.js', coverageFolder: 'coverage', + reportFormats: ['cobertura','lcovonly'], check: { lines: 40, statements: 40 - } + } } } }, @@ -219,6 +220,15 @@ module.exports = function (grunt) { } }); + grunt.event.on('coverage', function(lcovFileContents, done) { + require('coveralls').handleInput(lcovFileContents, function(err) { + if (err) { + return done(err); + } + done(); + }); + }); + // Load NPM tasks require('load-grunt-tasks')(grunt); diff --git a/package.json b/package.json index 36e4da7f..e148738c 100644 --- a/package.json +++ b/package.json @@ -105,6 +105,7 @@ "load-grunt-tasks": "^3.2.0", "run-sequence": "^1.1.1", "should": "^7.0.1", - "supertest": "^1.0.1" + "supertest": "^1.0.1", + "coveralls": "^2.11.4" } } diff --git a/test.js b/test.js index b0ee644c..daf3386e 100644 --- a/test.js +++ b/test.js @@ -3,11 +3,11 @@ /** * Module dependencies. */ -var app, db, config; +var app; var path = require('path'); var app = require(path.resolve('./config/lib/app')); -app.init(function (app, db, config) { - console.log('Initialized test automation'); +app.init(function () { + console.log('Initialized test automation'); });