-
-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathvitest.config.ts
More file actions
66 lines (64 loc) · 2.87 KB
/
Copy pathvitest.config.ts
File metadata and controls
66 lines (64 loc) · 2.87 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
import { defineConfig } from "vitest/config";
const junitPath = process.env.VITEST_JUNIT_PATH;
export default defineConfig({
ssr: {
noExternal: ["agents", "partyserver"],
},
resolve: {
alias: {
"cloudflare:email": new URL("./test/stubs/cloudflare-email.ts", import.meta.url).pathname,
"cloudflare:workers": new URL("./test/stubs/cloudflare-workers.ts", import.meta.url).pathname,
},
},
test: {
environment: "node",
globals: true,
testTimeout: 15000,
// Retry a failed test once before failing the run. The loopover gate auto-CLOSES a contributor PR
// on a red required CI, so a single transient flake must not kill an honest PR; a deterministic
// failure still fails both attempts (and vitest flags the retried test as flaky so it stays visible).
retry: 1,
include: ["test/**/*.test.ts"],
exclude: ["test/workers/**/*.test.ts"],
reporters: junitPath ? ["default", "junit"] : ["default"],
...(junitPath ? { outputFile: { junit: junitPath } } : {}),
coverage: {
provider: "v8",
include: [
"src/**/*.ts",
"packages/loopover-engine/src/**/*.ts",
"packages/loopover-miner/lib/**/*.js",
// review-enrichment is a standalone (non-workspace) package with its own node:test suite; its
// coverage is collected separately via `npm run rees:coverage` (c8 over the built dist, remapped
// to src through source maps) and uploaded to Codecov under the `rees` flag -- vitest never runs
// it, so it must not be listed here (an entry here just reports 0% for files vitest can't reach).
],
exclude: ["src/env.d.ts", "apps/**"],
// Emit lcov for Codecov to compute patch (changed-lines) coverage.
reporter: ["text", "lcov"],
// The 99% requirement now lives in codecov.yml as a *patch* gate (changed
// lines only), which is compositional: merging one PR can't drop another
// below the bar. These global thresholds are only a loose catastrophe net
// (e.g. a deleted test file), set well below actual coverage so routine
// PRs never trip them. Do NOT raise these toward the real coverage number
// or the cross-PR churn returns.
//
// Disabled when COVERAGE_NO_THRESHOLDS is set: CI shards the suite, and a
// single shard only exercises part of the tree, so a per-shard global
// threshold would always false-fail. CI gates coverage via Codecov on the
// merged shards instead; this backstop still runs on the full local
// `npm run test:coverage`. Spread-omit the key (rather than set it to
// undefined) to satisfy exactOptionalPropertyTypes.
...(process.env.COVERAGE_NO_THRESHOLDS
? {}
: {
thresholds: {
lines: 90,
functions: 90,
branches: 90,
statements: 90,
},
}),
},
},
});