Code coverage in CLI?


#1

I have tried ember-cli-blanket and it works sporadically and also works different in different projects. Do you know of any other options?


#2

Few well integrated tools to establish accurate code coverage for ember-cli apps exist. (something like Istanbul for everything in app/) We ended up avoiding ember-cli-blanket and writing a rudimentary istanbul integration with testem. Basically, it calls the istanbul cli against the single JS file output by ember build. Imprecise but consistent. If you find a better solution, please holler!


#3

Thanks for now I have configured ember-cli-blanket since I dont have time to look for any other solution. But will post later when we work on a better solution.


#4

you’re welcome! I’ll stay posted.


#5

This statement is no longer entirely accurate. For those stumbling upon this post, checkout @katiegengler’s https://github.com/kategengler/ember-cli-code-coverage. Gives you coverage via istanbul for the actual app/ tree files. Solves most of my problems for getting readable, meaningful coverage for an ember app.


#6

I have tried both ember-cli-blanket and ember-cli-code coverage, both works fine, but the ember-cli-code coverage looks great. since we have used Instanbul to instrument the None-ember based Javascript, I would like to use ember-cli-code coverage to instrument and deploy the instrumented app and use webdriver-io-mocha to test the app and generate coverage report. Has anybody done this and give me some pointer. Since I am new to Ember I am trying to understand how these two package hook in to ember test, some pointer here might help me understand it working.


#7

Hi @efx I tried using ember-cli-code-coverage but coverage report is not getting generated.

I installed ember-cli-code-coverage in my project.

then ran the test as :

COVERAGE=true ember test

Since just adding this was not working I added istanbul globally but event that does not work. Can anyone suggest me what exactly I am missing…


#8

honestly, I’m not sure the conditions that could cause your problem. If you are able, post the project’s repository with the exact configuration. Also be sure to have your project fit the requirements listed in ember-cli-code-coverage’s repository README. If there is a bug, you can open an issue here: https://github.com/kategengler/ember-cli-code-coverage/issues


#9

Thanks @efx for the reply

I have followed whatever is advised in readme.md. Due to urgency I have gone with ember-cli-blanket as it worked in the first shot. Since It is not actively maintained, I will switch to ember-cli-code-coverage later on.


#10

This may or may not be related to: https://github.com/kategengler/ember-cli-code-coverage/issues/39#issuecomment-262469354

I found that I was not getting coverage data with 0.2.3, but when I downgraded to 0.2.2, everything works as expected.


#11

Thanks @accelerate,

I will try and will let you know.