2026-08-20 19:29:31 +02:00
|
|
|
import { configDefaults, defineConfig } from "vitest/config";
|
2026-03-15 19:44:02 +01:00
|
|
|
import { resolve } from "path";
|
|
|
|
|
|
|
|
|
|
export default defineConfig({
|
|
|
|
|
resolve: {
|
|
|
|
|
alias: {
|
2026-08-22 06:48:58 +02:00
|
|
|
"@lib": resolve(import.meta.dirname, "src/lib"),
|
|
|
|
|
"@stores": resolve(import.meta.dirname, "src/stores"),
|
|
|
|
|
"@components": resolve(import.meta.dirname, "src/components"),
|
|
|
|
|
"@pages": resolve(import.meta.dirname, "src/pages"),
|
|
|
|
|
"@styles": resolve(import.meta.dirname, "src/styles"),
|
2026-03-15 19:44:02 +01:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
test: {
|
|
|
|
|
environment: "jsdom",
|
2026-07-28 16:25:26 +02:00
|
|
|
// Restores `localStorage`, which Node 26 shadows out of the jsdom global.
|
|
|
|
|
setupFiles: ["./tests/setup.ts"],
|
2026-07-19 13:57:28 +00:00
|
|
|
// Both the `tests/**/*.test.ts` suite and component-local
|
|
|
|
|
// `src/**/*.test.ts` files are picked up.
|
|
|
|
|
include: ["tests/**/*.test.ts", "src/**/*.test.ts"],
|
2026-08-20 19:29:31 +02:00
|
|
|
// tests/browser/ runs real browser APIs (AudioContext, WASM) under
|
|
|
|
|
// vitest.config.browser.ts (`npm run test:browser`); it cannot pass in
|
|
|
|
|
// jsdom and is not part of this suite.
|
|
|
|
|
exclude: [...configDefaults.exclude, "tests/browser/**"],
|
2026-03-15 19:44:02 +01:00
|
|
|
coverage: {
|
|
|
|
|
provider: "v8",
|
|
|
|
|
include: ["src/**/*.ts"],
|
2026-07-25 14:47:21 +00:00
|
|
|
// Keep this list minimal and justified. An unexplained entry hides a
|
|
|
|
|
// real gap: window-state.ts, credentials.ts, updater.ts and
|
|
|
|
|
// UpdateNotifier.ts each sat here while having (or gaining) tests, so
|
|
|
|
|
// their coverage never showed up in any report.
|
2026-03-17 04:11:04 +01:00
|
|
|
exclude: [
|
|
|
|
|
"src/**/*.d.ts",
|
2026-07-25 14:47:21 +00:00
|
|
|
// App bootstrap: wires the DOM, router and stores together at startup.
|
|
|
|
|
// Has no seam to test below the e2e level; covered by tests/e2e.
|
|
|
|
|
"src/main.ts",
|
|
|
|
|
// Top-level page orchestrator, likewise covered at the e2e level.
|
|
|
|
|
// Tracked for unit coverage — remove this entry once it has tests.
|
2026-03-19 06:28:08 +01:00
|
|
|
"src/pages/MainPage.ts",
|
2026-07-25 14:47:21 +00:00
|
|
|
// RNNoise AudioWorklet host: needs a real AudioContext/WASM runtime
|
|
|
|
|
// that jsdom cannot provide. Exercised by tests/browser and e2e.
|
|
|
|
|
"src/lib/noise-suppression.ts",
|
2026-03-17 04:11:04 +01:00
|
|
|
],
|
2026-03-15 19:44:02 +01:00
|
|
|
thresholds: {
|
2026-03-28 18:55:11 +01:00
|
|
|
statements: 70,
|
|
|
|
|
branches: 70,
|
|
|
|
|
functions: 70,
|
|
|
|
|
lines: 70,
|
2026-03-15 19:44:02 +01:00
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
});
|