test(perf): type-check the whole electron-backend-e2e project (#1869)

* test(e2e): fix type errors in four Electron E2E specs

- category-management: the poll's message and 15 s timeout were passed to
  toBe(), which takes one argument, so the poll ran with the default 10 s
  timeout and message. Pass them to expect.poll().
- settings: evaluate<void, HTMLVideoElement> set the argument type, not the
  element type; type the callback parameter instead.
- remote-control: keep the poll callback's writes visible to the return and
  fail with a clear error instead of casting null.
- downloads: read the dataset key through its index signature.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(perf): fix type errors in the benchmark harness

None of these changes behaviour for a capture the harness produces today:

- cancellation report: a null playlist id on the request record now means
  unknown, like undefined, instead of matching only null DB records.
- main capture: type the worker transport map so its unavailable-reason
  literals stay narrow.
- worker request performance: a parsed capture carries non-null work
  timestamps; only the unavailable fallback reports null.
- Xtream iteration: hand the teardown closure the narrowed app and data
  directory.
- Xtream exact schema: return early when the identity is not an exact
  record instead of re-checking it three times.
- Xtream assembly: reject an unpainted UI explicitly; the null-to-0
  comparison already rejected it.
- Xtream scenario driver: drop the always-null cancellation observer from
  prepare; trigger() installs it.
- Electron process lifecycle: type the child process by the exit
  subscription it uses, so a test double need not return a ChildProcess.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(perf): fix type errors in the benchmark harness specs

The dynamically imported helpers were checked with
assert.equal(typeof fn, 'function'), which does not narrow, so later calls
used fn?.(). assert.ok(typeof fn === 'function') narrows them. The rest
types fixtures by the module under test, keeps closure-assigned callbacks
visible after their callbacks run, and narrows nullable fixture values.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(perf): type-check the whole electron-backend-e2e project

Widen the spec config's include from the journey harness to src/**/*.ts
and the root Playwright configs, with no baseline or ignore list, and
update the validation map and the journey checklist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* test(perf): build a complete renderer fixture in the request-performance spec

The fixture was cast through unknown, so the type check accepted an
incomplete RendererCaptureMetrics. Fill every required field with neutral
values; the summary reads only the probe arrays and heap fields.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 5.5 authored and GitHub committed 2026-10-10 14:33:15 +02:00
1 parent 6e18983400
commit 078b91bfdf
36 files changed
+229 -165

No files matched your search

+2 -3
View File
@@ -1507,9 +1507,8 @@ detail 187 to 143 MB.
`node:test` (`pnpm nx run electron-backend-e2e:test-performance-harness`).
`tsx` runs those specs without type checking, so also run
`pnpm run typecheck:spec electron-backend-e2e`. Its
`apps/electron-backend-e2e/tsconfig.spec.json` includes `src/journeys/**`
and `src/performance/*journey*.ts`; keep `journey` in the name of the
journey's files and specs under `src/performance/`.
`apps/electron-backend-e2e/tsconfig.spec.json` includes every TypeScript
file in the project, so a new journey file needs no `include` change.
6. Validate a counter before it becomes a guardrail: one PR must show that
lowering it moved wall-clock in the same journey.
+4 -5
View File
@@ -63,10 +63,9 @@ whose types drifted from the code it exercises. CI runs it in the
the harness's `import.meta`, BigInt literals and ES2022 library names. It
also sets `types: ["node"]`: the specs import `describe` and `it` from
`node:test`, so a Jest or Mocha global fails the check. Its `include` covers
the journey harness (`src/performance/*journey*.ts` and `src/journeys/**`);
the older benchmark files and the Electron E2E specs still have type errors,
so widen the `include` as they are fixed instead of adding a baseline or an
ignore list.
the whole project (`src/**/*.ts` and the root Playwright configs): the
journey harness, the benchmark harness and its specs, and the Electron E2E
specs, with no baseline or ignore list.
- Type test doubles instead of casting to `any`: `jest.Mocked<T>`,
`InstanceType<typeof SomeStore>` for signal stores, and
`Object.defineProperty` or a writable mapped type for read-only capability
@@ -331,7 +330,7 @@ written to the same summary file; its probe specs run with
`pnpm nx run electron-backend-e2e:test-performance-harness`, which CI runs in
the `Unit Tests and Typechecks` job of `ci.yml` on every run. `tsx` runs them
without type checking; `pnpm run typecheck:spec electron-backend-e2e` checks
the journey harness (see Unit And Type Checks). The
the whole project, those specs included (see Unit And Type Checks). The
`electron-backend-e2e` command targets call `tsx` and `playwright` directly,
not through `pnpm exec`: under `pnpm nx`, a nested `pnpm exec` can run from the
workspace root instead of the target `cwd` and miss cwd-relative specs, globs