fix(test): remove jsdom pragma + add window stub DOM surface
CI / ci (push) Canceled after 0s
CI / ci-windows (push) Canceled after 0s
CI / plugin-mount (push) Canceled after 0s

A/B fix per WorkBuddy review:
- browser-globals.ts: add addEventListener/removeEventListener/dispatchEvent
  to window stub, add compatMode to document stub
- Remove // @vitest-environment jsdom from 5 specs that only use
  renderToString/createElement (SSR, no DOM needed)

Test Files 131 passed (131), Tests 1367 passed, EXIT=0
This commit is contained in:
figmar
2026-10-11 20:01:21 +08:00
parent 2b8ba87d81
commit 5a715acb85
6 changed files with 6 additions and 5 deletions
+6
View File
@@ -41,6 +41,9 @@ if (g.document === undefined) {
querySelector: () => null,
querySelectorAll: () => [],
styleSheets: [],
// KaTeX probes compatMode at module load; without it it warns
// "doesn't work in quirks mode" and some layout paths no-op.
compatMode: 'CSS1Compat',
}
}
@@ -50,6 +53,9 @@ if (g.navigator === undefined) {
if (g.window === undefined) {
g.window = {
addEventListener: () => {},
removeEventListener: () => {},
dispatchEvent: () => true,
clearTimeout: () => {},
setTimeout: (_fn: () => void) => 0,
innerWidth: 1024,