-
Notifications
You must be signed in to change notification settings - Fork 136
Expand file tree
/
Copy pathvitest.config.mts
More file actions
74 lines (72 loc) · 3.22 KB
/
Copy pathvitest.config.mts
File metadata and controls
74 lines (72 loc) · 3.22 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
63
64
65
66
67
68
69
70
71
72
73
74
import { defineConfig } from 'vitest/config'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { semioticSourceAliases } from './vite.shared.mjs'
const repoRoot = dirname(fileURLToPath(import.meta.url))
export default defineConfig({
resolve: {
// Exercise the package's public import paths against current source rather
// than an optional, ignored, and potentially stale local dist build.
alias: semioticSourceAliases(repoRoot)
},
test: {
globals: true,
environment: 'jsdom',
setupFiles: ['./src/setupTests.ts'],
exclude: [
'node_modules',
'dist',
'integration-tests/**',
// The `codemod/` directory is a self-contained sibling package
// with its own jest test runner. Exclude its test files (and the
// nested node_modules vitest auto-walks into) so Semiotic's vitest
// doesn't try to run jscodeshift internals.
'codemod/**',
// check-file-size.test.mjs uses the Node built-in test runner
// (`node --test`), not vitest — it imports `node:test` directly,
// which vitest's bundler can't resolve. Exclude it so vitest's
// default *.test.mjs glob doesn't sweep it in.
'scripts/**/*.test.mjs'
],
coverage: {
provider: 'v8',
// Coverage must use a fixed production denominator. Without `include`,
// Vitest reports only modules imported by a particular test run, which
// lets an untested production module disappear from the percentage.
include: ['src/components/**/*.{ts,tsx,js,jsx}'],
reporter: ['text-summary', 'json'],
exclude: [
'node_modules/**',
'dist/**',
'integration-tests/**',
'codemod/**',
// Vitest matches coverage include globs against a filename substring;
// without this exclusion, `docs/src/components/**` also matches the
// production root pattern above.
'docs/**',
],
thresholds: {
// Global floors raised toward the measured aggregate (~78/68/81/80) so
// the gate bites a real regression instead of leaving ~16 points of
// slack on branches. A ~6-point buffer absorbs normal churn.
statements: 72,
branches: 62,
functions: 76,
lines: 74,
// Per-file floors so the gate bites where risk concentrates, not just
// on the blended average (a thin file eroding barely moves the global
// number). Set just below current measured coverage — they ratchet
// against regression. Raise the frame floors as frame-level behavioral
// tests are added (the Stream Geo/Network frames are the least covered).
'src/components/stream/StreamGeoFrame.tsx': { statements: 33, branches: 30, functions: 36, lines: 34 },
'src/components/stream/StreamNetworkFrame.tsx': { statements: 33, branches: 30, functions: 34, lines: 37 },
'src/components/stream/pipelineTransitions.ts': { statements: 52, branches: 38, functions: 30, lines: 55 },
'src/components/charts/network/processSankey/algorithm.ts': { statements: 80, branches: 74, functions: 76, lines: 82 },
}
},
benchmark: {
include: ['benchmarks/**/*.bench.ts'],
exclude: ['node_modules', 'dist']
}
}
})