fix(coverage): make coverage analyze fail when tests fail#1397
Draft
peter-jerry-ye wants to merge 1 commit intomainfrom
Draft
fix(coverage): make coverage analyze fail when tests fail#1397peter-jerry-ye wants to merge 1 commit intomainfrom
peter-jerry-ye wants to merge 1 commit intomainfrom
Conversation
Changed Files
|
e7f1deb to
d5d0a63
Compare
The coverage analyze command now properly propagates test failures while still generating the coverage report. Previously, it would ignore test failures and return success if the coverage report was generated successfully. Behavior: - Always generate the coverage report (useful for debugging) - Propagate the test result exit code (2 for test failures) - Only return an error if the coverage report itself fails Includes a regression test with a failing test case to prevent future regressions.
d5d0a63 to
484e15c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed the issue where
moon coverage analyzewould continue to execute the coverage report analysis even whenmoon test --enable-coveragefailed.Problem
The
run_coverage_analyzefunction was discarding the exit code fromrun_testusing the?operator, which only propagated errors (notOkvalues). This meant that when tests failed (returning exit code 2), the coverage analysis would still proceed, generating reports based on incomplete or invalid coverage data.Solution
Modified
crates/moon/src/cli/coverage.rsto:Changes
crates/moon/src/cli/coverage.rs- Added early return when tests failtest_moon_coverage_analyze_fails_on_test_failureregression testtest_coverage_fail_test.intest case with a failing testVerification