Skip to content

Setup test coverage for jest#12

Merged
sergeyklay merged 6 commits into
mainfrom
ci/coverage
Dec 4, 2025
Merged

Setup test coverage for jest#12
sergeyklay merged 6 commits into
mainfrom
ci/coverage

Conversation

@sergeyklay

@sergeyklay sergeyklay commented Dec 4, 2025

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Chores

    • CI workflow updated: node setup and cache key improved, npm install now always runs, coverage upload split into explicit steps, and legacy umbrella flags removed. Added a new automated code-review/configuration policy.
  • Tests

    • JUnit reporting added to test output and a test-results upload step introduced; JUnit artifacts are now ignored.
  • Documentation

    • Coverage badge added to the README.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Update CI workflow to change Node setup quoting, include .nvmrc in npm cache key, always run npm ci --include=dev, and split Codecov upload into two explicit steps; add Jest JUnit reporter and dependency, ignore /junit.xml, add Codecov badge, and introduce a new .coderabbit.yaml policy file.

Changes

Cohort / File(s) Summary
CI workflow
.github/workflows/ci.yml
Unquote node-version-file value (.nvmrc), include .nvmrc hash in npm cache key, remove conditional so npm ci --include=dev always runs, remove obsolete codecov umbrella flags/name, and replace single Codecov usage with two explicit steps: "Upload code coverage" and "Upload test results to Codecov" (explicit inputs: directory, report_type, fail_ci_if_error, token, verbose).
Test reporting config
jest.config.ts
Add reporters config: default reporter plus jest-junit with classNameTemplate: "{filepath}".
Dependencies
package.json
Add jest-junit @ ^16.0.0 (present in both dependencies and devDependencies in this change).
VCS ignores
.gitignore
Add /junit.xml to ignore JUnit test output.
Docs
README.md
Insert Codecov badge line after the CI badge.
Repo policy / automation
.coderabbit.yaml
Add comprehensive CodeRabbit review/configuration file specifying linting/quality rules, file-specific policies, tool integrations, PR automation, and codegen/docstring standards.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Review .github/workflows/ci.yml carefully: verify the cache key/hash syntax, the unquoted .nvmrc usage, the removal of the install gating conditional, and the new Codecov step inputs/conditions.
  • Confirm presence and placement of jest-junit in package.json — having it in both dependencies and devDependencies is suspicious and likely incorrect.
  • Validate jest.config.ts reporter config produces the expected /junit.xml output and that CI picks up the file path.
  • Skim .coderabbit.yaml for unexpected restrictions or overly prescriptive rules that could block CI/PRs.

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the main objective: setting up test coverage reporting for Jest through codecov integration and JUnit XML output.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/coverage

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9365dec and d898d7b.

📒 Files selected for processing (3)
  • .coderabbit.yaml (1 hunks)
  • .github/workflows/ci.yml (2 hunks)
  • package.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • .coderabbit.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/ci.yml
🧰 Additional context used
📓 Path-based instructions (2)
package.json

📄 CodeRabbit inference engine (.cursor/rules/environment.mdc)

Strictly separate dependencies (production code) from devDependencies (build/test/lint tools) in package.json.

Files:

  • package.json
**/package.json

⚙️ CodeRabbit configuration file

  1. Verify that ONLY npm is used - alternative package managers (yarn, pnpm, bun) are forbidden. 2. Ensure package-lock.json is committed and present. 3. Check that no global installations are used (no -g flag). 4. Verify no @latest syntax is used in version specifications. 5. Review dependency versions for security vulnerabilities.

Files:

  • package.json
🧠 Learnings (1)
📚 Learning: 2025-12-04T10:20:44.178Z
Learnt from: CR
Repo: sergeyklay/oar PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-12-04T10:20:44.178Z
Learning: Applies to **/*.test.{ts,tsx} : Structure Jest tests with top-level `describe` blocks for the Component/Function, and nested `describe` blocks for scenarios

Applied to files:

  • package.json
🔇 Additional comments (3)
package.json (3)

76-76: Enriched summary claims dual placement, but code shows only devDependencies.

The enriched summary states: "Added new dependency jest-junit with version ^16.0.0 to both dependencies and devDependencies." However, reviewing the complete file, jest-junit appears only on line 76 in devDependencies. The dependencies section (lines 31–60) doesn't include it. Either the summary is incorrect or there's a discrepancy worth clarifying.


26-26: Previous reporter configuration issue resolved.

The test:coverage script now reads simply "jest --coverage" without the redundant --reporters CLI flags that were flagged in earlier review. This lets the jest.config.ts reporter configuration take precedence as intended. ✓


76-76: jest-junit placement and version constraint are correct.

jest-junit properly belongs in devDependencies as a test reporting tool, and ^16.0.0 is a valid semantic versioning constraint without @latest. No known security vulnerabilities exist for jest-junit 16.0.0.


Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov

codecov Bot commented Dec 4, 2025

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.08%. Comparing base (868523f) to head (d898d7b).
⚠️ Report is 6 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #12   +/-   ##
=======================================
  Coverage   77.08%   77.08%           
=======================================
  Files           5        5           
  Lines         877      877           
  Branches       44       61   +17     
=======================================
  Hits          676      676           
  Misses        201      201           
Flag Coverage Δ
unittests ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 868523f and b02ab89.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (4)
  • .github/workflows/ci.yml (1 hunks)
  • .gitignore (1 hunks)
  • jest.config.ts (1 hunks)
  • package.json (2 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use zustand for global UI state (modals, sidebars)
Store all monetary values as INTEGER (minor units/cents), never use floating-point arithmetic for currency
Use date-fns and date-fns-tz for all date/time operations
Use string unions ('active' | 'archived') or const maps (POJO) instead of TypeScript enum; align with Drizzle schema standards
Prefer interface over type for public API and Props definitions
Strict TypeScript configuration enforced; no any type allowed

Files:

  • jest.config.ts
package.json

📄 CodeRabbit inference engine (.cursor/rules/environment.mdc)

Strictly separate dependencies (production code) from devDependencies (build/test/lint tools) in package.json.

Files:

  • package.json
🧠 Learnings (3)
📚 Learning: 2025-12-04T10:20:26.118Z
Learnt from: CR
Repo: sergeyklay/oar PR: 0
File: .cursor/rules/environment.mdc:0-0
Timestamp: 2025-12-04T10:20:26.118Z
Learning: Use `npm ci` for clean, reproducible installs in CI/CD pipelines and fresh project setups instead of `npm install`.

Applied to files:

  • .github/workflows/ci.yml
📚 Learning: 2025-12-04T10:20:44.178Z
Learnt from: CR
Repo: sergeyklay/oar PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-12-04T10:20:44.178Z
Learning: Applies to **/*.test.{ts,tsx} : When testing Server Actions in Next.js, use `jest.mock('@/db')` to mock the Drizzle client instead of importing the real `db` instance

Applied to files:

  • package.json
📚 Learning: 2025-12-04T10:20:44.178Z
Learnt from: CR
Repo: sergeyklay/oar PR: 0
File: .cursor/rules/testing.mdc:0-0
Timestamp: 2025-12-04T10:20:44.178Z
Learning: Applies to **/*.test.{ts,tsx} : Structure Jest tests with top-level `describe` blocks for the Component/Function, and nested `describe` blocks for scenarios

Applied to files:

  • package.json
🔇 Additional comments (3)
.gitignore (1)

28-28: LGTM!

Adding /junit.xml to the ignore list is correct, as this is a test artifact generated by jest-junit.

.github/workflows/ci.yml (1)

65-65: LGTM!

The cache-aware install condition is correctly implemented. This optimizes CI runtime by skipping npm ci when the cache is hit, while still ensuring clean, reproducible installs when needed.

package.json (1)

76-76: LGTM!

The jest-junit package is correctly placed in devDependencies as it's a testing tool.

Comment thread jest.config.ts
Comment thread package.json Outdated
@sergeyklay sergeyklay merged commit 09f28e0 into main Dec 4, 2025
4 checks passed
@sergeyklay sergeyklay deleted the ci/coverage branch December 4, 2025 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant