Files
Alex Langenfeld d864efb07b test: tighten CI health signals (#4107)
## Summary & Motivation

- Manifest coverage now declares an entry for every matrix app, uses real Vitest skips instead of silent early returns, and fails when a targeted app's manifest is missing, unknown, or unparseable.
- Retries are scoped to deployment e2e runs (`DEPLOYMENT_URL` set), so a flaky unit or integration test can no longer be hidden by a second attempt.
- The stop-workflow cookbook parks on a sleep between iterations, giving the hook an observable barrier to race instead of a fixed delay, and the AbortController hook test waits on queue state rather than a 10ms timer.
- The world-postgres direct-storage fixture drives its run to a terminal state so the conformance worker doesn't recover and replay an unregistered workflow.
- Generated e2e result sidecars are ignored and the committed copies removed; they're CI artifacts, not fixtures.

## Test Plan

Existing coverage runs in CI. With retries disabled: the cookbook agent suite passed 8/8, the two stop-workflow tests passed 10/10, and the AbortController hook replay test passed 25/25 under `CI=1`. The manifest suite skips 52 apps explicitly when nothing is built, and fails on unknown or missing targeted apps. The Docker-backed Postgres spec could not run locally (Testcontainers found no container runtime); `@workflow/world-postgres` typechecks.
2026-09-11 12:39:17 -05:00
..

@workflow/vitest-workbench

This workbench demonstrates how to test workflows with Vitest using the @workflow/vitest plugin.

How it works

  1. Vitest plugin: The workflow() plugin from @workflow/vitest handles SWC transforms, bundle building, and in-process handler registration automatically.
  2. No server required: Workflows execute entirely in-process using a Local World instance, so they don't need an HTTP server.
  3. Tests: Use start(workflow, args) and await run.returnValue, plus helpers like waitForSleep() and waitForHook().

Usage

pnpm test

Project structure

workbench/vitest/
├── workflows/
│   ├── simple.ts          # Basic workflow with arithmetic steps
│   ├── sleeping.ts        # Workflows with sleep() calls
│   ├── hooks.ts           # Workflow with createHook() for external data
│   └── webhook.ts         # Workflow with createWebhook() for HTTP payloads
├── test/
│   └── workflow.test.ts   # Integration tests for all workflow types
├── vitest.config.ts       # Vitest config with workflow() plugin
├── MOCKING.md             # Analysis of mocking limitations
└── package.json

Test coverage

  • Basic workflow: Start and await return value
  • Sleep workflow: waitForSleep()wakeUp() to skip sleep
  • Multi-sleep workflow: Targeted wakeUp() with correlation IDs
  • Hook workflow: waitForHook()resumeHook() with approval/rejection
  • Webhook workflow: waitForHook()resumeWebhook() with Request payload