Skip to main content
Test the executor your game exports. This covers input schemas, validation, execution, stage transitions, events, and visibility together. Add Vitest when you are ready to write engine tests:

Test one command

Use a fixed seed in every test. A failure then reproduces the same shuffles and rolls.

Test rejection

Also test every reason returned by your own .validate() callbacks.

Test a complete scenario

runScenario applies a sequence and collects every result:
The argument after the command array is the same init object you pass to createInitialState. Add setup to it when your definition declares setup input.

Test hidden information

Create views for at least the owner, another player, and a spectator:

Test events and transitions

Successful results include both your domain events and engine stage events:
Prefer assertions about player-visible rules and outcomes. Avoid tests that depend on private builder objects or schema implementation details.