ember-cli-nacho-coverage

raw JSON →
1.0.2 verified Fri May 01 auth: no javascript

Code coverage addon for Ember apps using Istanbul. Current version 1.0.2 (last release). Works with any transpiler. Supports Mocha, Mirage, Pretender. Configurable via ember-cli-build.js. Key differentiators: uses Istanbul instead of Blanket, instruments code during build, parallel testing support via ember-exam, and passthrough for Ajax interception. Requires Testem >=1.6.0 for Mocha, and appropriate versions of Mirage/Pretender.

error Error: Could not find module `ember-cli-nacho-coverage`
cause Missing addon installation or version incompatibility.
fix
Run 'ember install ember-cli-nacho-coverage' again.
error TypeError: Cannot read property 'passthrough' of undefined
cause Mirage passthrough not configured correctly.
fix
Add this.passthrough('/write-coverage') in mirage/config.js before setting namespace.
error Coverage report not generated even with COVERAGE=true
cause Environment variable not properly set or test framework incompatibility.
fix
Ensure COVERAGE=true is set before running ember test. Check Testem version.
gotcha When using Mirage or Pretender, you must set up a passthrough for /write-coverage. The passthrough must appear before the namespace setup in Mirage config.
fix In mirage/config.js: this.passthrough('/write-coverage'); before setting namespace.
gotcha If using Mocha, Testem must be >=1.6.0 and ember-cli >2.4.3.
fix Upgrade Testem and ember-cli as needed.
gotcha The json-summary reporter is always added regardless of configuration. Do not remove it.
fix Just include other reporters; json-summary is automatic.
gotcha Parallel testing requires using ember coverage-merge after tests to combine reports.
fix Run 'ember coverage-merge' after parallel tests.
npm install ember-cli-nacho-coverage
yarn add ember-cli-nacho-coverage
pnpm add ember-cli-nacho-coverage

Shows install, config, and usage of ember-cli-nacho-coverage with environment variable.

// Step 1: Install the addon
// ember install ember-cli-nacho-coverage

// Step 2: Configure in ember-cli-build.js (optional)
module.exports = {
  coverageEnvVar: 'COVERAGE',
  reporters: ['lcov', 'html'],
  excludes: ['*/mirage/**/*'],
  coverageFolder: 'coverage',
  parallel: false
};

// Step 3: Run tests with coverage enabled
// COVERAGE=true ember test

// For parallel testing:
// ember exam --parallel
// ember coverage-merge