The repo configured four frontend gates and enforced one of them. eslint
and prettier ran in no workflow and no hook; `bun run check` ran only in
build-release.yml, so a type error could sit on master until somebody cut
a tag; and `bun run test:coverage` had been dead for months.
CI (build-and-test.yml) now runs format:check, lint, check and coverage
alongside the existing boundary and doc-link tripwires.
The coverage script failure was a version mismatch, not a config problem:
@vitest/coverage-v8 resolved to 4.1.10, whose peer range pins vitest
exactly, while package.json asked for ">=1.0.0 <5.0.0" and got 4.0.16 --
every run died on a missing BaseCoverageProvider export. The loose range
is what allowed the pair to drift, so it is now ^4.1.10.
Two ratchets, same policy as MIN_THRESHOLD in traceability-check.yml:
eslint --max-warnings=159 (0 errors; 159 is today's backlog, only
ever lower it)
vitest thresholds (statements 51 / branches 45 /
functions 46 / lines 52, measured at
54.6 / 48.7 / 49.6 / 55.1)
no-console is promoted from "off" to "error": the logger-facade
migration it was waiting on is finished -- 8 calls remained, 2 of them
real stragglers in the settings page, now on the facade the file already
imported. The sink itself, tests, and scripts/ are exempted; a CLI whose
stdout is the product is not a stray debug statement.
The threshold was verified to bite by raising it to 99 and watching the
run go red, not by assuming an unfailed gate works.
DR-205 moves to Done; the coverage gate is DR-215.
56 lines
2.2 KiB
TypeScript
56 lines
2.2 KiB
TypeScript
// Vitest configuration for the JellyTau frontend suite.
|
|
//
|
|
// TRACES: | DR-215
|
|
import { defineConfig } from "vitest/config";
|
|
import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
import { resolve } from "path";
|
|
|
|
export default defineConfig({
|
|
plugins: [svelte({ hot: !process.env.VITEST })],
|
|
test: {
|
|
globals: true,
|
|
environment: "jsdom",
|
|
setupFiles: ["./src/test/setup-globals.ts", "./src/test/setup.ts"],
|
|
// `scripts/` is included so build tooling (the traceability coverage
|
|
// engine) is covered by the normal suite rather than only by CI.
|
|
include: ["src/**/*.{test,spec}.{js,ts}", "scripts/**/*.{test,spec}.{js,ts}"],
|
|
coverage: {
|
|
provider: "v8",
|
|
reporter: ["text", "json", "html"],
|
|
exclude: ["node_modules/", "src/test/", "**/*.test.ts", "**/*.spec.ts", "src-tauri/"],
|
|
|
|
// RATCHET POLICY — these numbers only ever go UP.
|
|
//
|
|
// Same rule as MIN_THRESHOLD in .gitea/workflows/traceability-check.yml:
|
|
// they sit a few points under what the suite actually achieves, so
|
|
// deleting a test or landing a large untested module trips the gate, while
|
|
// ordinary churn does not. Raise them when coverage rises durably. Never
|
|
// lower one to make a red build pass — write the missing test instead.
|
|
//
|
|
// Measured at the time of writing (`bun run test:coverage`):
|
|
// statements 54.58 · branches 48.70 · functions 49.56 · lines 55.13
|
|
//
|
|
// The absolute figures are held down by `.svelte` components, which are
|
|
// largely untested by design here — the project's pattern is to extract
|
|
// the logic into a plain `.ts` module (episodeStrip.ts, TrackList.logic.ts)
|
|
// and test that. Those extracted modules sit far higher.
|
|
thresholds: {
|
|
statements: 51,
|
|
branches: 45,
|
|
functions: 46,
|
|
lines: 52,
|
|
},
|
|
},
|
|
},
|
|
resolve: {
|
|
conditions: ["browser"],
|
|
alias: {
|
|
$lib: resolve(__dirname, "./src/lib"),
|
|
"$lib/": resolve(__dirname, "./src/lib/"),
|
|
"$app/environment": resolve(__dirname, "./src/test/mocks/app-environment.ts"),
|
|
"$app/navigation": resolve(__dirname, "./src/test/mocks/app-navigation.ts"),
|
|
"$app/stores": resolve(__dirname, "./src/test/mocks/app-stores.ts"),
|
|
},
|
|
},
|
|
});
|