I'm using Karma to do some unit testing and to generate code coverage stats. When i run the test from the command line without the code coverage settings in the karma config i can see the test results in the command line. i.e
Executed 3 of 3 SUCCESS (0.465 secs / 0.048 secs)
When I add the code coverage settings to the config and run the test, the coverage files get generated but i do not see the test results in the command line.
My config is:
basePath = '../';
files = [
JASMINE,
JASMINE_ADAPTER,
'https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.min.js',
'app/lib/angular/angular.js',
'app/lib/angular/angular-scenario.js',
'test/lib/angular/angular-mocks.js',
'app.js', // include app first as other module hang off it
'public/javascript/**/*.js',
'test/unit/**/*.js'
];
/* code coverage settings */
preprocessors = {
'**/public/javascript/**/*.js': 'coverage'
};
reporters = ['coverage'];
/* end code coverage settings */
autoWatch = true;
browsers = ['Chrome'];
junitReporter = {
outputFile: 'test_out/unit.xml',
suite: 'unit'
};
I could just create separate scripts to generate the code coverage and run the tests, and my be better off doing that in terms of speed etc, but I wanted to know if I could do them together, and if so have I miss configured something?
When you added the "coverage" reporter in your config it seems you removed the "progress" reporter that used to be there by default.
Just change the reporters part of your config to:reporters = ['coverage','progress']
instead of reporters = ['coverage']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With