-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbunfig.toml
More file actions
91 lines (86 loc) · 5.23 KB
/
Copy pathbunfig.toml
File metadata and controls
91 lines (86 loc) · 5.23 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# Runtime configuration for bun. Today this file exists for one reason only:
# making test coverage a measured, blocking gate instead of a number nobody
# looks at.
#
# Every key below was verified against the installed binary (bun 1.3.14) rather
# than taken from memory or from the docs — `strings $(which bun) | grep -i
# coverage` lists exactly seven coverage keys, and bun ignores anything else
# SILENTLY. A typo here does not error: it produces a gate that always passes.
# If you edit this file, re-run `bun run test:coverage` and check that the
# coverage table still prints. Silence is the failure mode, not a stack trace.
[test]
# ---------------------------------------------------------------------------
# There is deliberately NO `coverage = ...` key here. Do not add one.
#
# Writing `coverage = false` — the documented default, so it reads as a harmless
# no-op — actually OVERRIDES the `--coverage` CLI flag on bun 1.3.14. With that
# line present, `bun test --coverage` prints no table, measures nothing, and
# passes every threshold below. Omitting the key is what keeps coverage opt-in
# per run while leaving the flag functional.
#
# Opt-in is what we want: coverageThreshold is checked against every file loaded
# by the run, so turning coverage on globally would make `bun test packages/cli/
# src/git` on a single file trip the gate constantly and train everyone to
# ignore it. Coverage belongs to the full-suite script and to CI.
# ---------------------------------------------------------------------------
# Test files are not shipped code, and they are ~100% covered by construction
# (a test file runs start to finish), so counting them pads the numbers and
# hides regressions in the code that actually reaches users. bun already leaves
# them out of the table here, but this default has moved between versions — pin
# it rather than inherit whatever the next bun decides.
coverageSkipTestFiles = true
# packages/contract is built (`build:contract`) before the suite runs, and both
# packages/cli and packages/web import the BUILT `packages/contract/dist/index.mjs`
# rather than the sources. Without this exclusion that bundle appears in the
# table as a ~2400-line generated file at ~59% lines: the same logic as
# packages/contract/src/*.ts, which is already measured at ~100%, just counted a
# second time in minified form. Measuring a build artifact says nothing about
# test quality — and because bun checks the threshold per file (see below), that
# one artifact alone would pin the floor to 59% forever.
coveragePathIgnorePatterns = ["**/dist/**"]
# ---------------------------------------------------------------------------
# coverageThreshold is enforced PER FILE, not on the "All files" aggregate.
#
# This is the single most surprising thing about bun's coverage gate and it is
# not what the docs imply. Verified experimentally on bun 1.3.14 with a two-file
# fixture (one file at 100% functions, one at 50%, aggregate 75%):
#
# coverageThreshold = { functions = 0.6, lines = 0.0 } -> exit 1
# coverageThreshold = { functions = 0.5, lines = 0.0 } -> exit 0
#
# 0.6 fails even though the aggregate is 75%, and 0.5 passes because that is the
# WORST file. The effective threshold is therefore min(per-file), which for this
# repo is dictated by its least-tested module, not by its overall health.
#
# Second trap: a partial table fills the metrics you omit with the value you
# gave. `{ lines = 0.85 }` also applies 0.85 to functions and fails instantly on
# any file without full function coverage. ALWAYS write both keys explicitly.
#
# Values are fractions (0-1): 0.02 means 2%, not 2.
# ---------------------------------------------------------------------------
#
# Where these two numbers come from — full suite, 3600 tests across 93 files,
# build artifacts excluded, aggregate 86.55% functions / 85.94% lines:
#
# functions: five files sit at exactly 0.00% (open.ts, notify.ts, export.ts,
# show.ts, DiffView.vue — all untested today), so any non-zero
# per-file function floor fails the build on day one. 0.0 is the
# only value that passes right now. It gates nothing yet; it is
# here so the key exists and cannot be forgotten when those files
# get their first tests. Raise it the moment the worst one moves.
#
# lines: the worst file is useFixPrompt.ts at 2.94%, so 0.02 is the
# highest floor the repo currently clears. Weak, but not nothing:
# it blocks a brand-new module whose lines never execute at all.
#
# This is a ratchet, and its rungs are low on purpose so that it is green today.
# When you add tests to one of the files named above, raise the corresponding
# floor to the new worst-file value in the SAME pull request — that is the only
# thing keeping this from decaying into a rubber stamp. Never lower a value to
# turn a build green: that trades a one-line diff for the entire signal.
#
# Because these are per-file floors, they cannot catch a slow slide in overall
# coverage. That aggregate check lives in scripts/coverage-gate.mjs (run by the
# `test:coverage` script): it reads the "All files" row and fails below 86%
# functions / 85% lines. The two halves are complementary — keep both.
coverageThreshold = { functions = 0.0, lines = 0.02 }