javascript - Code coverage on multiple files -


i have application in node.js using mocha framework . have 2 javascript source files ,for want take code coverage (viz a.js , b.js). using istanbul purpose .

here problem not getting how take code coverage multiple files . using following format :

istanbul cover node_modules/mocha/bin/_mocha a.js    istanbul cover node_modules/mocha/bin/_mocha a.js b.js  

but unfortunately both commands giving same code coverage, think taking a.js code . there solution finding code coverage multiple files?

the problem here how arguments istanbul being parsed.

assuming mocha a.js b.js works expect, should equivalent istanbul command:

istanbul cover node_modules/mocha/bin/_mocha -- a.js b.js 

istanbul split arguments @ -- , pass ones on right node script on left. once working correctly, istanbul's coverage reports work correctly.

an improvement on top of give mocha directory instead of explicit filenames, if possible. way, code not have change if filenames change.

you can make coverage easier using intern.js testing, uses istanbul , instruments of code automatically little setup.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -