Skip to content

fix: exclude sleep.ts from coverage and add pre-push hook#48

Merged
adawalli merged 2 commits into
mainfrom
chore/updates
Mar 31, 2026
Merged

fix: exclude sleep.ts from coverage and add pre-push hook#48
adawalli merged 2 commits into
mainfrom
chore/updates

Conversation

@adawalli

Copy link
Copy Markdown
Owner

Summary

  • Fixes CI failure where bun test --coverage exits 1 despite all tests passing
  • Adds a pre-push hook so coverage failures are caught locally before CI

Root cause

src/sleep.ts is always mocked via mock.module("../src/sleep", ...) in tests. On Linux (CI), bun reports 0% coverage for the real module, failing the 90% line coverage threshold. Locally on macOS the coverage tracking behaves differently, so it wasn't caught pre-push.

src/stable-wait.ts is already in the ignore list for the same reason - src/sleep.ts belongs there too.

Changes

  • bunfig.toml - add src/sleep.ts to coveragePathIgnorePatterns
  • .husky/pre-push - run bun test --coverage before every push

sleep.ts is always mocked in tests - on Linux bun reports 0% coverage

for mocked modules, causing CI to fail the coverage threshold.

Also adds a pre-push hook so coverage failures are caught locally.
@claude

claude Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @adawalli's task in 1m 45s —— View job


PR Review

  • Gather context
  • Read changed files
  • Review code quality and correctness
  • Post review feedback

LGTM overall. This is a minimal, well-scoped fix with solid reasoning.

bunfig.toml

Adding src/sleep.ts to coveragePathIgnorePatterns is the right call. The module is a one-liner setTimeout wrapper that is always replaced by mock.module("../src/sleep", ...) in both test/stable-wait.test.ts and test/llm.test.ts — the real implementation never runs. This is exactly the same situation as src/stable-wait.ts, which was already excluded. The fix is consistent with the existing pattern.

.husky/pre-push

The hook correctly mirrors the CI command (bun test --coverage), which is the right approach to catch platform-specific coverage differences before they hit CI. One minor note: the hook is missing a shebang line (left an inline suggestion). The pre-commit hook also omits one, so this is consistent with existing project convention, but adding #!/bin/sh is safer across environments.

No functional issues. The tradeoff of running full coverage on every push is intentional and appropriate given this was a CI-only failure previously.

@codecov

codecov Bot commented Mar 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

🚀 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.

Comment thread .husky/pre-push
Co-authored-by: claude[bot] <209825114+claude[bot]@users.noreply.github.com>
@adawalli adawalli merged commit 2fd9a6d into main Mar 31, 2026
@adawalli adawalli deleted the chore/updates branch March 31, 2026 16:24
@claude

claude Bot commented Mar 31, 2026

Copy link
Copy Markdown
Contributor

Claude finished @adawalli's task in 57s —— View job


PR Review

  • Gather context
  • Read changed files
  • Review code quality and correctness
  • Post review feedback

LGTM. This is a clean, minimal fix with good reasoning.

bunfig.toml

Adding src/sleep.ts to coveragePathIgnorePatterns is correct. The module is always replaced by mock.module("../src/sleep", ...) in both test/stable-wait.test.ts and test/llm.test.ts — the real implementation never executes under test. This is identical to the existing src/stable-wait.ts exclusion, so the change is consistent with the established pattern.

The current ignore list:

coveragePathIgnorePatterns = ["src/index.ts", "src/llm.ts", "src/stable-wait.ts", "src/sleep.ts"]

All four entries have legitimate reasons to be excluded (entry point, always-mocked modules). No concerns here.

.husky/pre-push

The hook correctly includes a shebang (#!/bin/sh) and mirrors the CI coverage command exactly — the right approach to surface platform-specific coverage differences before they reach CI. The pre-commit hook omits a shebang (pre-existing inconsistency), so this hook is actually more correct than its sibling.

One tradeoff worth noting: running bun test --coverage on every push adds overhead to the push workflow. Given the PR's stated motivation (a CI-only failure that was invisible locally), this is an acceptable and intentional tradeoff.

No issues found.

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