Emulator
Test widgets without a live Grist document: the emulator behind renderWithGrist and smokeTestWidget.
grist-widget-sdk/emulator is a self-contained reimplementation of the
parts of the Grist plugin API the SDK uses. It installs as window.grist,
so your widget's real code path runs unmodified — no mocking useGrist()
itself.
Testing
renderWithGrist, presets, and custom matchers for vitest/Jest.
Emulator API
createGristEmulator and the methods that drive and inspect it.
A test harness, not a preview
The emulator runs your widget's tests: renderWithGrist and
smokeTestWidget mount it as window.grist in jsdom. To see a widget,
use a real Grist instead, where nothing has to match Grist because it is
Grist:
pnpm demoin a widget opens it in a Grist running on your machine (Docker).- Its demo page (
create-grist-widget demo --save, then<channel>/demo/once deployed) opens it in Grist running in the browser, from static files (grist-static). Every catalog widget has one, at/widgets/<slug>/demo/.
Where to go next
- Testing —
renderWithGristand the recommended test patterns. - Emulator API — the lower-level
createGristEmulatorsurface. - Replica document — the document
shape the emulator (and
presets) build on.