Skip to content

Testing Patterns

Use this guide when adding or updating tests.

Current test layout

  • packages/core has a test script (vitest).
  • apps/docs has a placeholder test script (No docs tests yet).
  • apps/widgets currently has no dedicated test script.
  • Focus automated tests on packages/core since it contains shared behavior and public API contracts.
  • For apps/widgets, prefer lightweight verification (build/lint/typecheck) unless test infra is explicitly added.

Commands

From root:

bash
pnpm test
pnpm --filter @grist-widget-sdk/core test

Useful validation around tests:

bash
pnpm --filter @grist-widget-sdk/core build
pnpm --filter @grist-widget-sdk/core exec tsc --noEmit

Testing guidance for agents

  • Avoid depending on the real Grist iframe runtime in tests.
  • Test behavior through public exports, not internal file paths.
  • Keep tests resilient to asynchronous host updates and state transitions.
  • When changing documented API behavior, update docs and tests together.