import { defineConfig } from "vitest/config"; export default defineConfig({ test: { // Two projects: a Node project for the backend packages/API, and a // jsdom + Svelte project (apps/web/vitest.config.ts) for the frontend. projects: [ { test: { name: "node", environment: "node", // `tests/` holds repo-level checks that belong to no package — // deployment files the container actually reads, for instance. include: ["packages/**/*.test.ts", "apps/api/**/*.test.ts", "tests/**/*.test.ts"], exclude: ["**/node_modules/**", "**/dist/**", "**/.claude/**"], }, }, "./apps/web/vitest.config.ts", ], coverage: { provider: "v8", // Only `.ts` sources (this also covers `*.svelte.ts` rune modules); // keeps `.svelte`/`.html`/`.css` out of the v8 parser. The web app's // build scripts too: what they write is what the release publishes. include: ["packages/*/src/**/*.ts", "apps/*/src/**/*.ts", "apps/web/scripts/*.ts"], exclude: [ "**/*.d.ts", "**/*.test.ts", "**/__tests__/**", "**/types.ts", // Barrels: `export … from` statements are hoisted, so v8 reports 0% // for a file that runs no code of its own. "packages/crypto/src/index.ts", "packages/crypto/src/client.ts", "packages/sdk-js/src/index.ts", "packages/shared/src/index.ts", // The entry point that starts the server on import. The image smoke // test runs it. "apps/api/src/index.ts", // The backup command's entry point: one line handing argv to // runBackupCommand (db/backup.ts), which is tested. "apps/api/src/backup.ts", // The command line's entry point: one line handing argv to run // (packages/cli/src/run.ts), which is tested. "packages/cli/src/bin.ts", // The build's step that writes bundle.json: three lines handing // build/ to writeBundleManifest (apps/web/scripts/manifest.ts), which // is tested. The build runs it. "apps/web/scripts/bundle-manifest.ts", // Frontend: gate the logic modules + utils, but exclude the route // modules (`+layout.ts`), which need a SvelteKit harness to exercise // and only hand over to lib/. (`.svelte` components are already // outside the `*.ts` include above.) "apps/web/src/routes/**", // The worker's entry point, which wires `lib/notes/worker.ts` to the // worker's messages; the e2e suite runs it. "apps/web/src/lib/notes/notes.worker.ts", "**/storage/interface.ts", ], thresholds: { lines: 100, functions: 100, branches: 100, statements: 100, }, }, }, });