Testing your widget
Visual goldens (this repo)
Cases live in tests/cases/*.json, fixtures in tests/fixtures/**, screenshots in tests/golden/{platform}/*.png.
| Surface | Command |
|---|---|
| Desktop HTML | pnpm test:desktop / pnpm test:desktop:update |
| Android unit | pnpm test:android |
| macOS Swift | pnpm test:macos:visual |
| Geometry | pnpm test:geometry |
Contributor deep-dive: Render testing, Visual stand.
In your app
- Keep fixture JSON next to the feature that builds
WidgetConfig - Use the showcase playground (same desktop renderer) to iterate on layout
- On device, prefer
{ type: "timer" }/ date styles for live UI instead of burning WidgetKit reload budget - Call
getWidgetDiagnostics(group)when a native surface looks empty — check receipts and skipped capabilities
Docs coverage gate
pnpm docs:audit (also run from docs:generate) fails if:
- a schema element never appears in any fixture
- a case is missing a golden on desktop / ios / macos / android / linux
Windows goldens are recorded on a Windows VM via PreviewHost (just record-windows <case>, full WPF Adaptive Cards renderer).
