with one click
testing
Writing or debugging tests, choosing unit vs integration style, Postgres/ClickHouse tests, regenerating ClickHouse test schema, or exporting test helpers from packages without pulling test code into production bundles.
Menu
Writing or debugging tests, choosing unit vs integration style, Postgres/ClickHouse tests, regenerating ClickHouse test schema, or exporting test helpers from packages without pulling test code into production bundles.
| name | testing |
| description | Writing or debugging tests, choosing unit vs integration style, Postgres/ClickHouse tests, regenerating ClickHouse test schema, or exporting test helpers from packages without pulling test code into production bundles. |
When to use: Writing or debugging tests, choosing unit vs integration style, Postgres/ClickHouse tests, regenerating ClickHouse test schema, or exporting test helpers from packages without pulling test code into production bundles.
Test utilities (fakes, in-memory DB helpers, fixtures) must not be exported from a package’s main entry (src/index.ts).
./test/ or ./testing/ in the main src/index.ts/testing subpath in package.json exports:{
"exports": {
".": "./src/index.ts",
"./testing": "./src/testing/my-test-helpers.ts"
}
}
import { Fake } from "@platform/my-package/testing"noRestrictedImports blocks test paths in production source; tsdown fails the build if test code is resolved from prod entry pointspackages/vitest-config/index.ts)Always use in-memory databases for tests. Do not use vi.mock/vi.fn to mock repository methods and do not require running database servers. The project provides embedded, in-process database engines that run the real SQL against the real schema:
chdb package): An in-process ClickHouse engine via @platform/testkit.@electric-sql/pglite): An in-process Postgres via WASM via @platform/testkit.@platform/testkit)import { setupTestPostgres } from "@platform/testkit"
import { beforeAll, describe, it } from "vitest"
const pg = setupTestPostgres()
describe("MyRepository", () => {
it("does something", async () => {
// pg.postgresDb is a real Drizzle instance backed by PGlite in-memory
// pg.db is the lower-level Drizzle/PGlite instance for direct queries
})
})
setupTestPostgres() registers vitest hooks automatically:
latitude_app role, and runs all Drizzle migrations@platform/testkit)import { setupTestClickHouse } from "@platform/testkit"
import { beforeAll, describe, it } from "vitest"
const ch = setupTestClickHouse()
describe("MyRepository", () => {
let repo: ReturnType<typeof createMyRepository>
beforeAll(() => {
repo = createMyRepository(ch.client)
})
it("does something", async () => {
// ch.client is a real ClickHouseClient backed by chdb in-memory
})
})
setupTestClickHouse() registers vitest hooks automatically:
schema.sqlAfter new ClickHouse migrations, regenerate the in-memory test schema (only if the user asked you to run migration-related commands — see database-clickhouse-weaviate):
pnpm --filter @platform/db-clickhouse ch:schema:dump
vi.mock?Mocking repositories with vi.fn() tests the wiring, not the queries. In-memory databases catch real bugs: wrong column names, broken argMax aggregations, incorrect GROUP BY clauses, and schema mismatches. They run quickly with zero external dependencies.
Run the public Mintlify product docs site locally for live preview. Use when previewing or iterating on docs under `docs/` (`.mdx`/`.md` pages, `docs.json` nav), or when the user says "start the docs", "run mintlify", "preview the docs site".
Find, triage, and fix production errors captured by Datadog Error Tracking, then open a PR. Use when asked to look at "Datadog issues/incidents/errors", "find and fix bugs from Datadog", investigate the most-frequent or newest production errors, or work a specific Datadog Error Tracking issue.
Review the current conversation context and git changes, then persist durable repository knowledge into `dev-docs/*.md` by domain and into `AGENTS.md` for cross-cutting repo rules. Use after features, fixes, refactors, architecture changes, schema changes, or when the user mentions docs, documentation, design, architecture, business logic, conventions, or `AGENTS.md`.
apps/web UI — routes, @repo/ui, TanStack Start server functions and collections, navigation (Link vs useNavigate), forms (useForm + createFormSubmitHandler + fieldErrorsAsStrings for Zod field errors), Tailwind layout rules, design-system updates, and useEffect / useMountEffect policy.
Preparing a production release, pushing a vX.Y.Z release tag, running scripts/release.sh, or updating CHANGELOG.md with the changes that are about to be deployed to production.
Multi-channel notifications. Adding a new notification kind, group, or channel; in-app + email delivery; per-user prefs; project-level gates; idempotency.