Skip to content
This repository has been archived by the owner on Aug 30, 2021. It is now read-only.

Commit

Permalink
Adding coverage report for server-side tests using istanbul
Browse files Browse the repository at this point in the history
  • Loading branch information
lirantal committed Aug 15, 2015
1 parent 1f0f1b7 commit 7252032
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,21 @@ module.exports = function (grunt) {
reporter: 'spec'
}
},
mocha_istanbul: {
coverage: {
src: testAssets.tests.server,
options: {
print: 'detail',
coverage: true,
require: 'test.js',
coverageFolder: 'coverage',
check: {
lines: 40,
statements: 40
}
}
}
},
karma: {
unit: {
configFile: 'karma.conf.js'
Expand Down Expand Up @@ -252,6 +267,9 @@ module.exports = function (grunt) {
grunt.registerTask('test', ['env:test', 'lint', 'mkdir:upload', 'copy:localConfig', 'server', 'mochaTest', 'karma:unit']);
grunt.registerTask('test:server', ['env:test', 'lint', 'server', 'mochaTest']);
grunt.registerTask('test:client', ['env:test', 'lint', 'server', 'karma:unit']);
// Run project coverage
grunt.registerTask('coverage', ['env:test', 'lint', 'mocha_istanbul:coverage']);

// Run the project in development mode
grunt.registerTask('default', ['env:dev', 'lint', 'mkdir:upload', 'copy:localConfig', 'concurrent:default']);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ describe('Article Model Unit Tests:', function () {

describe('Method Save', function () {
it('should be able to save without problems', function (done) {
this.timeout(10000);
return article.save(function (err) {
should.not.exist(err);
done();
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"grunt-env": "~0.4.4",
"grunt-karma": "~0.11.2",
"grunt-mocha-test": "~0.12.7",
"grunt-mocha-istanbul": "^2.4.0",
"grunt-ng-annotate": "^1.0.1",
"grunt-node-inspector": "~0.2.0",
"grunt-nodemon": "~0.4.0",
Expand Down
13 changes: 13 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
'use strict';

/**
* Module dependencies.
*/
var app, db, config;

var path = require('path');
var app = require(path.resolve('./config/lib/app'));

app.init(function (app, db, config) {
console.log('Initialized test automation');
});

0 comments on commit 7252032

Please sign in to comment.