Skip to content

feat: track script.js in Codecov, fix broken CI badges, add 71 DOM tests#101

Merged
nitrocode merged 2 commits into
mainfrom
copilot/check-codecov-coverage
Apr 27, 2026
Merged

feat: track script.js in Codecov, fix broken CI badges, add 71 DOM tests#101
nitrocode merged 2 commits into
mainfrom
copilot/check-codecov-coverage

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 27, 2026

script.js (the compiled DOM layer) was invisible to Codecov because tests used eval() instead of require(), and the README badges pointed to unit-tests.yml/e2e-tests.yml workflows that didn't exist — only a monolithic ci.yml did.

CI / Badge fixes

  • Split ci.ymlunit-tests.yml + e2e-tests.yml so the existing README badge URLs resolve
  • Fixed Codecov badge URL: removed deprecated /branch/main segment

Coverage tracking for script.js

  • Switched eval(scriptCode)jest.resetModules(); require('../script.js') — Istanbul can now instrument the file
  • Added script.js to collectCoverageFrom in package.json
  • Added per-file thresholds for script.js (60% stmts/funcs, 50% branches, 90% lines); kept stricter 80%/70% thresholds on death-clock-core.js

Lower thresholds for script.js reflect reality: it's a minified browser IIFE where ~35% of code paths are gated behind setInterval/RAF loops, IntersectionObserver, and complex game mechanics that aren't practical to unit-test.

Expanded test surface (268 → 339 tests)

Expanded MIN_HTML from ~20 elements to 130+ elements covering all 22 feature modules, then added 71 new tests across 18 new describe blocks:

Area What's tested
Ticker expand / collapse / share
Equivalences snarky-mode toggle
Tabs switching panels
Receipt modal open / close / Escape key / Tab focus trap
Calculator open / WANTED poster output / share
Share panel all 6 platform buttons + close
Accelerator panel open/close, tap, share
Life Blocks drill-down click, breadcrumb nav, stack panel blocks
Scary features apology, hall of shame, emergency broadcast, intervention
Villain leaderboard table populated on init
Misc section anchors, hide-completed checkbox, extinction countdown, footer stats

Coverage after:

File Stmts Funcs Lines
death-clock-core.js 100% 100% 100%
script.js 68% 65% 100%

Summary by CodeRabbit

  • Tests

    • Separated end-to-end testing infrastructure into dedicated workflow.
    • Expanded test coverage with comprehensive integration tests for UI interactions and features.
  • Documentation

    • Updated badge references in README.
  • Chores

    • Reorganized testing workflows and updated coverage configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 27, 2026

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Listen here, fool! This PR separates E2E tests into a dedicated GitHub Actions workflow, removing them from the unit tests workflow. It updates test infrastructure by refactoring the test loader mechanism and expanding integration test coverage. Coverage config and documentation badges also get updated, sucka!

Changes

Cohort / File(s) Summary
GitHub Actions Workflow Restructuring
.github/workflows/e2e-tests.yml, .github/workflows/unit-tests.yml
New E2E workflow with Playwright testing, paths filtering, and conditional execution. Removed E2E jobs from unit tests workflow and renamed it from CI to Unit Tests, jibber jabber.
Documentation & Coverage Config
README.md, package.json
Updated Codecov badge URL paths in README. Expanded Jest coverage to track script.js alongside death-clock-core.js with per-file thresholds, fool!
Test Suite Refactor
tests/script.test.js
Switched script loading from eval() to jest.resetModules() with require(). Expanded DOM fixture with comprehensive UI elements. Added extensive integration tests covering initialization, interactions, and feature behaviors across multiple components, sucka!

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the three main changes: tracking script.js in Codecov, fixing CI badges, and adding 71 DOM tests.
Description check ✅ Passed The description is comprehensive and well-structured, covering all major changes with clear sections, rationale, and test coverage metrics, though the Agent Checklist section is not filled out.
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.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch copilot/check-codecov-coverage

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

@nitrocode nitrocode marked this pull request as ready for review April 27, 2026 01:49
@nitrocode nitrocode self-requested a review as a code owner April 27, 2026 01:49
github-actions Bot added a commit that referenced this pull request Apr 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

👁️ PR Preview

🚀 Open Preview

Deployed from commit 75d3f5d · Updates on every push to this PR
(Preview is removed automatically when the PR is closed.)

Screenshots

Desktop Mobile
Desktop Mobile

github-actions Bot added a commit that referenced this pull request Apr 27, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (bcd649d) to head (75d3f5d).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##              main      #101   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines          242       242           
  Branches       109       109           
=========================================
  Hits           242       242           
Flag Coverage Δ
unit 100.00% <ø> (ø)

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


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08a5afa...75d3f5d. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@nitrocode nitrocode merged commit a76dc50 into main Apr 27, 2026
9 of 10 checks passed
@nitrocode nitrocode deleted the copilot/check-codecov-coverage branch April 27, 2026 01:50
github-actions Bot added a commit that referenced this pull request Apr 27, 2026
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.

2 participants