diff --git a/.eslintrc.js b/.eslintrc.js index 6ce7d2050..6fe7931d9 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -31,7 +31,9 @@ module.exports = { 'n/no-unpublished-require': [ 'error', { - allowModules: ['resolve'], + // devDependencies required from index.js: `resolve` for asset paths, ember-cli-code-coverage + // only behind `COVERAGE=true` (see coverageBabelPlugin in index.js). + allowModules: ['resolve', 'ember-cli-code-coverage'], }, ], }, diff --git a/.github/workflows/ember.yml b/.github/workflows/ember.yml index cbdfe270f..c92240402 100644 --- a/.github/workflows/ember.yml +++ b/.github/workflows/ember.yml @@ -37,8 +37,54 @@ jobs: - name: Build run: pnpm run build + test: + name: Test with coverage + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Node.js ${{ env.NODE_VERSION }} + uses: actions/setup-node@v2 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Setup pnpm + uses: pnpm/action-setup@v2.0.1 + with: + version: latest + + - name: Install Dependencies + run: pnpm install + + - name: Coverage gate self-test + run: pnpm run coverage:selftest + + - name: Run full test suite with coverage + run: pnpm run test:coverage + + - name: Enforce 100% coverage gate + run: pnpm run coverage:check + + - name: Verify LCOV report exists + if: always() + run: test -s coverage/lcov.info || (echo 'coverage/lcov.info missing or empty' && exit 1) + + # `if: always()` is deliberate: the gate above fails the build, but Codecov must still receive + # this run's report. The backend workflow gates before uploading without it, and Codecov saw + # nothing at all for this repo until that suite went green. + - name: Upload coverage to Codecov + if: always() + uses: codecov/codecov-action@v5 + with: + files: coverage/lcov.info + flags: frontend + fail_ci_if_error: false + disable_search: true + token: ${{ secrets.CODECOV_TOKEN }} + npm_publish: - needs: build + needs: [build, test] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: @@ -67,7 +113,7 @@ jobs: run: npm publish --access public github_publish: - needs: build + needs: [build, test] runs-on: ubuntu-latest if: startsWith(github.ref, 'refs/tags/') steps: diff --git a/.gitignore b/.gitignore index b490dd1d3..eebc3ecff 100644 --- a/.gitignore +++ b/.gitignore @@ -37,3 +37,15 @@ composer.lock *.swp *.swo .DS_Store + +# coverage +# `/coverage/` above covers the normal case; these guard the reports istanbul writes for +# workspace-linked siblings, whose relative paths resolve out of the coverage folder and into the +# package root (see tests/dummy/config/coverage.js). +/ember-core/ +/ember-ui/ +/fleetops-data/ +/*/addon/**/*.js.html + +# Written by scripts/stamp-coverage-run.js; proves the coverage artifacts belong to the last run +.coverage-run-stamp.json diff --git a/.stylelintignore b/.stylelintignore index 29348e27a..831d3d8a8 100644 --- a/.stylelintignore +++ b/.stylelintignore @@ -10,3 +10,6 @@ # server /server/ /server_vendor/ + +# generated coverage report +/coverage/ diff --git a/COVERAGE-PROGRESS.md b/COVERAGE-PROGRESS.md new file mode 100644 index 000000000..b80c1bccd --- /dev/null +++ b/COVERAGE-PROGRESS.md @@ -0,0 +1,521 @@ +# Coverage campaign ledger — `addon/` + +One block per loop iteration. The next iteration reads the last `Next:` line first. + +Runner facts (re-verified 2026-09-03): a full `pnpm run test:coverage` takes ~13–20 min here. Headless +`ember test --path ` does not connect on this machine; `ember test --path --server` plus +the browser pane works for single-test diagnosis only (the pane tab is hidden, so Chrome throttles +its timers and anything that polls `settled()` looks hung). Build an eager dist with +`EMBER_ENV=test ember build --environment=test --output-path=` (see `index.js`). + +## 2026-09-03 — iteration 1 (Phase A: wiring + baseline) +Statements 3213/18831 (17.1%) · Branches 1862/12335 (15.1%) · Functions 1092/5526 (19.8%) · Lines 3123/17868 (17.5%) — tests 832: 502 pass / 330 fail +Did: wired ember-cli-code-coverage 3.1.0 + ember-window-mock; ported tests/dummy/config/coverage.js, scripts/{stamp-coverage-run,check-coverage,check-coverage-test}.js, Testem.afterTests upload, package scripts, codecov.yml (backend+frontend flags, carryforward), ember.yml "Test with coverage" job, README frontend badge, DEFECTS.md. Baseline was 775/827 red; fixed eight harness root causes (DEFECTS #1–#3, #5–#8: undeclared tracked-built-ins, host-console module shims, initializer test paths, ember-intl locale hydration, dummy `file` model, testem bail_on_uncaught_error, fetch `config.API`), added 6 missing app/ re-export stubs, QUnit per-test timeout. +Next: Phase B. Real numbers: 530/746 addon files have gaps, 216 are already at 100%. Largest gaps by dir: services/map-adapter (2880 missing; google.js 1889, leaflet.js 991), components/map (1563), components/modals (1368), components/order (1332), controllers/connectivity (1198), components/customer (1094), controllers/operations (1037), components/orchestrator (989). Start with the 330 red tests: fix the real (non-scaffold) failures first — layout/fleet-ops-sidebar (18 tests, several red on `.next-sidebar-navigator-*` selectors), then replace scaffolds in one directory at a time (cell/*, then order/*). Do not start with map-adapter/google.js (1889 stmts, needs a Google Maps stub) until a fake `google.maps` harness exists. +Notes: gate output on the validated run: 1967 per-file failures + 3 files absent from the report (addon/components/order/details/proof.js, addon/helpers/format-duration.js, addon/helpers/is-active-route.js — first small task next iteration: find out why they never load; probably no app/ re-export and a module that throws on evaluation). Coverage plumbing traps found this iteration — ember-cli-code-coverage 3.x needs `buildBabelPlugin()` wired explicitly, and for an ember-engines `buildEngine` addon the `babel` key must be TOP-LEVEL in the buildEngine config (it becomes `this.options`); the `json` reporter must be requested explicitly or coverage-final.json is never written. 223 blueprint scaffolds never green (DEFECTS #4). Host-console models the addon queries but no package ships (category, comment, custom-field, report, schedule*, user) need dummy stand-ins as tests reach them. `ember test --path` headless connect failure unresolved (see memory note); don't burn time on it. + +## 2026-09-03 — iteration 2 (Phase B: layout/fleet-ops-sidebar module green) +Statements 3219/18856 (17.07%) · Branches 1863/12356 (15.07%) · Functions 1095/5532 (19.79%) · Lines 3128/17890 (17.48%) — tests 832: 513 pass / 319 fail (+11) +Did: made all 20 real tests in tests/integration/components/layout/fleet-ops-sidebar-test.js pass (was 13 red). Root causes were test-side: ember-ui's navigator renders the nested back control as a sibling `