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.

https://stackoverflow.com/a/33024388/1633757


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -