Files
ita-ito-horaires/vitest.config.mts
T
vliaudatandClaude Opus 5 eb23eb650b feat: edit the reference week from the admin
The first administration page, built for the actual use case: a phone
held in one hand behind the counter. One card per day, native time
inputs so the platform keyboard does the work, and the consequences
shown before the save rather than after — the footer names which days
are about to change, and the button stays disabled until something
actually has.

"Duplicate onto the other open days" leaves closed days closed. Someone
copying Tuesday's hours means "the days I open, I open like this", not
"open seven days a week".

Validation runs in the browser for the feedback and again in the action
before the write: the client is a convenience, not a guarantee, and this
is the schedule the shop window shows. A day being closed drops its
leftover slots rather than failing on them.

A save that changes nothing writes nothing — no rows, no audit entry,
and so no needless panel redraw. Reordering slots does not count as a
change. The audit diff stores one readable line per day in French, so
the log can be read without cross-referencing the schema.

The editing helpers are pure and tested, and the write path is tested
against a real database including the read-only refusal.

Test files now run sequentially: the integration files share one
database and each truncates it, so parallel files raced. The suite takes
six seconds; giving every file its own database would buy nothing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012cSY9pVhZmJUKNN7wf1Myd
2026-09-20 18:57:46 +02:00

38 lines
1.3 KiB
TypeScript

import { defineConfig } from 'vitest/config';
import { fileURLToPath } from 'node:url';
export default defineConfig({
resolve: {
alias: {
'@': fileURLToPath(new URL('.', import.meta.url)),
},
},
test: {
environment: 'node',
include: ['lib/**/*.test.ts', 'lib/**/*.test.tsx', 'tests/**/*.test.ts'],
// Runs before any module is imported, so the Prisma client is built
// against the test database rather than the development one.
setupFiles: ['tests/setup-database.ts'],
// The integration files share one database and each truncates it, so
// running files in parallel makes them race. The whole suite is a couple
// of seconds; giving every file its own database would buy nothing.
fileParallelism: false,
coverage: {
provider: 'v8',
reporter: ['text', 'html', 'lcov'],
include: ['lib/**'],
exclude: [
'lib/**/*.test.ts',
'lib/**/*.test.tsx',
// Generated by `prisma generate`; not ours to cover.
'lib/generated/**',
],
// The business core must stay covered; the CI fails below these.
thresholds: {
'lib/schedule/**': { statements: 85, branches: 85, functions: 85, lines: 85 },
'lib/screen/**': { statements: 85, branches: 85, functions: 85, lines: 85 },
},
},
},
});