-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathvite.config.ts
More file actions
75 lines (73 loc) · 2.17 KB
/
vite.config.ts
File metadata and controls
75 lines (73 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import { paraglideVitePlugin } from '@inlang/paraglide-js';
import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vitest/config';
import { sveltekit } from '@sveltejs/kit/vite';
import { codecovSvelteKitPlugin } from '@codecov/sveltekit-plugin';
import { readFileSync } from 'fs';
import { fileURLToPath } from 'url';
// Read version from package.json
const packageJson = JSON.parse(readFileSync(fileURLToPath(new URL('./package.json', import.meta.url)), 'utf-8'));
export default defineConfig({
plugins: [
tailwindcss(),
sveltekit(),
// Add Codecov plugin for bundle analysis - disabled during testing
...process.env.NODE_ENV !== 'test'
? [
codecovSvelteKitPlugin({
enableBundleAnalysis: true,
bundleName: 'open-edu-sveltekit',
uploadToken: process.env.CODECOV_TOKEN,
telemetry: false // Privacy-conscious default
})
]
: [],
paraglideVitePlugin({
project: './project.inlang',
outdir: './src/lib/paraglide'
})
],
define: {
// Inject version from package.json into the app
'import.meta.env.VITE_APP_VERSION': JSON.stringify(packageJson.version)
},
test: {
expect: { requireAssertions: true },
testTimeout: 30000, // 30 seconds timeout per test
hookTimeout: 10000, // 10 seconds timeout for setup/teardown
// Only run non-browser tests (Svelte component tests need browser mode)
include: ['src/**/*.{test,spec}.{js,ts}'],
exclude: [
'src/**/*.svelte.{test,spec}.{js,ts}', // Browser mode tests excluded
'src/lib/server/**',
'node_modules/',
'static/',
'scripts/',
'build/',
'dist/'
],
coverage: {
// Coverage disabled by default due to SvelteKit SSR conflicts
// Use npm run test:coverage:simple for coverage reports
enabled: false,
provider: 'v8',
reporter: ['text', 'json', 'html', 'lcov'],
exclude: [
'node_modules/',
'src/test/',
'**/*.config.{js,ts}',
'**/*.spec.{js,ts}',
'**/*.svelte.spec.{js,ts}',
'static/',
'scripts/',
'.env.*',
'build/',
'dist/',
'sample-templates/',
'roadmap/',
'coverage/'
],
include: ['src/lib/**/*.{js,ts}'] // Exclude SSR routes and Svelte components to prevent SSR conflicts
}
}
});