Skip to content

fix: exit with code 1 when coverage report generate error#924

Merged
9aoy merged 2 commits intomainfrom
coverage-generate-error
Jan 30, 2026
Merged

fix: exit with code 1 when coverage report generate error#924
9aoy merged 2 commits intomainfrom
coverage-generate-error

Conversation

@9aoy
Copy link
Copy Markdown
Collaborator

@9aoy 9aoy commented Jan 30, 2026

Summary

fix: should exit with code 1 when coverage report generate error

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @9aoy, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the reliability of coverage reporting by ensuring that the application exits with a non-zero status code when coverage report generation fails or when defined coverage thresholds are not met. This change is crucial for automated build and testing environments, as it provides immediate and unambiguous feedback on coverage status, preventing silent failures and streamlining the development workflow.

Highlights

  • Error Handling for Coverage Generation: The process will now explicitly exit with code 1 if there is an error during coverage report generation, ensuring CI/CD pipelines correctly detect failures.
  • Standard Error Output for Critical Messages: Coverage threshold violation messages and general coverage generation errors are now directed to stderr instead of stdout or logger.error, making them more visible in logs.
  • Centralized Error Propagation: The coverage-istanbul provider's generateReports method no longer handles errors internally, allowing exceptions to propagate up to the core coverage generation function for unified error management.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses an issue where the process would not exit with an error code upon failure of coverage report generation. The changes ensure that errors propagate to a central handler that sets the process exit code to 1, which is the correct behavior.

The key changes are:

  • Adding process.exitCode = 1 in the catch block within packages/core/src/coverage/generate.ts to handle failures during coverage generation.
  • Refactoring packages/coverage-istanbul/src/provider.ts by removing a try...catch block in generateReports. This allows errors to propagate to the caller, which is a clean way to centralize error handling.
  • Consistently using logger.stderr for error messages, which is an improvement for logging practices.

The implementation is solid, and the changes effectively resolve the stated problem. I have no further suggestions as the code quality is high.

@9aoy 9aoy merged commit 5877055 into main Jan 30, 2026
9 checks passed
@9aoy 9aoy deleted the coverage-generate-error branch January 30, 2026 08:47
@fi3ework fi3ework mentioned this pull request Feb 3, 2026
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