Ember CLI and code coverage

2020-06-01 08:14发布

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.

3条回答
虎瘦雄心在
2楼-- · 2020-06-01 08:31

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

查看更多
孤傲高冷的网名
3楼-- · 2020-06-01 08:32

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

查看更多
对你真心纯属浪费
4楼-- · 2020-06-01 08:37

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.

查看更多
登录 后发表回答