-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvitest.config.ts
More file actions
62 lines (60 loc) · 2.24 KB
/
Copy pathvitest.config.ts
File metadata and controls
62 lines (60 loc) · 2.24 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
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
import { resolve, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
const rootDir = dirname(fileURLToPath(import.meta.url));
export default defineConfig({
plugins: [react()],
define: {
__APP_VERSION__: JSON.stringify('0.0.0-test'),
},
resolve: {
alias: {
'@': resolve(rootDir, 'src'),
'#shared': rootDir,
},
},
test: {
environment: 'jsdom',
globals: true,
setupFiles: ['./vitest.setup.ts'],
include: ['src/**/*.test.{ts,tsx}'],
css: false,
// Flaky-test containment (#489): in CI, retry a failing test up to twice before failing the job,
// so an intermittent async-render race SURFACES (Vitest reports the retry) without red-flaking a
// green suite. Locally `retry: 0` keeps failures loud + fast. A retry is a signal to de-flake,
// never a way to hide a real failure.
retry: process.env.CI ? 2 : 0,
coverage: {
provider: 'v8',
all: true,
include: ['src/**/*.{ts,tsx}'],
exclude: [
'src/**/*.test.{ts,tsx}',
'src/**/*.d.ts',
'src/types/**',
// Entry glue: DOM mounting + service-worker-adjacent wiring — no meaningful branches.
'src/entries/**',
// The MV3 module service worker (#68): behaviour-frozen chrome.* runtime glue, validated by
// the browser SW-registration harness (e2e/sw/), not jsdom unit tests — same rationale as
// src/content/**. (@ts-nocheck infra; not unit-testable without a browser.)
'src/background/**',
// Content-script interception shims (#68): MAIN/isolated-world DOM-glue that reassigns
// native URL-consuming globals. Not unit-testable in jsdom — validated by build.js bundle
// guards, the tests/*.test.mjs source assertions, and e2e; same rationale as entries/.
'src/content/**',
// Locale message tables (data, not logic).
'src/i18n/messages/**',
// Test-only helpers (render harness, mock transport).
'src/test/**',
],
reporter: ['text', 'text-summary'],
thresholds: {
lines: 80,
branches: 80,
functions: 80,
statements: 80,
},
},
},
});