Skip to content

test: make onReleaseChangelog hook error test robust - #484

Merged
jaredwray merged 1 commit into
mainfrom
cursor/fix-changelog-hook-error-test-16b8
Aug 17, 2026
Merged

test: make onReleaseChangelog hook error test robust#484
jaredwray merged 1 commit into
mainfrom
cursor/fix-changelog-hook-error-test-16b8

Conversation

@jaredwray

Copy link
Copy Markdown
Owner

Please check if the PR fulfills these requirements

  • Followed the Contributing and Code of Conduct guidelines.
  • Tests for the changes have been added (for bug fixes/features) with 100% code coverage.

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)
Test robustness / flake fix.

Why
should handle onReleaseChangelog hook errors gracefully was leaking the expected hook failure to stderr:

stderr | test/builder-changelog.test.ts > ... > should handle onReleaseChangelog hook errors gracefully
✘ [error] onReleaseChangelog error: Hook failed

DoculaConsole.error() always writes to console.error (even in quiet mode), so Vitest reports it as a failed-looking ✘ [error] line. The test also depended on the GitHub HTTP mock actually supplying releases, so the hook was not guaranteed to run.

What
Harden that test in test/builder-changelog.test.ts:

  • Inject GitHub releases via getGithubData so the hook always runs
  • Stub builder.console.error so the expected log does not leak to stderr
  • Assert the error is logged and the changelog page is still built
Open in Web Open in Cursor 

Stub console.error so the expected hook failure is not printed as
stderr (which Vitest reports as ✘ [error]), inject GitHub releases so
the hook always runs, and assert the error is logged.

Co-authored-by: Jared Wray <me@jaredwray.com>
@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (366cf08) to head (77bf116).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #484   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           18        18           
  Lines         2760      2760           
  Branches       846       846           
=========================================
  Hits          2760      2760           

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

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

@jaredwray
jaredwray marked this pull request as ready for review August 17, 2026 19:05
@jaredwray
jaredwray merged commit 80d6772 into main Aug 17, 2026
14 checks passed
@jaredwray
jaredwray deleted the cursor/fix-changelog-hook-error-test-16b8 branch August 17, 2026 19:07
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