Open History to see the last commit
1import { defineConfig } from 'vitest/config'
2import { resolve } from 'path'
3import { fileURLToPath } from 'url'
4import solid from 'vite-plugin-solid'
5
6const __dirname = fileURLToPath(new URL('.', import.meta.url))
7
8export default defineConfig({
9 plugins: [solid()],
10 test: {
11 globals: true,
12 environment: 'jsdom',
13 setupFiles: ['./tests/setup.ts'],
14 include: ['tests/**/*.test.ts', 'tests/**/*.test.tsx'],
15 server: {
16 deps: {
17 // Keep the testing library on the SAME solid-js instance the hooks
18 // under test use. Externalized, it would be resolved by Node (server
19 // build, and unmocked by `tests/setup.ts`), so its `createRoot` owner
20 // would be invisible to the hooks' reactive graph.
21 inline: ['@solidjs/testing-library'],
22 },
23 },
24 coverage: {
25 provider: 'v8',
26 reporter: ['text', 'json', 'html', 'lcov'],
27 exclude: [
28 'node_modules/',
29 'dist/',
30 'tests/',
31 '**/*.test.ts',
32 '**/*.test.tsx',
33 '**/*.config.ts',
34 '**/types.ts',
35 ],
36 include: ['src/**/*.ts'],
37 },
38 },
39 resolve: {
40 // Without this, solid-js resolves through its `node` export condition and
41 // vitest loads the SERVER build, where `onMount` / `createEffect` are
42 // no-ops — mount-time behaviour (devtools registration, persistence
43 // hydration) would never run under test. Force the client build.
44 conditions: ['browser', 'development', 'import', 'default'],
45 alias: {
46 '@tanstack/ai-event-client': resolve(
47 __dirname,
48 '../ai-event-client/src/index.ts',
49 ),
50 },
51 },
52})