-
Notifications
You must be signed in to change notification settings - Fork 0
/
vite.config.ts
64 lines (63 loc) · 2.08 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
52
53
54
55
56
57
58
59
60
61
62
63
64
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { defineConfig } from 'vite';
import tsconfigPaths from 'vite-tsconfig-paths';
import { configDefaults } from 'vitest/config';
export default defineConfig({
plugins: [
tsconfigPaths(),
svelte({
hot: !process.env.VITEST, // disabling Svelte's hot module reload when tests are running
exclude: ['./src/lib/wc/MyCounter.wc.svelte'], // exclude web components lib
}),
// used only for compiling svelte components to web components
svelte({
include: ['./src/lib/wc/MyCounter.wc.svelte'],
compilerOptions: {
customElement: true,
},
}),
],
server: {
port: 5500,
},
test: {
// to see how your tests are running in real time in the terminal, add "default"
// to generate HTML output and preview the results of your tests, add "html"
reporters: ['default', 'html'],
environment: 'jsdom', // mocking the DOM API
globals: true, // use APIs globally like jest
setupFiles: ['src/setup-test.ts'],
exclude: [...configDefaults.exclude, 'e2e/*'],
// Will call .mockRestore() on all spies before each test. This will clear mock history and reset its implementation to the original one.
restoreMocks: true,
coverage: {
provider: 'istanbul', // 'istanbul' / 'v8'
reporter: ['text', 'json', 'html'],
statements: 50,
branches: 50,
functions: 50,
lines: 50,
exclude: [
'coverage/**',
'dist/**',
'packages/*/test{,s}/**',
'**/*.d.ts',
'cypress/**',
'test{,s}/**',
'test{,-*}.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}test.{js,cjs,mjs,ts,tsx,jsx}',
'**/*{.,-}spec.{js,cjs,mjs,ts,tsx,jsx}',
'**/__tests__/**',
'**/{karma,rollup,webpack,vite,vitest,jest,ava,babel,nyc,cypress,tsup,build}.config.*',
'**/.{eslint,mocha,prettier}rc.{js,cjs,yml}',
// above is default
'src/setup-test.ts',
'src/main.ts',
'src/mocks/**',
'src/assets/**',
'src/lib/**',
'src/i18n/**',
],
},
},
});