Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

ember-cli-nacho-coverage

igbopie5MIT1.0.2

Code coverage for ember projects using Istanbul regarless what transpiler you use.

ember-addon

readme

ember-cli-nacho-coverage

Code coverage using Istanbul for Ember apps that works with any transpiler.

Requirements

  • If using Mocha, Testem >= 1.6.0 for which you need ember-cli > 2.4.3
  • If using Mirage you need ember-cli-mirage >= 0.1.13
  • If using Pretender (even as a dependency of Mirage) you need pretender >= 0.11.0
  • If using Mirage or Pretender, you need to set up a passthrough for coverage to be written.

Installation

  • ember install ember-cli-nacho-coverage

Usage

Coverage will only be generated when an environment variable is true (by default COVERAGE) and running your test command like normal.

For example:

COVERAGE=true ember test

If you want your coverage to work on both Unix and Windows, you can do this:

npm install cross-env --save-dev

and then:

cross-env COVERAGE=true ember test

When running with parallel set to true, the final reports can be merged by using ember coverage-merge. The final merged output will be stored in the coverageFolder.

Configuration

Configuration is optional. Use ember-cli-build.js, as ember-cli-nacho-coverage.

Options

  • coverageEnvVar: Defaults to COVERAGE. This is the environment variable that when set will cause coverage metrics to be generated.

  • reporters: Defaults to ['lcov', 'html']. The json-summary reporter will be added to anything set here, it is required. This can be any reporters supported by Istanbul.

  • excludes: Defaults to ['*/mirage/**/*']. An array of globs to exclude from instrumentation. Useful to exclude files from coverage statistics.

  • coverageFolder: Defaults to coverage. A folder relative to the root of your project to store coverage results.

  • parallel: Defaults to false. Should be set to true if parallel testing is being used, for example when using ember-exam with the --parallel flag. This will generate the coverage reports in directories suffixed with _<random_string> to avoid overwriting other threads reports. These reports can be joined by using the ember coverage-merge command (potentially as part of the posttest hook in your package.json).

  • includeTranspiledSources: Defaults to []. Should include a list of transpiled JavaScript source extensions to be included in the coverage instrumentation. However, the compiled output is what will be instrumented so this will only be a close approximation of the source coverage.

Example

  module.exports = {
    coverageEnvVar: 'COV'
  }

Create a passthrough when intercepting all ajax requests in tests

To work, this addon has to post coverage results back to a middleware at /write-coverage.

If you are using ember-cli-mirage you should add the following:

// in mirage/config.js

  this.passthrough('/write-coverage');
  this.namespace = 'api';  // It's important that the passthrough for coverage is before the namespace, otherwise it will be prefixed.

If you are using ember-cli-pretender you should add the following:

// where ever you set up the Pretender Server

  var server = new Pretender(function () {
    this.post('/write-coverage', this.passthrough);
  });

Inspiration

This addon was inspired by ember-cli-blanket. The primary differences are that this addon uses Istanbul rather than Blanket for coverage and it instruments your application code as part of the build, when enabled.

changelog

Change Log

v0.4.1 (2017-06-27)

Full Changelog

Merged pull requests:

v0.4.0 (2017-06-27)

Full Changelog

Closed issues:

  • Enabling coverage with enabled Babel plugin fails #123
  • ember coverage-merge does not merge the coverage report generated from different test type say unit and functional? #122
  • Running with COVERAGE=true generates additional tests that fail #114
  • Plugin fails with ember-cli 2.13 and useBabelInstrumenter: true #111
  • Parsing async/await crashes #108
  • Coverage failing with version 0.3.6 and up #75

Merged pull requests:

  • [Fixes #111] Update dependencies, get babel instrumenter working #115 (paulcwatts)
  • Improve ES7 error message #109 (sukima)

v0.3.12 (2017-04-08)

Full Changelog

Closed issues:

  • Cannot parse async/await #106
  • Produce coverage report if environment variable COVERAGE is set to true before running ember test #104
  • readable/accurate template reports with Glimmer2? #96
  • Question: option to fail a build if coverage result is below a given percentage? #95
  • CI hangs when updating 0.3.8 => 0.3.9 #88
  • new error in 0.3.7 #65
  • Work with ember test --server, not with ember test #57
  • How to view coverage files? #44
  • Use configPath instead of hard-coded "config" #42

Merged pull requests:

  • Fixes #42 use configPath instead of hard-coded config #100 (eddie-ruva)

v0.3.11 (2017-01-19)

Full Changelog

Closed issues:

  • ember-test never terminates with COVERAGE=true #81

Merged pull requests:

  • Move rsvp package to dependencies #94 (samtsai)
  • Add test for parallel configuration and coverage-merge command. #92 (jdenly)

v0.3.10 (2017-01-05)

Full Changelog

Closed issues:

  • What is the best way to wdio or selenium test on the instrumented code and the coveragae result #84
  • [Q]: What is the best way to integrate ember-cli-code-coverage with ember-exam #80
  • "Error: request aborted" on >= v0.3.0 #39

Merged pull requests:

  • Use synchronous control flow when making synchronous requests #87 (DingoEatingFuzz)
  • Add coverage-merge command and parallel configuration #83 (jdenly)

v0.3.9 (2016-12-22)

Full Changelog

Closed issues:

  • Excludes options for config/converage.js doesn't seem to work #78
  • conflict with yadda require() #66
  • The coverage summary json is missing a '}' in the end #47

Merged pull requests:

v0.3.8 (2016-11-07)

Full Changelog

Closed issues:

  • Handle app in addon case #70
  • Unify code to correct file names in coverage output #67
  • ESLint? #59

Merged pull requests:

v0.3.7 (2016-11-02)

Full Changelog

Closed issues:

  • Issue with ember-page-object #63

Merged pull requests:

  • Avoid throwing errors while requiring files for coverage. #64 (rwjblue)

v0.3.6 (2016-11-01)

Full Changelog

Closed issues:

  • Does not include untested files #20

Merged pull requests:

  • Factor in unused/unrequired files in to coverage % #62 (kategengler)

v0.3.5 (2016-10-31)

Full Changelog

Closed issues:

  • Addon Support: Properly name files in lcov.info #36

Merged pull requests:

  • Update README.md with Pretender example. #60 (HallDJack)
  • Add ability to pass addonName and fix paths #58 (rwwagner90)
  • Cosmetics for docs, renamed function name and parameter name #54 (nfc036)

v0.3.4 (2016-10-10)

Full Changelog

Closed issues:

  • Missing coverage information in top-level addons in 0.3.3. #53

Merged pull requests:

  • return actual name not function from _parentName #52 (nfc036)

v0.3.3 (2016-10-07)

Full Changelog

Closed issues:

  • Addon support: no coverage for addon files on Windows #48
  • No coverage when addon and package name don't match #45
  • Mocha phantom addon coverage issue in master causing a global error. #32

Merged pull requests:

  • Use posix paths for dealing with modules. #50 (rwjblue)
  • Handle addons with different package names #46 (dfreeman)

v0.3.2 (2016-09-19)

Full Changelog

Closed issues:

  • Integration components support #40
  • Addon tests never exit #37

Merged pull requests:

v0.3.1 (2016-09-15)

Full Changelog

Closed issues:

  • Add code coverage #34

Merged pull requests:

v0.3.0 (2016-09-14)

Full Changelog

Closed issues:

  • does not work with addons #26
  • Does not appear to work with decorators #25
  • No Coverage generated got following error #21
  • Support Addon Coverage #14

Merged pull requests:

  • Support Addon Coverage #31 (rwjblue)
  • Processed addon js files #30 (EWhite613)
  • Avoid requiring jQuery for sending the coverage report back. #24 (rwjblue)
  • Try catch around instrumenter. So it spits out a clearer error #22 (EWhite613)

v0.2.2 (2016-06-30)

Full Changelog

Closed issues:

  • Enabling useBabelInstrumenter results in "Unknown option: direct.includePolyfill" error #18
  • Should .hbs files be taken into account? #17

Merged pull requests:

  • Add includePolyfill to removed babel options. #19 (rwjblue)

v0.2.1 (2016-06-22)

Full Changelog

Closed issues:

  • Coverage is against transpiled ES5 Code #12

Merged pull requests:

  • Update ember-cli-release to allow easier releasing. #16 (rwjblue)
  • Report Correct Line Numbers for esnext #15 (sandersky)

v0.2.0 (2016-06-21)

Full Changelog

Closed issues:

  • paths in "lcov.info" don't relate to project setup #8
  • files from addons bleed into coverage results #7
  • Change config file name? #4

Merged pull requests:

  • Filter out files from addons, fix file paths, and rename config file #11 (sandersky)
  • Add ember-cli-mirage min version to README.md #3 (benoror)

v0.1.2 (2016-05-15)

Full Changelog

Closed issues:

  • Take over the 'ember-cli-istanbul' package? #6
  • Testem global not found #1

Merged pull requests:

  • Allow users config to override the default config. #5 (rwjblue)

v0.1.1 (2016-05-05)

Full Changelog

v0.1.0 (2016-05-03)

Full Changelog

v0.0.1 (2016-05-03)

* This Change Log was automatically generated by github_changelog_generator