Files
clean-architecture-frontend…/vitest.config.ts
T
DongHyeonkaandClaude Opus 5.5 72e7ae1139 test(vitest): collect only Vitest files and document running one file (10-05)
A bare vitest run collected 26 Playwright specs and the host-bound system
suite. The documented one-file command goes through run-vitest.ts, which
renders the gitignored product index a fresh clone lacks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 00:22:16 +09:00

45 lines
1.6 KiB
TypeScript

import { configDefaults, defineConfig } from "vitest/config";
// Tests must not inherit a caller's production React/runtime selection.
// Package scripts also launch Vitest through scripts/run-vitest.ts, which owns
// NODE_ENV before the Vitest process starts. Keeping the config deterministic
// protects direct `vitest` invocations as well.
process.env.NODE_ENV = "test";
// tests/system needs CI-runner host facilities (see docs/testing/taxonomy.md).
// It runs only when a caller names it, as `test:system` does; a bare `vitest`
// run leaves it out.
const systemTestsRequested = process.argv.some((argument) =>
argument.replaceAll("\\", "/").replace(/^\.\//u, "").startsWith("tests/system"),
);
export default defineConfig({
test: {
globals: false,
setupFiles: ["./tests/setup.ts"],
restoreMocks: true,
clearMocks: true,
mockReset: true,
testTimeout: 10_000,
// Playwright specs (*.spec.ts) share tests/ but belong to Playwright.
include: ["tests/**/*.test.{ts,tsx}"],
exclude: [
...configDefaults.exclude,
".tmp/**",
// A git worktree inside the repository is a different checkout of a
// different branch. Running its tests against this checkout's config
// reports failures that belong to neither.
".worktrees/**",
"tests/fixtures/v8-coverage-counter-semantics/**",
...(systemTestsRequested ? [] : ["tests/system/**"]),
],
coverage: {
provider: "v8",
reportsDirectory: "artifacts/tests/coverage",
reporter: ["text", "json-summary", "lcov"],
include: ["src/**/*.{ts,tsx}"],
exclude: ["**/*.d.ts", "**/*.stories.*"],
},
},
});