You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/vitest-browser-astro/README.md
+39-19Lines changed: 39 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Test Astro components in real browsers with [Vitest Browser Mode](https://vitest.dev/guide/browser/).
4
4
5
-
Astro components render server-side using the Container API. This library enables browser testing by rendering components on the server and injecting the HTML into the browser DOM. Tests run with real browser APIs.
5
+
Astro components render server-side using the [Container API](https://docs.astro.build/en/reference/container-reference/). This library enables browser testing by rendering components on the server and injecting the HTML into the browser DOM. Tests run with real browser APIs.
6
6
7
7
## Installation
8
8
@@ -43,6 +43,8 @@ export default getViteConfig({
43
43
});
44
44
```
45
45
46
+
For Astro pages that contain framework components (React, Vue, etc.), add renderers using `getContainerRenderer()` from your framework integration packages - see [Plugin options](#plugin-options).
47
+
46
48
Write a test file:
47
49
48
50
```ts
@@ -68,34 +70,30 @@ Run tests:
68
70
npx vitest
69
71
```
70
72
73
+
See the [test fixture](https://github.com/ascorbic/vitest-browser-astro/tree/main/packages/vitest-browser-astro/test/fixtures/astro-site) for a complete working example.
74
+
71
75
## Configuration
72
76
73
77
### Plugin options
74
78
75
-
The `astroRenderer` plugin accepts optional configuration for framework support:
79
+
The `astroRenderer` plugin uses the [Astro Container API](https://docs.astro.build/en/reference/container-reference/) (experimental) for framework support. Configure it with `getContainerRenderer()` from your framework integration packages:
-`serverRenderers` - Array of server renderer configurations for SSR. Each entry requires:
95
-
-`module` - Path to the server renderer module
96
-
-`clientRenderers` - Array of client renderer configurations for hydration. Each entry requires:
97
-
-`name` - Integration name
98
-
-`entrypoint` - Path to the client renderer entrypoint
92
+
-`renderers` - Array of framework renderers obtained from `getContainerRenderer()`. Pass these if your Astro components use framework integrations.
93
+
94
+
**Note:** Only one JSX-based framework (React, Preact, or Solid) can be used at a time. Non-JSX frameworks (Vue, Svelte) can be combined with any JSX framework.
95
+
96
+
See the [Container API renderers documentation](https://docs.astro.build/en/reference/container-reference/#renderers-option) for more details.
0 commit comments