Ember CLI and code coverage

家住魔仙堡 提交于 2019-12-03 16:08:52

问题


Has anyone managed to get code coverage working with an Ember CLI project?

I've tried using blanket.js and istanbul, as have others here, here and here, neither with any success. I've managed to get each to actually produce a coverage report but the report either says 0% (istanbul) or 100% (blanket.js), and there's no way the current tests provide 100% coverage.

The built project JavaScript file that Ember CLI produces contains all of the project's source files with each file's contents being output onto one, sometimes massive, line. So even if the coverage tool was able to produce the actual coverage metrics for the code in the built file there's then the issue of viewing the results. God only knows how you would link this back to the original source files?

Ember CLI is great and seems popular so I'm surprised more people haven’t had this issue. Perhaps others aren't as bothered by code coverage or maybe most just get it working without issue and I'm missing something.


回答1:


AFAIK, ember-cli-code-coverage provides the most accurate and easy to configure solution for coverage in ember-cli applications.It creates readable coverage reports for each file in the app/ directory. It is based on istanbul.




回答2:


I tried this, made some progress but couldn't get it to work.

This was the main resource:

https://github.com/airportyh/testem/tree/master/examples/coverage_istanbul

EDIT 1:

Was inspired to give it another try, and made some honest to goodness progress. Will throw up a gist and post a link




回答3:


ember-cli-blanket was released last month, seems to do a decent job.



来源:https://stackoverflow.com/questions/26337199/ember-cli-and-code-coverage

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!