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: docs/testing/01-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,6 @@ Stencil supports the following for testing components:
21
21
22
22
The integrated Stencil Test Runner is deprecated as of Stencil v4.43 and will be removed in Stencil v5. We recommend migrating to the new testing tools:
23
23
24
-
-**For `--spec` style tests**: Migrate to [@stencil/vitest](./vitest/01-overview.md). It has a similar API to the current Jest integration but gives you far greater control. You can test against different bundles/outputs, test in a real browser (for accessibility tests, visual regressions, etc.), or pick your node-dom of choice (jsdom, happy-dom, or mock-doc). See the [migration guide](./vitest/06-migration.md) for detailed instructions.
24
+
-**For `--spec` style tests**: Migrate to [@stencil/vitest](./vitest/01-overview.md). It has a similar API to the current Jest integration but gives you far greater control. You can test against different bundles/outputs, test in a real browser (for accessibility tests, visual regressions, etc.), or pick your node-dom of choice (jsdom, happy-dom, or mock-doc). See the [migration guide](./vitest/07-migration.md) for detailed instructions.
25
25
26
26
-**For `--e2e` style tests**: Many library authors actually want "component" tests—isolated testing of components that run in a browser. For this, use [@stencil/vitest](./vitest/01-overview.md) with browser mode. For true end-to-end tests (routing, full applications, proper onload initialization), use [@stencil/playwright](./playwright/01-overview.md).
Copy file name to clipboardExpand all lines: docs/testing/stencil-testrunner/01-overview.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ sidebar_label: Overview
9
9
10
10
**The Stencil Test Runner is deprecated as of Stencil v4.43 and will be removed in Stencil v5.**
11
11
12
-
We recommend migrating to [@stencil/vitest](../vitest/01-overview.md) for all new and existing projects. See the [migration guide](../vitest/06-migration.md) for detailed instructions on updating your tests.
12
+
We recommend migrating to [@stencil/vitest](../vitest/01-overview.md) for all new and existing projects. See the [migration guide](../vitest/07-migration.md) for detailed instructions on updating your tests.
// *note: jsdom and happy-dom require additional dependencies*
103
104
domEnvironment: 'jsdom'
104
105
},
105
106
},
@@ -165,8 +166,8 @@ export {};
165
166
Depending on your Stencil configuration, you may need to adjust how components are loaded:
166
167
167
168
-**Default (lazy-load)**: Works with the standard dev build
168
-
-**Production build**: Use `--prod` flag or set `buildDist: true` in your stencil.config to generate production bundles
169
-
-**Custom elements**: If using the `dist-custom-elements` output target, adjust the import path accordingly
169
+
-**Production build**: Use `--prod` flag to generate production bundles
170
+
-**Custom elements**: If using the `dist-custom-elements` output target, adjust the setup file accordingly. If you wish to test this output in `--watch` mode, set `buildDist: true` in your stencil.config
Copy file name to clipboardExpand all lines: docs/testing/vitest/04-api.md
+66-2Lines changed: 66 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ Complete reference for the `@stencil/vitest` testing utilities.
11
11
12
12
## Render Function
13
13
14
-
### `render(VNode)`
14
+
### `render(VNode, options?)`
15
15
16
16
Renders a Stencil component for testing.
17
17
@@ -21,7 +21,42 @@ import { render, h } from '@stencil/vitest';
21
21
const result =awaitrender(<my-componentname="World" />);
22
22
```
23
23
24
-
**Returns:**
24
+
### Options
25
+
26
+
| Option | Type | Default | Description |
27
+
| ------ | ---- | ------- | ----------- |
28
+
|`waitForReady`|`boolean`|`true`| Wait for component hydration before returning |
29
+
|`spyOn`|`SpyOnOptions`| - | Configure spies for methods, props, and lifecycle hooks |
30
+
31
+
#### `waitForReady`
32
+
33
+
By default, `render()` waits for components to be fully hydrated before returning. It detects when Stencil applies the hydrated flag (class or attribute) to your component, respecting your `stencil.config` settings.
34
+
35
+
```tsx
36
+
// Default behavior - waits for hydration
37
+
const { root } =awaitrender(<my-component />);
38
+
39
+
// Skip hydration wait (useful for pre-ready states)
0 commit comments