-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
47 lines (45 loc) · 1.66 KB
/
Copy pathvitest.config.ts
File metadata and controls
47 lines (45 loc) · 1.66 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
/// <reference types="vitest/config" />
import path from 'node:path'
import { defineConfig } from 'vitest/config'
// Unit tests configuration only
export default defineConfig({
test: {
name: 'unit',
environment: 'happy-dom',
globals: true,
include: [
'src/**/*.{spec,test}.{js,jsx,ts,tsx}',
'src/**/__tests__/**/*.{js,jsx,ts,tsx}',
],
exclude: ['src/types/__tests__', 'src/**/*.stories.{js,jsx,ts,tsx}'],
setupFiles: ['setupTests.ts'],
// Coverage (#127): v8 provider, per-surface repo-relative reportsDirectory;
// `all: true` so untested files (incl. 0% ones) appear in the baseline.
coverage: {
provider: 'v8',
reporter: ['text-summary', 'json', 'lcov'],
reportsDirectory: 'coverage/unit-web',
// `include` is the explicit allowlist; in vitest 4 this also pulls in
// untested files (reported at 0%), which is the old `all: true` behavior.
include: ['src/**/*.{ts,tsx}'],
exclude: [
'src/**/*.{test,spec}.{ts,tsx}',
'src/**/__tests__/**',
'src/**/*.stories.{ts,tsx}',
'src/types/**',
'**/*.d.ts',
],
},
},
resolve: {
// Mirror tsconfig `paths`: `@/electron/*` -> ./electron/*, `@/*` -> ./src/*.
// The `@/electron` entry MUST come first so vite's prefix match resolves it
// before the broader `@` alias (which would otherwise rewrite it to
// ./src/electron and fail). Renderer code legitimately runtime-imports from
// electron/ (e.g. isFloatingNavigatorEnvironment, the shared IPC default).
alias: {
'@/electron': path.resolve(__dirname, './electron'),
'@': path.resolve(__dirname, './src'),
},
},
})