Ember CLI and code coverage
Asked Answered
E

3

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.

Extraterrestrial answered 13/10, 2014 at 9:55 Comment(1)
possible duplicate of Ember CLI Code Coverage ReportsAscertain
I
4

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.

Incunabulum answered 22/6, 2016 at 20:17 Comment(0)
A
1

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

Anacoluthia answered 21/10, 2014 at 15:44 Comment(1)
please do...i'm having a lot of trouble with this. istanbul doesn't seem to do anything when i run it with testem.Odilia
M
1

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

Monomorphic answered 6/1, 2015 at 10:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.