Skip to Content
Grist Widgets

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.

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 demo in 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 — renderWithGrist and the recommended test patterns.
  • Emulator API — the lower-level createGristEmulator surface.
  • Replica document — the document shape the emulator (and presets) build on.

On this page