test: make coverage opt-in and ratchet thresholds to the measured floor
Coverage was enabled by default, which forced v8 instrumentation on every run and made a focused `vitest run <file>` fail the global thresholds that a single file can never satisfy. `pnpm test:coverage` now opts in explicitly while `pnpm test` stays fast. Thresholds ratcheted from 36/29/30/37 to the measured full-suite floor of 37/30/31/38, so a drop in coverage fails again. Also drops a stale comment about a parent Laravel repo and a dead .next.prev exclude from the config.
This commit is contained in:
1 parent
4776a41c01
commit
07c5904879
2 files changed
+20
-17
No files matched your search
+3
-3
@@ -18,8 +18,8 @@
|
|||||||
"format": "biome format --write .",
|
"format": "biome format --write .",
|
||||||
"diag:permissions": "tsx scripts/diagnose-permission-page.ts",
|
"diag:permissions": "tsx scripts/diagnose-permission-page.ts",
|
||||||
"jobs:worker": "node --conditions=react-server --import tsx scripts/jobs-worker.ts",
|
"jobs:worker": "node --conditions=react-server --import tsx scripts/jobs-worker.ts",
|
||||||
"test": "bash scripts/with-memory-cap.sh 8g vitest run --coverage.enabled=false",
|
"test": "bash scripts/with-memory-cap.sh 8g vitest run",
|
||||||
"test:coverage": "bash scripts/with-memory-cap.sh 8g vitest run",
|
"test:coverage": "bash scripts/with-memory-cap.sh 8g vitest run --coverage.enabled=true",
|
||||||
"typecheck": "bash scripts/with-memory-cap.sh 6g tsc --noEmit",
|
"typecheck": "bash scripts/with-memory-cap.sh 6g tsc --noEmit",
|
||||||
"db:generate": "drizzle-kit generate",
|
"db:generate": "drizzle-kit generate",
|
||||||
"db:introspect": "drizzle-kit introspect",
|
"db:introspect": "drizzle-kit introspect",
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
"db:studio": "drizzle-kit studio",
|
"db:studio": "drizzle-kit studio",
|
||||||
"gamedata:compress": "node scripts/compress-gamedata.mjs",
|
"gamedata:compress": "node scripts/compress-gamedata.mjs",
|
||||||
"hk:matrix:check": "tsx scripts/verify-housekeeping-matrix.ts",
|
"hk:matrix:check": "tsx scripts/verify-housekeeping-matrix.ts",
|
||||||
"test:housekeeping": "bash scripts/with-memory-cap.sh 8g vitest run --coverage.enabled=false src/features/housekeeping src/lib/admin-theme-source-audit.test.ts src/lib/admin/authorization-contract.test.ts",
|
"test:housekeeping": "bash scripts/with-memory-cap.sh 8g vitest run src/features/housekeeping src/lib/admin-theme-source-audit.test.ts src/lib/admin/authorization-contract.test.ts",
|
||||||
"assets:editor": "node scripts/copy-editor-assets.mjs",
|
"assets:editor": "node scripts/copy-editor-assets.mjs",
|
||||||
"deps:audit": "pnpm audit --audit-level=high",
|
"deps:audit": "pnpm audit --audit-level=high",
|
||||||
"analyze": "pnpm assets:editor && bash scripts/with-memory-cap.sh 10g next build --webpack && node scripts/performance-report.mjs --output-dir build-reports",
|
"analyze": "pnpm assets:editor && bash scripts/with-memory-cap.sh 10g next build --webpack && node scripts/performance-report.mjs --output-dir build-reports",
|
||||||
|
|||||||
+17
-14
@@ -1,8 +1,9 @@
|
|||||||
import { fileURLToPath } from "node:url";
|
import { fileURLToPath } from "node:url";
|
||||||
import { defineConfig } from "vitest/config";
|
import { defineConfig } from "vitest/config";
|
||||||
|
|
||||||
// Local config so Vitest does not walk up into the parent Laravel repo's
|
// Project-local config: keeps the `@/` alias, the server-only stub and the
|
||||||
// vite.config.js (this app lives inside the Laravel project tree).
|
// env fallbacks with the repo instead of relying on whatever vite config a
|
||||||
|
// parent directory happens to provide.
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
@@ -26,22 +27,24 @@ export default defineConfig({
|
|||||||
DATABASE_URL: "mysql://root:root@localhost:3306/test",
|
DATABASE_URL: "mysql://root:root@localhost:3306/test",
|
||||||
},
|
},
|
||||||
testTimeout: 10000,
|
testTimeout: 10000,
|
||||||
exclude: [
|
exclude: ["integration/**", "e2e/**", "node_modules/**", ".next/**"],
|
||||||
"integration/**",
|
|
||||||
"e2e/**",
|
|
||||||
"node_modules/**",
|
|
||||||
".next/**",
|
|
||||||
".next.prev/**",
|
|
||||||
],
|
|
||||||
coverage: {
|
coverage: {
|
||||||
enabled: true,
|
// Off unless asked for (`pnpm test:coverage` passes
|
||||||
|
// `--coverage.enabled=true`): a focused `vitest run <file>` should
|
||||||
|
// not fail the global thresholds it cannot possibly meet, and
|
||||||
|
// measuring v8 coverage on every run costs real time.
|
||||||
|
enabled: false,
|
||||||
provider: "v8",
|
provider: "v8",
|
||||||
reporter: ["text", "lcov", "html"],
|
reporter: ["text", "lcov", "html"],
|
||||||
|
// Ratchet floor: measured 37.14 / 30.09 / 31.74 / 38.13 on the full
|
||||||
|
// suite (statements/branches/functions/lines). Rounded down so only
|
||||||
|
// a real regression fails the build — raise these to the new
|
||||||
|
// measured floor whenever coverage improves.
|
||||||
thresholds: {
|
thresholds: {
|
||||||
statements: 36,
|
statements: 37,
|
||||||
branches: 29,
|
branches: 30,
|
||||||
functions: 30,
|
functions: 31,
|
||||||
lines: 37,
|
lines: 38,
|
||||||
},
|
},
|
||||||
include: ["src/**/*.{ts,tsx}"],
|
include: ["src/**/*.{ts,tsx}"],
|
||||||
exclude: [
|
exclude: [
|
||||||
|
|||||||
Reference in new issue
Block a user