Skip to content

Testing

Run EdgeCart's unit, integration, and plugin CLI test suites.

EdgeCart tests run inside the real Workers runtime with real D1 bindings, using Cloudflare’s Vitest integration.

Commands

pnpm test              # unit tests (tests/unit)
pnpm test:integration  # service + HTTP flows on real D1 (tests/integration)
pnpm test:cli          # plugin CLI tests
pnpm test:all          # all three suites

Run the full suite before opening a pull request that changes shared commerce behavior.

How the suites work

  • Unit (vitest.unit.config.mts) — pure functions: money and tax rounding, pricing rules, promotions, metadata, IDs, pagination, ISO 3166.
  • Integration (vitest.workers.config.mts) — drives real HTTP routes through the Hono app, queue handlers, cron handlers, and Stripe webhook signature verification. The real D1 schema is applied per test file and truncated between tests.
  • CLI — validates the plugin CLI’s keygen, validate, and publish behavior.

CI

The repository CI runs typechecks, both Workers suites, the plugin CLI suite, Drizzle migration drift checks, and a production build.

Type to search…

↑↓ navigate↵ selectEsc close