Automatically ratchet up coverage thresholds instead of hand-maintaining them
Maintainer thường phản hồi trong vòng 1 ngày
@YuryShkoda đang làm issue này rồi.
Từ ngày 3/7/2026.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Problem
jest.config.js hardcodes coverageThreshold.global as fixed numbers:
coverageThreshold: {
global: {
statements: 73,
branches: 60.55,
functions: 73.54,
lines: 74
}
}
These only get updated when someone notices npm run test:mocked failing (threshold not met) and manually edits the numbers — usually while already deep in an unrelated PR. This has two failure modes:
- Silent stagnation: when coverage improves, nothing bumps the threshold up, so the safety net stays looser than it could be indefinitely.
- Noisy, unrelated diffs: when coverage regresses, whoever's PR happens to trip the threshold has to manually figure out the right new number and edit CI-adjacent config as a side quest to their actual change.
We want this to self-maintain, the same way semantic-release (already used in this repo's npmpublish.yml) self-maintains the package version — no human edits jest.config.js by hand for this again.
Goal
Coverage thresholds should only ever move in the safe direction (up when real coverage improves) automatically, and a genuine regression should still fail CI clearly - never be silently masked.
Two viable approaches — needs a decision before implementation
Option A: custom script + CI auto-commit (self-hosted, more code to own)
- A script (e.g.
scripts/updateCoverageThresholds.js) runs afternpm run test:mockedand readscoverage/coverage-summary.json. - For each of the four metrics, if actual coverage > current
jest.config.jsthreshold, rewritejest.config.jswith the new value rounded down slightly (e.g. -0.5pt buffer) rather than an exact match, so a trivial/flaky variance between runs doesn't immediately fail the next build. - Never auto-lowers a threshold — only ratchets up. A real regression still fails the existing
test:mockedstep exactly as it does today, forcing a human decision (fix the coverage, or consciously accept + explain the drop in the PR). - Runs as a step in a workflow triggered on
pushtomain(mirroringnpmpublish.yml's trigger) — after a PR has already merged, not as part of PR checks — and pushes a bot commit likechore: bump coverage thresholdsdirectly tomain, the same way semantic-release pushes its version-bump commit. - Needs: write access from the Action to
main(existingGITHUB_TOKENwith contents:write, or a PAT if branch protection requires it), and a guard so the bot's own commit doesn't re-trigger itself in a loop.
Option B: external coverage service (Codecov / Coveralls) - likely less code to build and maintain
- These already solve exactly this class of problem: instead of a static number in the repo, they compare each PR's coverage against the base branch and post a status check like "coverage decreased by X% - failing" or "coverage increased - no threshold to maintain at all."
- No
jest.config.jsnumbers to bump, no bot-commit workflow to build/maintain, PR-level annotations showing exactly which lines lost coverage, and a badge for the README as a bonus. - Trade-off: adds a third-party dependency (an account + a small config file, e.g.
codecov.yml), and CI needs to upload the coverage report (coverage/lcov.info) to the service each run. - This repo already uses
artiomtr/jest-coverage-report-actioninrun-tests.ymlfor PR coverage comments - worth checking whether it (or a config tweak to it) already covers this need before adding another service.
Suggested next step
- Decide between Option A and Option B (see trade-offs above) - or confirm neither and reconsider
artiomtr/jest-coverage-report-action's existing capabilities first, since it's already wired intorun-tests.yml. - If Option A: write
scripts/updateCoverageThresholds.js, wire it into a new (or existing, post-merge) workflow step, decide the exact buffer value, and add the loop-prevention guard for the bot's own commits. - If Option B: pick a service, add the upload step to
run-tests.yml, configure its ratcheting/regression rules, and remove the now-redundantcoverageThresholdblock fromjest.config.js. - Either way: document the chosen mechanism (e.g. in
CONTRIBUTING.mdor a code comment nearcoverageThreshold) so contributors know they should never hand-edit the threshold numbers going forward.
Non-negotiable
Whichever option is picked, a genuine coverage regression must still fail CI loudly - this issue is about removing manual upkeep of the good direction (raising the bar), not about loosening enforcement.
- Ngôn ngữ chính
- TypeScript
- Star
- 41
- Fork
- 6
- Merge trung bình
- 7 giờ 12 phút
- Pull request đã merge (30 ngày)
- 26
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của sasjs/cli
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 30/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Mocked test suite (`npm run test:mocked`) is too slow — speed it up without losing coverageCó thể làm lại được @YuryShkoda đã nhận 120 ngày trước và không có pull request nào đang mở. Đang mởrefactoring
sasjs/cli#1452 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Move all HTTP requests to @sasjs/adapterCó thể làm lại được @YuryShkoda đã nhận 1173 ngày trước và không có pull request nào đang mở. Đang mởadapter refactoring
sasjs/cli#1369 · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Fetch parent session log when job fails without recording logCó thể làm lại được @YuryShkoda đã nhận 1151 ngày trước và không có pull request nào đang mở. Đang mở
sasjs/cli#1350 · 1 reaction · 1 người được giao ·
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Northeastern-Electric-Racing/FinishLine#4660 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
excaliburjs/Excalibur#3895 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
infer_audio_type only recognises one MPEG Layer III frame header, so most MP3 files are rejectedCó thể đã có người làm @Steve-20-ai đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Earn report crashes with "RangeError: Invalid time value" when a report row has an unparsable timestampCó thể đã có người làm @Gurkaran18 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
joinmarket-webui/jam#1588 ·
Maintainer thường phản hồi trong vòng 3 ngày
-
BeOS .json missingĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
mihaip/infinite-mac#475 ·