chore(#106): move api coverage config out of the inline test:run script - #158
Conversation
- Move Node's test-runner coverage config (thresholds + excludes + isolation) into apps/api/node.config.json under the testRunner namespace, loaded via --experimental-default-config-file, so test:run is a legible one-liner - Preserve the enforced floors (lines 80 / branches 75 / functions 75), all five coverage excludes, source maps, and isolation=none unchanged - --env-file stays inline (Node reads it at early bootstrap, before config-file namespaces are applied) - Correct stale api coverage floors in root CLAUDE.md (documented 80/90; the actually-enforced floors were 75/75) and point both CLAUDE.md files at the new config file Refs #106
|
Warning Review limit reached
Next review available in: 38 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughAPI test coverage, source-map, isolation, threshold, and exclusion settings move from the test script into ChangesAPI test runner configuration
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/api/node.config.json`:
- Around line 2-17: Align the supported Node.js version across
apps/api/package.json, apps/api/node.config.json, and .claude/CLAUDE.md: raise
the package runtime floor above Node 23.10.0 to support test:run’s experimental
configuration flag, and update the documented version accordingly. If supporting
Node 25.4.0 or newer, rename the node.config.json testRunner key to test;
otherwise pin the runtime to the chosen supported version and keep the existing
configuration key.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: e9b1aeb9-1f13-4dbc-acaf-70ec9fe18cb8
📒 Files selected for processing (4)
.claude/CLAUDE.mdapps/api/.claude/CLAUDE.mdapps/api/node.config.jsonapps/api/package.json
CodeRabbit flagged that test:run now depends on --experimental-default-config-file (Node 23.10.0+), while engines.node declared >=22. Raise the floor to >=24 to match the pinned runtime (.nvmrc 24.15.0, used by CI) and clear the flag's minimum. Keep the testRunner namespace — the test rename is Node 25.4.0+, out of scope. - package.json: engines.node ">=22" -> ">=24" - .claude/CLAUDE.md + apps/api/.claude/CLAUDE.md: docs "Node >= 22" -> ">= 24" Refs #106 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Summary
apps/api/node.config.json— Node's built-in test-runner config file (loaded via--experimental-default-config-file). Coverage thresholds, the five excludes, andtest-isolationnow live under thetestRunnernamespace, andenable-source-mapsundernodeOptions. This is the mechanism the issue's first option hoped for, so no wrapper script is needed.test:runis now a one-liner —node --experimental-default-config-file --env-file=.env.test --test "**/*.test.ts", down from a ~500-char inline flag wall that was hard to read and edit.isolation=none, same source maps.--env-filestays inline because Node reads it at early bootstrap, before config-file namespaces are applied; it was never part of the coverage sprawl.CLAUDE.mddocumented the api floors as branches 80 / functions 90, but the actually-enforced floors were 75 / 75. Fixed, and bothCLAUDE.mdfiles now point at the config file.Testing
Verified locally without the DB-backed suite (a
git worktreehas nonode_modules, and no marsa Postgres is up here — the full build+test run is CI's integration gate):v24.11.1: coverage thresholds are enforced (a 50% functions figure vs a 75% floor exits 1; lowering the floor exits 0), and excludes apply.testRunner(test-isolation, notexperimental-test-isolation);env-fileis rejected in the config file, hence kept inline.node.config.jsonparses as valid JSON and loads on Node with no validation errors.format:checkpasses on all four changed files (prettier 3.8.3). Changes are JSON + Markdown only, solint({src,test}/**/*.ts) is unaffected.CI runs the full
pnpm --filter api testpipeline (clean → build → test:setup → test:run) against Postgres — that is where end-to-end parity is confirmed.Refs #106
Notes
test:runnow relies on two--experimental-*flags:--experimental-default-config-fileand the pre-existing--experimental-test-coverage. The config-file feature is the sanctioned way to externalise these flags on Node 24, but it is experimental and its shape could change in a future major.Glossary
node.config.json--experimental-default-config-file(loads it from cwd) or--experimental-config-file=<path>.testRunnernamespacenode.config.jsonfor test-runner CLI flags (coverage, isolation) that are not permitted inNODE_OPTIONS. Flags that are permitted inNODE_OPTIONSgo undernodeOptionsinstead.test-isolationprocess) or all in one (none). Set tononehere for shared setup and speed. The config-file key omits theexperimental-prefix that the CLI flag carries.--env-filenode.config.jsonand stays inline in the script.Summary by CodeRabbit
Tests
Documentation