Enforce a coverage threshold in `jest.config.js` and report it in CI
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- Half a day
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- github-actions, nodejs, typescript
Research direction
Start in jest.config.js, where collectCoverageFrom and coverageDirectory are set, and in .github/workflows/build-check.yml, where the existing test step runs around lines 31-36. Run npm run test:cov locally to record the baseline, then add a coverageThreshold.global at or below it and a CI step that runs the same command and uploads the coverage directory as an artifact. Done when the threshold is set, the baseline is recorded, lcov is in coverageReporters, and CI passes on main.
Written by the indexing model from the issue text.
Description
Problem
jest.config.js collects coverage but sets no threshold:
collectCoverageFrom: ['**/*.(t|j)s'],
coverageDirectory: '../coverage',
There is no coverageThreshold, and .github/workflows/build-check.yml never runs npm run test:cov — it runs npm test -- --runInBand with a narrow path filter (lines 31-36). So coverage is collected only when a developer opts in locally, and nothing prevents it from falling.
Two contributing factors: 68 of 106 services have no colocated spec (see the other test issues in this batch), and five specs under test/ are never executed at all because rootDir: 'src'.
Why it matters
ROADMAP.md lists "Reach 80% code coverage across all modules" as a v0.2.0 goal. With no threshold in place and coverage never computed in CI, there is no mechanism to measure progress toward that goal — so it cannot be met or missed, just asserted.
Suggested Direction
- Measure first. Run
npm run test:covon the currentmainand record the real numbers in a comment or indocs/. Whatever they turn out to be, that is the honest baseline. - Set a ratchet, not an aspirational number. Pick thresholds at or just below the measured baseline:
Then raise them as coverage improves. A threshold above current reality fails CI on the first run and gets deleted; a ratchet below it holds the line.coverageThreshold: { global: { branches: <b>, functions: <f>, lines: <l>, statements: <s> }, }, - Add a CI step in
.github/workflows/build-check.ymlrunningnpm run test:cov, and upload the coverage report as an artifact so reviewers can inspect it. - Consider
coverageReporters: ['text', 'lcov']so the lcov output is usable by an external service.
Constraints
- Do not combine the threshold with a large test-writing push — land the ratchet first, then raise it. Otherwise the PR is unreviewable.
- Leave
test/out ofcoverageThresholduntil the unreachable-spec issue is resolved, or the threshold will be calculated against a partial picture. - Keep the existing narrow test-path filter in the main CI job as-is; this is additive.
Acceptance Criteria
-
coverageThreshold.globalis set injest.config.jsat or below the measured current baseline. - The measured baseline numbers are recorded in the issue or
docs/. - CI runs
npm run test:covand passes on the currentmain. - A coverage report is uploaded as a CI artifact.
-
coverageReportersincludeslcov.
- Dominant language
- TypeScript
- Stars
- 7
- Forks
- 55
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 5
Getting set up
- Ships a Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from SourceXXL/alian_structure-api
-
good first issue help wanted security
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SourceXXL/alian_structure-api#266 ·
-
Parallelize the cache-warming loop in `cache-warming.service.ts` — warmers run strictly sequentiallyPossibly taken @syntaxsuuvam-spec claimed this 3 days ago. Opengood first issue performance
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SourceXXL/alian_structure-api#240 ·
-
documentation help wanted intermediate refactor
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
SourceXXL/alian_structure-api#215 ·
-
good first issue refactor tooling
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
SourceXXL/alian_structure-api#199 ·
-
help wanted intermediate refactor
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
SourceXXL/alian_structure-api#196 ·
All issues in SourceXXL/alian_structure-api
Similar issues
-
afk-ok area:data-quality importer size:S
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
enorm-labs/event-junkie#3301 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
one-zero-eight/apply-bot#39 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bigbluebutton/bbb-ui-components-react#108 ·
Maintainers usually reply within 2 days
-
area: app type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
ExpidetGames/code-reviewer#308 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day