Skip to content

docs: add test coverage history log - #3367

Merged
jeanfbrito merged 1 commit into
masterfrom
docs/coverage-history
Jun 22, 2026
Merged

jeanfbrito merged 1 commit into
masterfrom
docs/coverage-history

Conversation

@jeanfbrito

@jeanfbrito jeanfbrito commented Jun 22, 2026 •

Copy link
Copy Markdown
Member

What

Adds docs/COVERAGE.md — an append-only log of test-coverage milestones so future changes can be recorded and the trajectory stays visible.

Contents

  • History table: date, milestone/PR, lines/statements/branches/functions %, test count, notes. Seeded with the 17.15% → 33.29% climb across chore: add test coverage measurement #3362–ci: align coverage with Rocket.Chat house style (Codecov, no hard gate) #3366.
  • How coverage is measured (yarn test:coverage, the two jest projects, Codecov informational reporting — no hard gate, matching the main monorepo).
  • How to update the log (append a row, never edit past rows).
  • Known gaps / next steps (50% goal, the 3 quarantined specs, remaining headroom).
  • Testing gotchas learned while building the suite (spec placement glob, fireEvent.change vs userEvent.type, timer-leak → suite kill, batch-verify discipline).

Docs only — no code or config change.

Summary by CodeRabbit

  • Documentation
    • Added comprehensive test coverage documentation including measurement methodology, historical coverage metrics, and known testing limitations affecting test development.

Append-only log of coverage milestones (date, PR, the four metric
percentages, test count, notes) plus how to measure + update it and
the testing gotchas learned while building the suite. Records the
17.15% -> 33.29% climb across PRs #3362-#3366.
@coderabbitai

coderabbitai Bot commented Jun 22, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

A new docs/COVERAGE.md file is created documenting how test coverage is measured for Rocket.Chat.Electron, including the measurement command, Jest projects, CI upload behavior, a history table with dated coverage metrics, known gaps, and testing gotchas.

Changes

Coverage Documentation

Layer / File(s) Summary
Coverage methodology, history, and testing gotchas
docs/COVERAGE.md
Creates the full coverage documentation: measurement methodology, how to update the log, a history table of dated coverage milestones, known gaps, and testing notes covering renderer spec placement, RTL usage, userEvent.type behavior, and timer/listener leak requirements.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

type: chore

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs: add test coverage history log' clearly and concisely summarizes the main change—adding a new documentation file that tracks test coverage milestones over time.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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.

❤️ Share

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

@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

🤖 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 `@docs/COVERAGE.md`:
- Around line 29-33: The reference to docs/KNOWN_ISSUES.md in the "Quarantined
specs" section of the Known gaps section does not provide complete documentation
for the three mentioned specs (ServersView/ErrorView, ServerInfoContent,
AboutDialog). Either add detailed documentation to docs/KNOWN_ISSUES.md that
specifically explains why these three specs are quarantined and what RTL
auto-cleanup issues affect them, or update the cross-reference in COVERAGE.md to
remove the reference to KNOWN_ISSUES.md and include the necessary context
directly within the COVERAGE.md file instead.
- Around line 5-11: The documentation claims that both Jest projects (renderer
and main) run under the same `@kayahr/jest-electron-runner`, but the actual
configuration uses different runner variants: the renderer project uses
`@kayahr/jest-electron-runner` while the main project uses
`@kayahr/jest-electron-runner/main`. Update line 8 of the COVERAGE.md file to
accurately reflect this distinction by either specifying which runner variant
each project uses, or rephrasing to indicate that both use variants of the
electron-runner package family rather than claiming they use the exact same
runner.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c1e23625-036d-4c55-ac0a-59a4144e2ee0

📥 Commits

Reviewing files that changed from the base of the PR and between 5e42a18 and edb7ce3.

📒 Files selected for processing (1)
  • docs/COVERAGE.md
📜 Review details
⏰ Context from checks skipped due to timeout. (4)
  • GitHub Check: check (ubuntu-latest)
  • GitHub Check: check (windows-latest)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (actions)
🧰 Additional context used
🪛 LanguageTool
docs/COVERAGE.md

[uncategorized] ~10-~10: The official name of this software platform is spelled with a capital “H”.
Context: ...nsole text-summary matches it). - CI (.github/workflows/validate-pr.yml) runs `yarn ...

(GITHUB)

🔇 Additional comments (3)
docs/COVERAGE.md (3)

12-18: LGTM!


19-27: LGTM!


35-41: LGTM!

Comment thread docs/COVERAGE.md
Comment on lines +5 to +11
## How coverage is measured

- `yarn test:coverage` runs the full Jest suite with `--coverage` and writes reports to `coverage/` (`lcov.info`, `coverage-summary.json`, plus a `text-summary` to the console).
- Two Jest projects run under `@kayahr/jest-electron-runner`: renderer (electron DOM env) and main (node env). Coverage is collected across both via the root-level `collectCoverageFrom` in `jest.config.js`.
- The authoritative number is `coverage/coverage-summary.json` → `total.lines.pct` (the console `text-summary` matches it).
- CI (`.github/workflows/validate-pr.yml`) runs `yarn test:coverage` on every PR to `master`/`dev` and uploads to **Codecov** (`unit` flag). Coverage is **informational** — there is intentionally no hard `coverageThreshold` gate, matching the main Rocket.Chat monorepo's house style (`codecov.yml`: `patch: off`, project `target: auto / threshold: 1%`).

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.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verify that jest.config.js defines two projects and that the main project is configured
# Search for the projects array definition and all project configs

ast-grep --pattern $'const $___ = {
  projects: [
    $$$
  ]
}'

Repository: RocketChat/Rocket.Chat.Electron

Length of output: 57


🏁 Script executed:

# Find and read jest.config.js to verify project structure
find . -name "jest.config.js" -type f | head -5

Repository: RocketChat/Rocket.Chat.Electron

Length of output: 92


🏁 Script executed:

# Also check the structure of the repository
git ls-files | grep -E "(jest\.config|\.github/workflows|coverage)" | head -20

Repository: RocketChat/Rocket.Chat.Electron

Length of output: 239


🏁 Script executed:

# Read jest.config.js to verify the two projects claim
cat -n jest.config.js | head -100

Repository: RocketChat/Rocket.Chat.Electron

Length of output: 1458


🏁 Script executed:

# Read the validate-pr.yml workflow to verify it runs yarn test:coverage
cat -n .github/workflows/validate-pr.yml | head -100

Repository: RocketChat/Rocket.Chat.Electron

Length of output: 4530


Clarify the runner configuration for the main project.

Line 8 claims that "Two Jest projects run under @kayahr/jest-electron-runner," but the jest.config.js configuration shows the two projects use different runners: the renderer project uses @kayahr/jest-electron-runner, while the main project uses @kayahr/jest-electron-runner/main. Update the documentation to reflect this distinction — either specify the runner variant for each project or rephrase to indicate both use the electron-runner package family.

🧰 Tools
🪛 LanguageTool

[uncategorized] ~10-~10: The official name of this software platform is spelled with a capital “H”.
Context: ...nsole text-summary matches it). - CI (.github/workflows/validate-pr.yml) runs `yarn ...

(GITHUB)

🤖 Prompt for 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.

In `@docs/COVERAGE.md` around lines 5 - 11, The documentation claims that both
Jest projects (renderer and main) run under the same
`@kayahr/jest-electron-runner`, but the actual configuration uses different
runner variants: the renderer project uses `@kayahr/jest-electron-runner` while
the main project uses `@kayahr/jest-electron-runner/main`. Update line 8 of the
COVERAGE.md file to accurately reflect this distinction by either specifying
which runner variant each project uses, or rephrasing to indicate that both use
variants of the electron-runner package family rather than claiming they use the
exact same runner.

Comment thread docs/COVERAGE.md
Comment on lines +29 to +33
## Known gaps / next steps

- **Goal:** 50% lines. At 33.29% as of the last row — reachable via the renderer (`ui/`) layer alone; no need to test webview/Electron-integration files.
- **Quarantined specs** (written but held back — they leak async/DOM teardown that the strict `uncaughtException` handler in `src/.jest/setup.ts` turns into a suite-killing `process.exit(1)`): `ServersView/ErrorView`, `ServerInfoContent`, `AboutDialog`. Re-enabling these (with proper fake-timer / async cleanup) is the cheapest next win. See `docs/KNOWN_ISSUES.md`.
- **Remaining headroom:** the rest of `ui/components` dialogs/containers, and non-webview `ui/main` logic.

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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if docs/KNOWN_ISSUES.md exists and contains references to the quarantined specs

if [ -f docs/KNOWN_ISSUES.md ]; then
  echo "docs/KNOWN_ISSUES.md exists"
  grep -n "ServersView\|ServerInfoContent\|AboutDialog" docs/KNOWN_ISSUES.md || echo "None of the three quarantined specs found in the file"
else
  echo "docs/KNOWN_ISSUES.md does not exist"
fi

Repository: RocketChat/Rocket.Chat.Electron

Length of output: 157


🏁 Script executed:

cat docs/KNOWN_ISSUES.md

Repository: RocketChat/Rocket.Chat.Electron

Length of output: 3405


🏁 Script executed:

sed -n '25,35p' docs/COVERAGE.md

Repository: RocketChat/Rocket.Chat.Electron

Length of output: 1539


The reference to docs/KNOWN_ISSUES.md in line 32 is incomplete.

The file exists and documents the related RTL auto-cleanup issue that affects the src/.jest/setup.ts uncaughtException handler, but it does not specifically document why the three quarantined specs (ServersView/ErrorView, ServerInfoContent, AboutDialog) are held back. Developers looking for documentation on these specific tests will not find them in the referenced file. Either add documentation for these three specs to docs/KNOWN_ISSUES.md or remove/update the cross-reference.

🤖 Prompt for 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.

In `@docs/COVERAGE.md` around lines 29 - 33, The reference to docs/KNOWN_ISSUES.md
in the "Quarantined specs" section of the Known gaps section does not provide
complete documentation for the three mentioned specs (ServersView/ErrorView,
ServerInfoContent, AboutDialog). Either add detailed documentation to
docs/KNOWN_ISSUES.md that specifically explains why these three specs are
quarantined and what RTL auto-cleanup issues affect them, or update the
cross-reference in COVERAGE.md to remove the reference to KNOWN_ISSUES.md and
include the necessary context directly within the COVERAGE.md file instead.

@jeanfbrito
jeanfbrito merged commit 5db3a50 into master Jun 22, 2026
7 of 8 checks passed
@jeanfbrito
jeanfbrito deleted the docs/coverage-history branch June 22, 2026 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant