Testing
Run unit, integration, and end-to-end tests for critical workflows.
Prolifto uses Vitest for unit and integration tests and Playwright for end-to-end tests. Test critical behavior: money, inventory, auth, tenant isolation, billing, security, and primary user journeys.
Unit tests
pnpm test # all workspaces
pnpm -F admin test # admin unit + integration
pnpm -F admin exec vitest run --project=unit
pnpm -F admin exec vitest run --project=integration
pnpm -F sdk testUnit tests live next to the code or under apps/admin/test and do not need a
database. Integration tests use the separate test database.
Integration tests
pnpm db:test:up
pnpm -F admin exec vitest run --project=integrationIntegration tests use TEST_DATABASE_URL and run serially. They cover order
creation, checkout, payment confirmation, returns, coupon validation, inventory,
and other stateful flows. Clean up or isolate the data you create.
Reset the test database:
pnpm db:test:resetEnd-to-end tests
Playwright covers the revenue-critical path: catalog, cart, coupons, guest checkout with cash on delivery, and verifying the order in the admin.
- Copy
apps/e2e/.env.e2e.exampletoapps/e2e/.env.e2e. - Point
DATABASE_URLat a database with the schema pushed. - Run:
pnpm e2eThe suite seeds an e2e-store organization and an e2e-admin@prolifto.test user,
builds dedicated apps on ports 3100 (admin) and 3101 (storefront), and only
mutates that test data.
Interactive runs:
pnpm e2e:ui
pnpm -F e2e exec playwright test <spec> --debug=cliSnapshots, traces, and CLI output go to .playwright-cli/ (git-ignored).
What to test
- Money: totals, discounts, shipping, refunds, currency rounding.
- Inventory: stock decrement, restore, low-stock thresholds.
- Auth and tenancy: permissions, API keys, organization scoping.
- Billing: plan limits, subscription lifecycle.
- Primary journeys: checkout, order confirmation, admin fulfillment.
Do not add tests for presentational UI, static mappings, date/Intl formatting,
thin wrappers, or third-party library behavior. Do not chase coverage
percentages; test:coverage is informational.
CI
The CI workflow runs:
pnpm check(Biome/Ultracite)pnpm check-typespnpm testwith a PostgreSQL servicepnpm e2ewith a PostgreSQL service and Mailpit
Keep the suite deterministic and fast enough for CI. A regression test should accompany a critical-path bug fix.