Skip to content

Modular logistics and supply chain operating system (LSOS)

fix(console): make coverage reporting work with the scoped modulePrefix

Ronald A. Richardsonfddd6117c242
diff --git a/console/config/coverage.js b/console/config/coverage.js
index e2c28811..3d87d584 100644
--- a/console/config/coverage.js
+++ b/console/config/coverage.js
@@ -1,5 +1,7 @@
'use strict';
+const path = require('path');
+
// Configuration for ember-cli-code-coverage.
// Coverage is only instrumented when the COVERAGE env var is truthy
// (e.g. `COVERAGE=true ember test` / `pnpm test:ember:coverage`), so it never
@@ -9,11 +11,34 @@
// - lcov → coverage/lcov.info (uploaded to Codecov)
// - json-summary → coverage/coverage-summary.json (read by scripts/coverage-check.mjs)
// - text-summary → printed to the console
+//
+// NOTE: instrumentation also requires ember-cli-build.js to spread
+// `require('ember-cli-code-coverage').buildBabelPlugin()` into its babel plugins, and
+// tests/test-helper.js to post window.__coverage__ on QUnit.done. The addon does neither
+// automatically.
+
+// This app's modulePrefix is scoped ('@fleetbase/console'), which the addon does not
+// handle: adjustCoverageKey() takes only the FIRST path segment as the namespace
+// ('@fleetbase'), so it never matches the mapping registered under the full prefix. Every
+// file then resolves to <root>/@fleetbase/console/... , fails the addon's
+// "does this file exist in the project" check, and is dropped — yielding an empty report
+// with 0 files and "Unknown" percentages. modifyAssetLocation is the supported hook for
+// correcting the path; map the scoped prefix back onto app/.
+const MODULE_PREFIX = '@fleetbase/console/';
+
module.exports = {
- coverageEnvVar: 'COVERAGE',
- reporters: ['lcov', 'json-summary', 'text-summary'],
- // Exclude generated/vendor and test files from the coverage denominator.
- // app/extensions/** are auto-generated extension manifests (declarative config
- // written by the extensions generator) — not hand-written, testable logic.
- excludes: ['*/mirage/**', '*/tests/**', '**/*-test.js', '**/extensions/**'],
+ coverageEnvVar: 'COVERAGE',
+ reporters: ['lcov', 'json-summary', 'text-summary'],
+ // Exclude generated/vendor and test files from the coverage denominator.
+ // app/extensions/** are auto-generated extension manifests (declarative config
+ // written by the extensions generator) — not hand-written, testable logic.
+ excludes: ['*/mirage/**', '*/tests/**', '**/*-test.js', '**/extensions/**'],
+
+ modifyAssetLocation(root, relativePath) {
+ if (relativePath.startsWith(MODULE_PREFIX)) {
+ return path.join(root, 'app', relativePath.slice(MODULE_PREFIX.length));
+ }
+
+ return undefined;
+ },
};