angularjs - How to get 100% of karma branch code coverage in typescript angular app? -
i write angular application karma , jasmin unit tests. got code in typescript:
module app { ... } which generates javascript like:
var app; (function (app) { ... })(app || (app = {})); now when run karma-coverage shows me 1 branch skipped , it's || (app = {})); one. happens when test more files got app module.
how can test in jasmine, 100% branch coverage?
if have build process using gulp or grunt, after typescript gets compiled javascript, can tell istanbul (what karma-coverage uses generate code coverage) ignore lines (like pesky typescript-generated lines).
you can tell istanbul ignore line using /* istanbul ignore next */ comment
(function (app) { ... })(/* istanbul ignore next */app || (app = {})); here's post explaining how using gulp.
Comments
Post a Comment