improve testing speed

This commit is contained in:
seavor 2026-04-20 00:01:25 -05:00
parent 0d7336edc2
commit 5f28d43dff
7 changed files with 731 additions and 325 deletions

View file

@ -1,41 +1,21 @@
import react from '@vitejs/plugin-react';
import { defineConfig } from 'vitest/config';
import viteConfig from './vite.config';
// Integration tests exercise the full inbound/outbound webclient pipeline
// (ProtobufService → event handlers → persistence → Redux) with only the
// browser WebSocket constructor mocked. They live in `integration/` with
// their own config so the include glob and longer testTimeout stay scoped
// to this suite; both suites run `isolate: true`.
export default defineConfig({
plugins: [react()],
resolve: {
tsconfigPaths: true,
},
...viteConfig,
test: {
globals: true,
environment: 'jsdom',
...viteConfig.test,
setupFiles: ['./integration/src/helpers/setup.ts'],
include: ['integration/src/**/*.spec.{ts,tsx}'],
// App-suite tests render the full Login container against real Dexie
// (fake-indexeddb) + real WebClient. Under CI/disk load the default
// 5s timeout is tight; 10s leaves headroom without masking real hangs.
testTimeout: 10000,
exclude: ['node_modules', 'build', 'coverage'],
coverage: {
provider: 'v8',
reporter: ['text', 'html'],
...viteConfig.test?.coverage,
reportsDirectory: './coverage/integration',
include: [
'src/websocket/**/*.{ts,tsx}',
'src/store/**/*.{ts,tsx}',
'src/api/**/*.{ts,tsx}',
],
exclude: [
'src/generated/**',
'src/**/*.spec.{ts,tsx}',
'src/**/__mocks__/**',
'src/setupTests.ts',
'src/polyfills.ts',
],
},
},
});