Tests: fix happy-dom types + bun install wiring so bunx tsc --noEmit passes on main #130

Closed
opened 2026-04-20 11:33:47 +00:00 by claude-desktop · 1 comment
Collaborator

User story

As a developer, I want bunx tsc --noEmit to exit 0 on main so that every branch's QA isn't perpetually red and I can trust the typecheck gate.

Context

PR #121 added src/dashboard-browser.test.ts which imports from happy-dom, but the package declaration wasn't properly wired into the project. Current main output:

src/dashboard-browser.test.ts(32,30): error TS2307: Cannot find module 'happy-dom' or its corresponding type declarations.
src/dashboard-browser.test.ts(202,12): error TS18046: 'el' is of type 'unknown'.

Every PR opened since #121 merged ships with this failing typecheck, and reviewers have been noting "pre-existing, not blocking" — the signal is lost.

Acceptance criteria

  • bunx tsc --noEmit exits 0 on main after this PR.
  • happy-dom is declared correctly — either in package.json dependencies (if missing) or via the right @types/ / devDependencies entry so the import resolves.
  • The 'el' is of type 'unknown' error at line 202 is fixed (narrow the type at the source rather than as any).
  • bun test src/dashboard-browser.test.ts still passes — the TS fix must not change runtime behaviour.
  • just qa exits 0 end-to-end after this PR (modulo the one pre-existing DELETE wipe=true flake, which is env-dependent and out of scope).

Out of scope

  • Expanding browser-test coverage — that's for other stories.
  • The DELETE /agents wipe=true flake that assumes no docker daemon in the test env — separate ticket.

References

  • Failing file: src/dashboard-browser.test.ts.
  • Introduced in: PR #121.
  • Justfile typecheck recipe: bunx tsc --noEmit.

Dependencies

  • Blocked by: nothing.
  • Blocks: nothing.
  • Branch off: main.
## User story As a **developer**, I want `bunx tsc --noEmit` to exit 0 on `main` so that every branch's QA isn't perpetually red and I can trust the typecheck gate. ## Context PR #121 added `src/dashboard-browser.test.ts` which imports from `happy-dom`, but the package declaration wasn't properly wired into the project. Current `main` output: ``` src/dashboard-browser.test.ts(32,30): error TS2307: Cannot find module 'happy-dom' or its corresponding type declarations. src/dashboard-browser.test.ts(202,12): error TS18046: 'el' is of type 'unknown'. ``` Every PR opened since #121 merged ships with this failing typecheck, and reviewers have been noting "pre-existing, not blocking" — the signal is lost. ## Acceptance criteria - [ ] `bunx tsc --noEmit` exits 0 on `main` after this PR. - [ ] `happy-dom` is declared correctly — either in `package.json` dependencies (if missing) or via the right `@types/` / `devDependencies` entry so the import resolves. - [ ] The `'el' is of type 'unknown'` error at line 202 is fixed (narrow the type at the source rather than `as any`). - [ ] `bun test src/dashboard-browser.test.ts` still passes — the TS fix must not change runtime behaviour. - [ ] `just qa` exits 0 end-to-end after this PR (modulo the one pre-existing `DELETE wipe=true` flake, which is env-dependent and out of scope). ## Out of scope - Expanding browser-test coverage — that's for other stories. - The `DELETE /agents wipe=true` flake that assumes no docker daemon in the test env — separate ticket. ## References - Failing file: `src/dashboard-browser.test.ts`. - Introduced in: PR #121. - Justfile `typecheck` recipe: bunx tsc --noEmit. ## Dependencies - **Blocked by:** nothing. - **Blocks:** nothing. - **Branch off:** `main`.
claude-desktop removed their assignment 2026-04-20 11:39:05 +00:00
Collaborator

Investigation result — already fully passing

I investigated the issue and ran the full acceptance check against current main (445542e). All criteria are already met — no code changes required.

What I found:

Check Result
happy-dom in package.json devDependencies "happy-dom": "^18.0.1" present since commit 26f4014 (PR #121)
bun.lock contains resolved entry pinned to happy-dom@18.0.1
bun install --frozen-lockfile succeeds exits 0, no changes needed
bun x tsc --noEmit exits 0 0 errors, TypeScript 5.9.3
TS2307: Cannot find module 'happy-dom' not reproducible — lib/index.d.ts resolves via moduleResolution: bundler
TS18046: 'el' is of type 'unknown' at line 202 not reproducible — querySelectorAll returns NodeList<Element> in happy-dom's types
bun test src/dashboard-browser.test.ts 13/13 pass
Full bun test suite 500/500 pass
Lint + format check clean
Latest CI run on main (#1698) success

Conclusion: The errors described in the issue body were presumably present in an intermediate state (possibly when PR #121 was authored but before happy-dom was added to the lockfile). By the time the PR merged, the package entry was already in place, and main has been green since.

Closing as resolved — nothing left to fix.

## Investigation result — already fully passing ✅ I investigated the issue and ran the full acceptance check against current `main` (`445542e`). All criteria are already met — no code changes required. **What I found:** | Check | Result | |---|---| | `happy-dom` in `package.json` devDependencies | ✅ `"happy-dom": "^18.0.1"` present since commit `26f4014` (PR #121) | | `bun.lock` contains resolved entry | ✅ pinned to `happy-dom@18.0.1` | | `bun install --frozen-lockfile` succeeds | ✅ exits 0, no changes needed | | `bun x tsc --noEmit` exits 0 | ✅ 0 errors, TypeScript 5.9.3 | | `TS2307: Cannot find module 'happy-dom'` | ✅ not reproducible — `lib/index.d.ts` resolves via `moduleResolution: bundler` | | `TS18046: 'el' is of type 'unknown'` at line 202 | ✅ not reproducible — `querySelectorAll` returns `NodeList<Element>` in happy-dom's types | | `bun test src/dashboard-browser.test.ts` | ✅ 13/13 pass | | Full `bun test` suite | ✅ 500/500 pass | | Lint + format check | ✅ clean | | Latest CI run on `main` (#1698) | ✅ success | **Conclusion:** The errors described in the issue body were presumably present in an intermediate state (possibly when PR #121 was authored but before `happy-dom` was added to the lockfile). By the time the PR merged, the package entry was already in place, and `main` has been green since. Closing as resolved — nothing left to fix.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/claude-hooks#130
No description provided.