3

The documentation for the ember-cli-code-coverage project on Github does not clearly state how exactly to configure and run coverage reports.

The documentation hints that, after installing the addon, you just need to set an environment variable named COVERAGE to true. I interpret that to mean an environment variable in config/environment.js. After running the CLI command ember test I expect to find something saved in a coverage folder at the root of the project, but nothing appears to be generated. My tests run okay without any errors, and with all passing tests.

There are a few statements on Stackoverflow (here, here, and here) that suggest the package works okay. Searching for clear examples or how-to articles appears to be a dead end at the present moment.

I'm trying to get this working using versions:

  • Ember.js 2.6.0
  • ember-cli-code-coverage 0.2.2
  • Windows 10
Community
  • 1
  • 1
JonH
  • 261
  • 3
  • 12

1 Answers1

1

You need to set the environment variable in the command line environment, not the Ember environment. Run COVERAGE=true ember test.

Side-note: this does seem like a weird choice, requiring a command line environment variable instead of making it configurable in other ways the way ember-cli-blanket does.

fourthnen
  • 194
  • 2
  • 9
  • env variable makes it easier to run on CI server imo. after you run this command, there will be a coverage folder in the root of your project, open the index.html file there to see your coverage stats visually – ianstarz Jul 13 '17 at 01:39