-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathvite.config.ts
51 lines (49 loc) · 1.6 KB
/
vite.config.ts
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
import { configDefaults, defineConfig } from 'vitest/config';
import { fileURLToPath } from 'url';
import { readFileSync } from 'fs';
import { sveltekit } from '@sveltejs/kit/vite';
import { svelteTesting } from '@testing-library/svelte/vite';
import tailwindcss from '@tailwindcss/vite';
const file = fileURLToPath(new URL('package.json', import.meta.url));
const json = readFileSync(file, 'utf8');
const pkg = JSON.parse(json);
export default defineConfig({
plugins: [sveltekit(), svelteTesting(), tailwindcss()],
define: {
PUBLIC_VERSION: JSON.stringify(pkg.version)
},
test: {
environment: 'jsdom', // we're making a web app, so we want a web-like environment
globals: true, // avoid having to import things like "describe" and "expect"
include: ['./src/**/*.{test,spec}.{js,ts}'],
setupFiles: ['./test/test-setup.ts'],
reporters: ['default', 'junit'],
outputFile: 'junit.xml',
css: false,
coverage: {
all: true,
include: ['src/**/*.{js,ts,svelte}'],
exclude: [
...(configDefaults.coverage.exclude as string[]),
'**/types.ts', // No code to test
'**/index.{js,ts}', // No code to test
'**/icons/**', // these are svgs/visual - not really testable
'**/routes/**', // tested via e2e
'**/lib/components/views/**', // tested via e2e
'**/lib/components/layout/nav/**' // tested via e2e
],
reporter: ['text', 'cobertura']
}
},
build: {
target: 'es2021',
commonjsOptions: {
strictRequires: true
},
chunkSizeWarningLimit: 2000
},
optimizeDeps: {
// These do not appear to be compatible with the dependency optimizer.
exclude: ['@ukic/web-components']
}
});