-
Notifications
You must be signed in to change notification settings - Fork 385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding Test Coverage Check #1090
Changes from 28 commits
e6af4c7
bb81279
a0dcc3d
aac939a
a8f6358
d94f54e
065326a
7b34364
5f520f9
4bb14cc
7c08b7e
fd54181
f8f76a8
b7c5ee2
193120c
f247253
f4110e5
eee2ed1
da93851
e998859
5127315
d29f89d
bc537eb
3854850
0d78fe5
61fbe69
be36ced
c6d358f
249ab8d
e271298
08c6195
00fd874
3f1db8c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ module.exports = function(grunt) { | |
grunt.initConfig({ | ||
clean: { | ||
files: { | ||
src: ['build/', 'dist/', 'report/', 'js/', '.bower-tmp'] | ||
src: ['build/', 'dist/', 'report/', 'js/', '.bower-tmp', 'coverage/'] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since we report check and report coverage, only keep most recent coverage report in there. |
||
} | ||
}, | ||
|
||
|
@@ -28,6 +28,13 @@ module.exports = function(grunt) { | |
src: ['app/dashboard.js'], | ||
dest: 'build/js/includes-prod.js' | ||
}, | ||
templates: { | ||
options: { | ||
template: "window.balancedSetupFunctions.push(function() { {%= src %} ; });" | ||
}, | ||
src: ['build/js/compiled-templates.js'], | ||
dest: 'build/js/test-templates.js' | ||
}, | ||
testfixtures: { | ||
options: { | ||
template: "{%= src %} ;" | ||
|
@@ -52,13 +59,22 @@ module.exports = function(grunt) { | |
dashboarddev: { | ||
src: [ | ||
'app/app_setup.js', | ||
'build/js/compiled-templates.js', | ||
'build/js/includes-dev.js' | ||
], | ||
dest: 'build/js/dashboard-dev.js' | ||
}, | ||
dashboardtest: { | ||
src: [ | ||
'app/app_setup.js', | ||
'build/js/includes-dev.js' | ||
], | ||
dest: 'build/js/dashboard-test.js' | ||
}, | ||
dashboardprod: { | ||
src: [ | ||
'app/app_setup.js', | ||
'build/js/compiled-templates.js', | ||
'build/js/includes-prod.js' | ||
], | ||
dest: 'build/js/dashboard-prod.js' | ||
|
@@ -630,6 +646,25 @@ module.exports = function(grunt) { | |
dev: { | ||
path: 'http://localhost:9876/build/dev.html' | ||
}, | ||
}, | ||
|
||
coverage: { | ||
options: { | ||
thresholds: { | ||
statements: 75, | ||
branches: 61, | ||
lines: 74, | ||
functions: 76 | ||
}, | ||
dir: './coverage/', | ||
root: '.' | ||
} | ||
}, | ||
|
||
coveralls: { | ||
options: { | ||
src: 'coverage/**/lcov.info' | ||
} | ||
} | ||
}); | ||
|
||
|
@@ -651,6 +686,8 @@ module.exports = function(grunt) { | |
grunt.loadNpmTasks('grunt-open'); | ||
grunt.loadNpmTasks('grunt-karma'); | ||
grunt.loadNpmTasks('grunt-jsbeautifier'); | ||
grunt.loadNpmTasks('grunt-istanbul-coverage'); | ||
grunt.loadNpmTasks('grunt-coveralls'); | ||
|
||
grunt.registerMultiTask('clean', 'Deletes files', function() { | ||
this.files.forEach(function(file) { | ||
|
@@ -666,7 +703,7 @@ module.exports = function(grunt) { | |
A task to run the application's unit tests via the command line. | ||
It will headlessy load the test runner page and print the test runner results | ||
*/ | ||
grunt.registerTask('test', ['_devBuild', 'karma', 'jshint', 'verify']); | ||
grunt.registerTask('test', ['_devBuild', 'karma', 'coverage', 'verify', 'coveralls']); | ||
|
||
/* | ||
Default task. Compiles templates, neuters application code, and begins | ||
|
@@ -700,7 +737,7 @@ module.exports = function(grunt) { | |
grunt.registerTask('_prodBuildSteps', ['img', '_uglify', 'hashres', 'copy:dist']); | ||
|
||
grunt.registerTask('_buildJS', ['emberTemplates', '_buildJSAfterTemplates']); | ||
grunt.registerTask('_buildJSAfterTemplates', ['bower:install', 'neuter:dev', 'neuter:prod', 'concat:dashboarddev', 'concat:dashboardprod', 'concat:libdev', 'concat:libprod']); | ||
grunt.registerTask('_buildJSAfterTemplates', ['bower:install', 'neuter:dev', 'neuter:prod', 'neuter:templates', 'concat:dashboarddev', 'concat:dashboardprod', 'concat:dashboardtest', 'concat:libdev', 'concat:libprod']); | ||
grunt.registerTask('_buildTests', ['neuter:testfixtures', 'concat:libtest', 'concat:tests', 'copy:test']); | ||
grunt.registerTask('_buildCSS', ['less']); | ||
grunt.registerTask('_buildImages', ['copy:images']); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
balanced-dashboard | ||
================== | ||
|
||
The Balanced Dashboard | ||
|
||
[![Build Status](https://travis-ci.org/balanced/balanced-dashboard.png?branch=master)](https://travis-ci.org/balanced/balanced-dashboard) | ||
[![Coverage Status](https://coveralls.io/repos/balanced/balanced-dashboard/badge.png)](https://coveralls.io/r/balanced/balanced-dashboard) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
[![Code Climate](https://codeclimate.com/github/balanced/balanced-dashboard.png)](https://codeclimate.com/github/balanced/balanced-dashboard) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
## What | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
// This is pulled out into a separate file so the Grunt neuter task doesn't | ||
// add templating code to it while building | ||
|
||
window.balancedSetupFunctions = []; | ||
|
||
/* | ||
|
@@ -49,12 +48,12 @@ window.setupBalanced = function(divSelector) { | |
} | ||
}); | ||
|
||
/* istanbul ignore if */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Makes code coverage skip lines (in this case an if statement) |
||
if (!window.TESTING) { | ||
// Defer the readiness until we know about login session | ||
window.Balanced.deferReadiness(); | ||
} | ||
|
||
|
||
window.Balanced.onLoad = function() { | ||
// initialize anything that needs to be done on application load | ||
Balanced.Analytics.init(Ember.ENV.BALANCED); | ||
|
@@ -68,6 +67,7 @@ window.setupBalanced = function(divSelector) { | |
setupFunction(); | ||
}); | ||
|
||
/* istanbul ignore if */ | ||
if (!window.TESTING) { | ||
// Get the current login if logged in | ||
window.Balanced.Auth.getCurrentLogin().always(function() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
es5 is now turned on by default in jshint. (it complains if we leave
true
in there)