Repository navigation
Expand file tree
/
Copy pathvitest.config.js
More file actions
43 lines (42 loc) · 2.1 KB
/
Copy pathvitest.config.js
File metadata and controls
43 lines (42 loc) · 2.1 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
// Vitest configuration for binthere.
//
// Tests run inside the real workerd runtime via @cloudflare/vitest-pool-workers so
// that Web Crypto, CompressionStream, KV, and the BurnPaste Durable Object behave
// exactly as they do in production (crucial for the burn-after-read concurrency test).
import { cloudflareTest } from '@cloudflare/vitest-pool-workers';
import { defineConfig } from 'vitest/config';
export default defineConfig({
plugins: [
cloudflareTest({
wrangler: { configPath: './wrangler.toml' },
miniflare: {
// Rate limiting binding isn't emulated locally; the code fails open, so
// tests exercise creation without it. Everything else comes from wrangler.toml.
compatibilityDate: '2025-10-11',
// workerd can fire unhandledrejection before a same-checkpoint .catch()
// attaches (workerd#4042); DecompressionStream errors both stream sides
// and trips this, which vitest 4 then reports as an unhandled error.
// This flag defers the event until the microtask checkpoint completes.
compatibilityFlags: ['unhandled_rejection_after_microtask_checkpoint'],
},
}),
],
test: {
// The CLI's suites run in plain Node via their own project
// (cli/vitest.config.js), and the DOM-mount suites run under happy-dom
// (vitest.dom.config.js) — keep both out of the workerd pool.
exclude: ['**/node_modules/**', 'cli/**', 'test-dom/**'],
coverage: {
// istanbul (source instrumentation), NOT v8: the v8 provider needs
// node:inspector, which doesn't exist inside workerd.
provider: 'istanbul',
include: ['src/**/*.js', 'public/js/**/*.js'],
// Vendored library and browser-only glue with no DOM test harness
// (see README roadmap: Playwright e2e would cover these).
exclude: ['public/js/qrcode.js', 'public/js/{api,ui,app,theme,theme-init,announce,stars}.js'],
// Floors, not targets — catch a large untested addition, don't block
// small refactors. Measured 2026-07: ~84% statements / ~79% branches.
thresholds: { statements: 80, branches: 70 },
},
},
});