Automatically ratchet up coverage thresholds instead of hand-maintaining them
Los mantenedores suelen responder en 1 día
@YuryShkoda ya está trabajando en esto.
Desde el 3/7/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 40
- Forks
- 6
- Merge medio
- 9 h 40 min
- PR fusionados (30 d)
- 18
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de sasjs/cli
-
Dificultad 3/5 Medio día Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Mocked test suite (`npm run test:mocked`) is too slow — speed it up without losing coverageQuizá libre de nuevo @YuryShkoda la tomó hace 115 días y no hay ningún pull request abierto. Abiertorefactoring
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
-
Move all HTTP requests to @sasjs/adapterQuizá libre de nuevo @YuryShkoda la tomó hace 1168 días y no hay ningún pull request abierto. Abiertoadapter refactoring
Los mantenedores suelen responder en 1 día
-
Fetch parent session log when job fails without recording logQuizá libre de nuevo @YuryShkoda la tomó hace 1146 días y no hay ningún pull request abierto. Abierto
sasjs/cli#1350 · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
VictoriaMetrics/victorialogs-datasource#747 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 79/100
Los mantenedores suelen responder en 1 día
-
bug from-studio
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
esengine/DeepSeek-Reasonix#14608 ·
Los mantenedores suelen responder en 1 día
-
triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
getarcaneapp/arcane#4590 ·
Los mantenedores suelen responder en 1 día
-
支持对已取消(cancelled)任务生成报告Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 77/100
Clouditera/VulnHunter#57 ·