Commit 76bd448
test(client/web): fix happy-dom global-document setup (18 pre-existing fails → 0)
The client/web test suite had 18 pre-existing failures when run from the
client/web/ root: every `@testing-library/dom` `screen.*` call threw
"a global document has to be available". Root cause: Bun only honours the
bunfig.toml in the cwd it is invoked from, so the per-package preloads that
install a JSDOM `document` never fired when `bun test` was run from
client/web/.
Fix:
- Added client/web/bunfig.toml that preloads the existing per-package JSDOM
setup (reused from packages/react/ so that `jsdom` resolves through that
package's node_modules).
- Made the per-package test/setup.ts files idempotent so the per-test-file
`import "./setup.js"` does not replace globalThis.document after
`@testing-library/dom`'s `screen` module has already captured it (which had
been silently rebinding `screen` to an orphaned, empty document body).
Verified: `bun test` from client/web/ now reports 84 pass + 0 fail (was
66 pass + 18 fail). Each package's `bun test` continues to pass when run
from its own directory (react 12, tanstack 29, runtime-web 30, angular 13).
Purely test-infrastructure — no runtime behaviour change.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 7b47338 commit 76bd448
3 files changed
Lines changed: 31 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
0 commit comments