Repository navigation
Expand file tree
/
Copy pathvitest.config.ts
More file actions
52 lines (51 loc) · 2.03 KB
/
Copy pathvitest.config.ts
File metadata and controls
52 lines (51 loc) · 2.03 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
import { defineConfig, coverageConfigDefaults } from 'vitest/config';
import path from 'path';
export default defineConfig({
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
// See vite.config.ts for why these resolve to the in-tree vendored bundle.
'@dosya-dev/e2ee-core': path.resolve(__dirname, './vendor/e2ee-core/index.js'),
'@dosya-dev/e2ee-client': path.resolve(__dirname, './vendor/e2ee-client/index.js'),
'@dosya-dev/audio-player': path.resolve(__dirname, './vendor/audio-player/index.ts'),
},
},
test: {
environment: 'jsdom',
globals: false,
include: ['src/**/*.test.{ts,tsx}'],
// TurnstileWidget deliberately renders nothing when no sitekey is
// configured, and .env is gitignored so CI has none - without this the
// widget's own tests would silently exercise the skip path and fail on a
// render() that never happened. Cloudflare's public always-passes test
// sitekey keeps the real render path under test everywhere.
env: {
VITE_TURNSTILE_SITEKEY: '1x00000000000000000000AA',
},
coverage: {
provider: 'v8',
reporter: ['text-summary', 'lcov'],
reportsDirectory: './coverage',
// Without this, vitest's exclude list only filters the untested-file
// glob; raw V8 process coverage passes straight into the report
// unfiltered - this is what let vendor/e2ee-* leak in as "covered".
excludeAfterRemap: true,
// Positive filter: only first-party source under src/ counts. vendor/
// holds the in-tree e2ee-core/e2ee-client bundle (see the alias above)
// - it must never count toward coverage, since re-vendoring it would
// move the number without a single test changing.
include: ['src/**'],
exclude: [
...coverageConfigDefaults.exclude,
'**/*.test.ts',
'**/*.unit.test.ts',
'**/*.int.test.ts',
'**/test-stubs/**',
'**/dist/**',
'**/vendor/**',
'**/node_modules/**',
'**/*.config.ts',
],
},
},
});