How @stripe/sync-test-utils works
devThe @stripe/sync-test-utils package provides a complete testing environment for sync-engine integration tests without requiring an external mock server.
Key features include:
- Hono HTTP server: Automatically discovers listable Stripe endpoints from the OpenAPI spec and serves compatible list/retrieve responses.
- Docker Postgres 18 helper: Automatically spins up a disposable Postgres 18 container with SSL, waits for readiness, and cleans up on exit. If you provide a
POSTGRES_URLenvironment variable, the server will use that instead of starting an internal container. - DB seeding: Uses
@stripe/sync-openapito generate objects compliant with OpenAPI schemas and performs bulk-inserts into Postgres. - Validation: List query parameters are validated against OpenAPI parameter definitions (including v2 endpoints).
- Timestamp control: Supports spreading
createdtimestamps across a specific range usingapplyCreatedTimestampRange.