mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-09 04:50:59 +00:00
Three small follow-ups to the v1.3.3 audit: - src/lib/auth/__tests__/hmac.test.ts now stubs API_TOKEN_HMAC_KEY via vi.stubEnv per test instead of mutating process.env in beforeAll, so the variable is restored cleanly after every case (and worker leaks under --no-isolate are gone). - The two native-token issuance tests (password login + passkey login) now mock hashToken as (raw) => "hashed:" + raw and assert the persisted tokenHash equals hashToken(plaintext) instead of accepting any string. Catches a regression where the route would hash the wrong value. - vitest.config.mts adopts coverage.include for the full src/ tree (the vitest 4 replacement for coverage.all=true) so untouched files surface with 0% rather than being silently omitted, and excludes the future tests/integration/** suite so unit-test runs stay fast. No production code touched; suite stays at 454 green.
35 lines
1.0 KiB
TypeScript
35 lines
1.0 KiB
TypeScript
import { defineConfig } from "vitest/config";
|
|
import { dirname, resolve } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
const __dirname = dirname(__filename);
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
globals: true,
|
|
environment: "node",
|
|
// Default `pnpm test` keeps unit tests only — integration suite uses
|
|
// testcontainers and runs separately via `pnpm test:integration`.
|
|
exclude: ["**/node_modules/**", "**/dist/**", "tests/integration/**"],
|
|
coverage: {
|
|
provider: "v8",
|
|
// `include` enumerates the full source tree so the report shows
|
|
// per-file coverage for files never imported by a test (vitest 4
|
|
// dropped the `coverage.all` flag and uses `include` for this).
|
|
include: ["src/**/*.ts", "src/**/*.tsx"],
|
|
exclude: [
|
|
"src/generated/**",
|
|
"src/**/__tests__/**",
|
|
"src/**/*.test.ts",
|
|
"src/**/*.test.tsx",
|
|
],
|
|
},
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
"@": resolve(__dirname, "src"),
|
|
},
|
|
},
|
|
});
|