Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Commit 7604aa7

Browse files
committed
Merge pull request #287 from douglasduteil/test-add-karma-coverage-info
test: add karma coverage info
2 parents 40556a9 + b254e77 commit 7604aa7

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules
22
bower_components
33
tmp
4+
coverage

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ _Also, please don't edit files in the "dist" subdirectory as they are generated
123123

124124
- You can use the `--polyfill` option to test the code with polyfill.
125125

126+
- You can use the `--coverage` option to test and extract coverage info.
127+
126128
- You can use the `--ie8` option to test the code in the ie8 scope only.
127129

128130
- You can use the `--saucelabs` option to use karma and saucelabs to run the tests in various browsers.

karma.conf.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ var options = extend({
1717
travis: process.env.TRAVIS,
1818
polyfill: false,
1919
saucelabs: false,
20-
ie8: false
20+
ie8: false,
21+
coverage: false
2122
}, argv);
2223

2324
if (options.ie8){
@@ -56,6 +57,20 @@ module.exports = function (config) {
5657
browsers: ['Chrome', 'Firefox']
5758
});
5859

60+
if (options.coverage) {
61+
config.set({
62+
reporters: ['mocha', 'coverage'],
63+
preprocessors: {
64+
'dist/es6-module-loader*.src.js': ['coverage']
65+
},
66+
coverageReporter: {
67+
type : 'html',
68+
dir : 'coverage/'
69+
},
70+
browsers: ['Chrome']
71+
});
72+
}
73+
5974
if (options.travis) {
6075
// TRAVIS config overwrite
6176
config.set({

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"karma-benchmark": "^0.4.0",
3535
"karma-benchmark-reporter": "^0.1.1",
3636
"karma-chrome-launcher": "^0.1.7",
37+
"karma-coverage": "^0.2.7",
3738
"karma-expect": "^1.1.0",
3839
"karma-firefox-launcher": "^0.1.3",
3940
"karma-mocha": "^0.1.10",

0 commit comments

Comments
 (0)