Skip to content

Commit

Permalink
add coverage and coveralls
Browse files Browse the repository at this point in the history
Conflicts:
	.npmignore
	Gruntfile.js
  • Loading branch information
ahumphreys87 authored and samccone committed Jun 17, 2014
1 parent 5cc3e5b commit ad295bd
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@
tmp/
ext/
node_modules/
coverage/
test/
.grunt/
npm-debug.log
_SpecRunner.html
bower_components/
.idea
.grunt
reports
reports
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ component.json
bower_components
tmp
SpecRunner.html
coverage
test
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ before_install:
- npm config set ca ""
before_script:
- npm run-script bower
after_success:
- npm run-script coverage
40 changes: 40 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,20 @@ module.exports = function(grunt) {
}
},

env: {
coverage: {
APP_DIR_FOR_CODE_COVERAGE: '../../../test/tmp/'
}
},

instrument: {
files: 'tmp/backbone.marionette.js',
options: {
lazy: true,
basePath: 'test'
}
},

mochaTest: {
tests: {
options: {
Expand All @@ -134,6 +148,30 @@ module.exports = function(grunt) {
}
},

storeCoverage: {
options: {
dir: 'coverage'
}
},
makeReport: {
src: 'coverage/**/*.json',
options: {
type: 'lcov',
dir: 'coverage',
print: 'detail'
}
},

coveralls: {
options: {
src: 'coverage/lcov.info',
force: false
},
default: {
src: 'coverage/lcov.info'
}
},

plato: {
marionette : {
src : 'src/*.js',
Expand Down Expand Up @@ -254,6 +292,8 @@ module.exports = function(grunt) {

grunt.registerTask('test', 'Run the unit tests.', ['verify-bower', 'lint', 'unwrap', 'preprocess:bundle', 'template:bundle', 'mochaTest']);

grunt.registerTask('coverage', ['unwrap', 'preprocess:bundle', 'template:bundle', 'env:coverage', 'instrument', 'mochaTest', 'storeCoverage', 'makeReport', 'coveralls']);

grunt.registerTask('dev', 'Auto-lints while writing code.', ['test', 'watch:marionette']);

grunt.registerTask('build', 'Build all three versions of the library.', ['clean:lib', 'bower:install', 'lint', 'unwrap', 'preprocess', 'template', 'mochaTest', 'concat', 'uglify']);
Expand Down
38 changes: 21 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
],
"scripts": {
"bower": "bower install",
"test": "grunt test --mocha-reporter=dot"
"test": "grunt test --mocha-reporter=dot",
"coverage": "grunt coverage --mocha-reporter=dot"
},
"author": {
"name": "Derick Bailey",
Expand All @@ -46,30 +47,33 @@
"underscore": "1.4.4 - 1.6.0"
},
"devDependencies": {
"bower": "1.2.8",
"chai": "^1.9.1",
"chai-jq": "0.0.7",
"chai-jquery": "^1.2.1",
"grunt": "~0.4.5",
"grunt-bower-task": "~0.3.4",
"grunt-cli": "0.1.13",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-concat": "~0.1.2",
"grunt-contrib-connect": "^0.1.2",
"grunt-contrib-jshint": "^0.10.0",
"grunt-plato": "~0.1.4",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-concat": "~0.1.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-contrib-connect": "^0.1.2",
"load-grunt-tasks": "0.3.0",
"grunt-coveralls": "^0.3.0",
"grunt-env": "^0.4.1",
"grunt-istanbul": "^0.3.0",
"grunt-lintspaces": "^0.4.1",
"bower": "1.2.8",
"grunt-cli": "0.1.13",
"grunt-contrib-clean": "~0.5.0",
"grunt-mocha-test": "^0.10.2",
"grunt-plato": "~0.1.4",
"grunt-preprocess": "~4.0.0",
"unwrap": "^0.1.0",
"grunt-bower-task": "~0.3.4",
"grunt-template": "^0.2.3",
"sinon-chai": "^2.5.0",
"chai": "^1.9.1",
"jquery": "^2.1.1",
"jsdom": "^0.10.5",
"load-grunt-tasks": "0.3.0",
"mocha": "^1.19.0",
"grunt-mocha-test": "^0.10.2",
"sinon": "^1.9.1",
"jsdom": "^0.10.5",
"jquery": "^2.1.1",
"chai-jquery": "^1.2.1",
"chai-jq": "0.0.7"
"sinon-chai": "^2.5.0",
"unwrap": "^0.1.0"
}
}
3 changes: 3 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
<a title='Build Status' href="https://travis-ci.org/marionettejs/backbone.marionette">
<img src='https://secure.travis-ci.org/marionettejs/backbone.marionette.svg?branch=master' />
</a>
<a href='https://coveralls.io/r/marionettejs/backbone.marionette'>
<img src='https://img.shields.io/coveralls/marionettejs/backbone.marionette.svg' alt='Coverage Status' />
</a>
</p>

## About Marionette
Expand Down
3 changes: 2 additions & 1 deletion spec/javascripts/setup/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ var chai = require('chai');
var sinon = require('sinon');
var sinonChai = require('sinon-chai');
var chaiJq = require('chai-jq');
var requireHelper = require('./require_helper');

chai.use(sinonChai);
chai.use(chaiJq);
Expand Down Expand Up @@ -31,4 +32,4 @@ global.$ = global.jQuery = require('jquery');
global._ = require('underscore');
global.Backbone = require('backbone');
global.Backbone.$ = global.$;
global.Marionette = require('../../../tmp/backbone.marionette');
global.Marionette = requireHelper('backbone.marionette');
3 changes: 3 additions & 0 deletions spec/javascripts/setup/require_helper.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = function (path) {
return require((process.env.APP_DIR_FOR_CODE_COVERAGE || '../../../tmp/') + path);
};

0 comments on commit ad295bd

Please sign in to comment.