Sunday, 15 August 2010

How to setup Karma runner code coverage? -


I am trying to get the karmic runner to produce the Corbettura Format Code coverage report during Jenkins Build. I can get it to generate an coverage.xml file, but it does not actually contain any coverage data (using the LOG_DEBUG ) that the preprocessor coverage is not running .

There are pieces related to my karma.conf.js file:

  files = [Jasmine, JASMINE_ADAPTER, 'App / components / angle / Angular Js ',' ap / factor / angular-socks / angular-mocks.js ',' tmp / script / ** /*.js ',' tmp / spec / ** / *. Js']; Preprocessor = {'TMP / Script / ** / *. JS ':' coverage '}; // test result reporter // to use possible values: 'dots', 'progress', 'junit' journalists = ['dots', 'junit', 'coverage']; JunitReporter = {outputFile: 'test-results.xml'}; CoverageReporter = {Type: 'Cobertura', DIR: 'Coverage /', File: 'Coverage. Xml '};   

(Junit report is generating a fine.)

Apparently I had thought more literally than my preprocessor configuration

  preprocessors = {'** / tmp / script / ** / *. JS: 'Coverage'};   

(note the earlier ** / ) did the trick. I'm not sure why syntax is different for files array and preprocessor object ( 'tmp / scripts / ** / * .js' Vs '** / tmp / scripts / ** / *. Js' ).

No comments:

Post a Comment