From 76d24a4e9701fd929ea3e4f5d36d781b2744881c Mon Sep 17 00:00:00 2001 From: "John (Andy) Ryan" Date: Thu, 5 Sep 2024 17:05:39 -0400 Subject: [PATCH] Updating the README to callout interim solution in test-helper.js --- README.md | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index b23ee50..61bf7c4 100644 --- a/README.md +++ b/README.md @@ -77,15 +77,33 @@ let app = new EmberAddon(defaults, { }); ``` +config/environment.js: +```js +APP: { + // ... + isRunningWithServerArgs: process.argv.includes('--server') || process.argv.includes('-s') +} +``` + tests/test-helpers.js: ```js import { forceModulesToBeLoaded, sendCoverage } from 'ember-cli-code-coverage/test-support'; import Qunit from 'qunit'; -QUnit.done(async function() { - forceModulesToBeLoaded(); - await sendCoverage(); -}); +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); + }); +} ``` ## Usage