Skip to content

Commit ee07267

Browse files
committed
chore(tests): add debug mode for Karma tests
1 parent 218e305 commit ee07267

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ See [.jshintrc](.jshintrc) for the [JSHint](http://jshint.com) conventions (use
5454

5555
Run `grunt test` in-between commits to check JS style and the code is working.
5656

57-
Always run `grunt` before a commit as it runs `grunt test` and builds the distributions files.
57+
Always run `grunt` before a commit as it runs `grunt test` and builds the distributions files. Use `npm run debug` to run Karma tests in debug mode using Chrome.
5858

5959
Never commit if `grunt` gives an error!
6060

karma.conf.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22
// http://karma-runner.github.io/0.10/config/configuration-file.html
33

44
module.exports = function(config) {
5+
var sourcePreprocessors = ['coverage'];
6+
function isDebug(argument) {
7+
return argument === '--debug';
8+
}
9+
if (process.argv.some(isDebug)) {
10+
sourcePreprocessors = [];
11+
}
12+
513
config.set({
614
// base path, that will be used to resolve files and exclude
715
basePath: '',
@@ -16,7 +24,7 @@ module.exports = function(config) {
1624
// source files, that you wanna generate coverage for
1725
// do not include tests or libraries
1826
// (these files will be instrumented by Istanbul)
19-
'app/scripts/**/*.js': ['coverage']
27+
'app/scripts/**/*.js': sourcePreprocessors
2028
},
2129

2230
// list of files / patterns to load in the browser

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
},
4646
"scripts": {
4747
"postinstall": "bower install",
48-
"test": "grunt test"
48+
"test": "grunt test",
49+
"debug": "./node_modules/.bin/karma start karma.conf.js --browsers=Chrome --debug --autoWatch=true"
4950
}
5051
}

0 commit comments

Comments
 (0)