summaryrefslogtreecommitdiff
path: root/vite.config.js
blob: 643e78cdd4442900d9754f65002a8f42f0ac268a (plain)
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
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
import { configDefaults } from 'vitest/config';
import { svelteTesting } from '@testing-library/svelte/vite';

export default defineConfig({
  plugins: [sveltekit(), svelteTesting()],
  test: {
    // If you are testing components client-side, you need to setup a DOM environment.
    // If not all your files should have this environment, you can use a
    // `// @vitest-environment jsdom` comment at the top of the test files instead.
    environment: 'jsdom',
    clearMocks: true,
    restoreMocks: true,
    coverage: {
      thresholds: {
        statements: 12,
        branches: 85,
        functions: 75,
        lines: 12,
      },
      exclude: [...configDefaults.exclude, '**/*.config.js', '**/docs/**', '**/target/**'],
    },
  },
  // Tell Vitest to use the `browser` entry points in `package.json` files,
  // even though it's running in Node
  resolve: process.env.VITEST ? { conditions: ['browser'] } : undefined,
  server: {
    fs: {
      allow: ['ui'],
    },
    proxy: {
      '/api': process.env['API_SERVER'] || 'http://localhost:64209',
    },
  },
});