Both lanes printed a coverage total with no threshold (owner decision E32 D4). No real hit as a lane: the one time the number found anything (5 bugs, E32) it was read by hand, and since then it was a line nobody acted on. It was also the most expensive part of the vitest lane, and the run that flaked in E35 S1. The vitest lane runs without --coverage, the pytest lane runs plain pytest; docs/development.md gives both on-demand commands, and the register row says why.
32 lines
1.8 KiB
TypeScript
32 lines
1.8 KiB
TypeScript
import { defineConfig } from "vitest/config";
|
|
import { reactWithCompiler } from "./reactPlugin";
|
|
|
|
// Unit + component/hook tests, deliberately separate from vite.config.ts so the production build
|
|
// never has to load vitest. The DEFAULT environment is node (the pure src/lib helpers — fast, no
|
|
// DOM). A test that needs the DOM (component render or renderHook) opts INTO jsdom per-file with a
|
|
// // @vitest-environment jsdom
|
|
// docblock on its first line. plugin-react is wired here so those tests get JSX + a Fast-Refresh-
|
|
// free React transform. It is NOT a no-op for the plain .ts node tests: the plugin's filter is
|
|
// /\.[tj]sx?$/, so the React Compiler rewrites `src/lib`'s hooks in that lane too (usePref,
|
|
// useCardPager, plexPlayerHooks all come out with `react/compiler-runtime` memo slots). That is the
|
|
// point of sharing one factory with vite.config.ts — the gate compiles the code the way the build
|
|
// does — and it is worth knowing before ruling the compiler out of a divergence. jsdom is a
|
|
// devDependency referenced only via that docblock env string — knip's vitest plugin still sees it.
|
|
export default defineConfig({
|
|
plugins: [reactWithCompiler()],
|
|
test: {
|
|
// .tsx included on purpose: a test file the glob misses does not fail, it is simply never
|
|
// collected, and the gate still prints green.
|
|
include: ["src/**/*.test.{ts,tsx}"],
|
|
environment: "node",
|
|
// A coverage REPORT on demand (`npm run test -- --coverage`), never enforced and not in the gate
|
|
// (E32 D4, E35): "every regression test seen red" is the bar, not a percentage.
|
|
coverage: {
|
|
provider: "v8",
|
|
include: ["src/**/*.{ts,tsx}"],
|
|
exclude: ["src/**/*.test.{ts,tsx}", "src/**/*.testkit.ts", "src/**/*.d.ts"],
|
|
reporter: ["text-summary"],
|
|
},
|
|
},
|
|
});
|