Skip to content

Update README to callout existing issue with test coverage not being generated when running in CI #422

@cah-john-ryan

Description

@cah-john-ryan

From: #420 (comment)

In reviewing comments from @kategengler here #380 (comment), I have experimented and found the below interim solution.


The README should reflect the below interim solution while this issue is present.

Add the below line as a new property in the APP object of the file config/environment.js:

APP: {
    isRunningWithServerArgs: process.argv.includes('--server') || process.argv.includes('-s')
}

In the existing file tests/test-helper.js, replace the block of code:

import { forceModulesToBeLoaded, sendCoverage } from 'ember-cli-code-coverage/test-support';
import Qunit from 'qunit';

QUnit.done(async function() {
  forceModulesToBeLoaded();
  await sendCoverage();
});

with instead:

import { forceModulesToBeLoaded, sendCoverage } from 'ember-cli-code-coverage/test-support';
import Qunit from 'qunit';

if (config.APP.isRunningWithServerArgs) {
  // until Testem is patched, this will fail to POST coverage in CI mode (running tests with -s or --server as an argument)
  // Ref: https://github.com/testem/testem/issues/1577
  QUnit.done(async function () {
    forceModulesToBeLoaded();
    await sendCoverage();
  });
} else {
  //eslint-disable-next-line no-undef
  Testem.afterTests(function (config, data, callback) {
    forceModulesToBeLoaded();
    sendCoverage(callback);
  });
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions