fix(test): remove jsdom pragma + add window stub DOM surface
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:
1 parent
2b8ba87d81
commit
5a715acb85
6 files changed
+6
-5
No files matched your search
@@ -1,4 +1,3 @@
|
|||||||
// @vitest-environment jsdom
|
|
||||||
/**
|
/**
|
||||||
* apes:* tab registration tests (Phase 1/1b, C6: 3 tabs). The fork registers
|
* apes:* tab registration tests (Phase 1/1b, C6: 3 tabs). The fork registers
|
||||||
* its three information-layer tabs (agents / apps / profile) through the same
|
* its three information-layer tabs (agents / apps / profile) through the same
|
||||||
|
|||||||
@@ -41,6 +41,9 @@ if (g.document === undefined) {
|
|||||||
querySelector: () => null,
|
querySelector: () => null,
|
||||||
querySelectorAll: () => [],
|
querySelectorAll: () => [],
|
||||||
styleSheets: [],
|
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) {
|
if (g.window === undefined) {
|
||||||
g.window = {
|
g.window = {
|
||||||
|
addEventListener: () => {},
|
||||||
|
removeEventListener: () => {},
|
||||||
|
dispatchEvent: () => true,
|
||||||
clearTimeout: () => {},
|
clearTimeout: () => {},
|
||||||
setTimeout: (_fn: () => void) => 0,
|
setTimeout: (_fn: () => void) => 0,
|
||||||
innerWidth: 1024,
|
innerWidth: 1024,
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @vitest-environment jsdom
|
|
||||||
/**
|
/**
|
||||||
* Built-in registration tests: the plugin registers 7 tabs and 6 file
|
* Built-in registration tests: the plugin registers 7 tabs and 6 file
|
||||||
* viewers through the same service external plugins use (dogfooding);
|
* viewers through the same service external plugins use (dogfooding);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @vitest-environment jsdom
|
|
||||||
/**
|
/**
|
||||||
* Markdown preview copy-label spec: the fence copy buttons ("复制" / "Copy")
|
* Markdown preview copy-label spec: the fence copy buttons ("复制" / "Copy")
|
||||||
* must follow the DSH locale service through `codeLabels` — the DSH
|
* must follow the DSH locale service through `codeLabels` — the DSH
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @vitest-environment jsdom
|
|
||||||
/**
|
/**
|
||||||
* Markdown frontmatter preview regression (#251): a leading, closed YAML
|
* Markdown frontmatter preview regression (#251): a leading, closed YAML
|
||||||
* metadata block must not reach the shared MarkdownText parser, where its
|
* metadata block must not reach the shared MarkdownText parser, where its
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
// @vitest-environment jsdom
|
|
||||||
/**
|
/**
|
||||||
* Sandbox-contract tests for the two built-in web surfaces (HTML preview
|
* Sandbox-contract tests for the two built-in web surfaces (HTML preview
|
||||||
* iframe and the browser tab iframe). The iframe sandbox — opaque origin,
|
* iframe and the browser tab iframe). The iframe sandbox — opaque origin,
|
||||||
|
|||||||
Reference in new issue
Block a user