Skip to content

Commit

Permalink
Added code coverage with istanbul / karma
Browse files Browse the repository at this point in the history
  • Loading branch information
goodbomb committed Jun 24, 2015
1 parent 697dba9 commit 57174aa
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Compiled Server Files
dist
reports

# Third Party Dependencies
bower_components
Expand Down
12 changes: 10 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,15 @@ gulp.task('server', function() {
// Clean out dist folder contents on build
// =======================================================================
gulp.task('clean-dev', function() {
del(['./dist/*.js', './dist/*.css', '!./dist/vendor.js', '!./dist/vendor.css', './dist/*.html', './dist/*.png', './dist/*.ico']);
del(['./dist/*.js',
'./dist/*.css',
'!./dist/vendor.js',
'!./dist/vendor.css',
'./dist/*.html',
'./dist/*.png',
'./dist/*.ico',
'./reports/**/*',
'./reports']);
});

gulp.task('clean-full', function() {
Expand Down Expand Up @@ -399,7 +407,7 @@ gulp.task('build-dev', function(callback) {
// run "gulp test" in terminal to build the DEV app
gulp.task('build-test', function(callback) {
runSequence(
['build'],
['build-dev'],
['karma'],
callback
);
Expand Down
7 changes: 3 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,14 @@ module.exports = function (config) {
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
'./app/**/*.js': ['browserify'],
'./app/**/!(*spec)*.js': ['coverage']
'./app/**/!(*spec)*.js': ['browserify']
},

// karma-browserify configuration

browserify: {
debug: true,
transform: ['debowerify'],
transform: ['debowerify', 'html2js-browserify', 'browserify-istanbul'],

// don't forget to register the extensions
extensions: ['.js']
Expand All @@ -47,7 +46,7 @@ module.exports = function (config) {

coverageReporter: {
type: 'html',
dir: './dist/reports/coverage'
dir: './reports/coverage'
},

// web server port
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"node": "0.10.38"
},
"scripts": {
"start": "node server.js",
"postinstall": "node_modules/.bin/bower install"
"start": "node server.js"
},
"browserify": {
"transform": [
Expand All @@ -27,6 +26,7 @@
"bower": "latest",
"browserify": "^9.0.3",
"browserify-shim": "^3.8.5",
"browserify-istanbul": "^0.2.1",
"chai": "^2.2.0",
"debowerify": "^1.2.1",
"del": "^0.1.3",
Expand Down

0 comments on commit 57174aa

Please sign in to comment.