Node 22 makes node:sqlite importable (isBuiltin() returns true) but doesn't
list it in module.builtinModules, which Vite/Rolldown use to decide what to
externalize instead of bundle. That made the whole Vitest run fail on CI
("Cannot bundle Node.js built-in node:sqlite") even after pinning Node 22.
Root-caused by reproducing directly in node:22 vs node:24 Linux containers on
the VPS. Bumped ci.yml/release.yml/sonarqube.yml and package.json engines to
Node 24, and verified 473/473 tests pass in a real Linux Node 24 container.
Also:
- Exclude coachStore.ts/memory/store.ts/meetingStore.ts from coverage.include:
Vitest's coverage-v8 still tries to transform them via Vite's "client"
environment (which can't bundle Node builtins at all) when establishing the
baseline for unimported files, independently of the Node 22/24 issue above.
- Fix tests/unit/captureWorker.test.ts: hardcoded Windows path separator in
an expectation didn't match path.join's output on Linux.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
import { defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
test: {
|
|
environment: 'jsdom',
|
|
globals: true,
|
|
setupFiles: ['./tests/setup.ts'],
|
|
// tests/e2e est exclusivement pilote par Playwright (test:e2e), jamais par Vitest.
|
|
exclude: ['**/node_modules/**', 'tests/e2e/**'],
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'lcov', 'html'],
|
|
thresholds: {
|
|
lines: 80,
|
|
functions: 80,
|
|
branches: 75,
|
|
statements: 80
|
|
},
|
|
include: ['src/**/*.{ts,tsx}'],
|
|
exclude: [
|
|
'node_modules',
|
|
'tests',
|
|
'*.config.*',
|
|
'src/main/index.ts',
|
|
'src/preload/**',
|
|
'src/renderer/src/main.tsx',
|
|
'**/*.d.ts',
|
|
// node:sqlite (built-in Node >= 22.5) ne peut pas etre transforme par Rolldown pour le
|
|
// calcul de couverture des fichiers non importes (environnement "client", qui ne bundle
|
|
// pas les built-ins Node) : echoue sur Linux (CI) bien que fonctionnel sous Windows. Les
|
|
// trois fichiers restent neanmoins testes reellement (tests/unit/coachStore.test.ts,
|
|
// tests/unit/skills.memory.test.ts, tests/unit/skills.visionWebMeetingDocuments.test.ts) ;
|
|
// seul leur pourcentage de couverture global n'est plus comptabilise.
|
|
'src/main/coach/coachStore.ts',
|
|
'src/main/memory/store.ts',
|
|
'src/main/meeting/meetingStore.ts'
|
|
]
|
|
}
|
|
}
|
|
})
|