Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Oct 12, 2025

Problem

The "Display coverage summary" step in the end-to-end tests workflow was producing zero output, preventing coverage metrics from being visible in the GitHub Actions workflow summary.

Root Cause

By default, Vitest's coverage.reportOnFailure option is set to false, which means coverage reports are not generated when any tests fail. Since the e2e tests occasionally timeout or fail (e.g., Docker container conflicts), the coverage/coverage-summary.json file was not being created, causing the workflow step to have nothing to display.

Solution

This PR enables the reportOnFailure: true option in the Vitest coverage configuration. This ensures coverage reports are always generated during test runs, regardless of test success or failure.

coverage: {
  provider: "v8",
  reporter: ["text", "json-summary", "json", "html"],
  reportsDirectory: "./coverage",
  reportOnFailure: true,  // ← Added this line
  exclude: [
    // ...
  ],
}

Benefits

  • Improved visibility: Coverage metrics will now appear in GitHub Actions workflow summaries even when tests fail
  • Better debugging: Developers can see which code was covered by passing tests before a failure occurred
  • Minimal change: Single-line configuration change with no breaking changes or side effects

Testing

Verified that:

  • ✅ Coverage files are generated when e2e tests fail
  • ✅ The GitHub workflow command successfully displays coverage summary
  • ✅ All linting and formatting checks pass
  • ✅ Coverage reports work correctly for both passing and failing test scenarios

Fixes #[issue_number]

Original prompt

This section details on the original issue you should resolve

<issue_title>Nothing displayed in end-to-end tests stage under "Display coverage summary"</issue_title>
<issue_description>As in title. CI/CD logs:

0s
Run if [ -f coverage/coverage-summary.json ]; then
  if [ -f coverage/coverage-summary.json ]; then
    echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY
    echo "" >> $GITHUB_STEP_SUMMARY
    cat coverage/coverage-summary.json | jq -r '
      .total |
      "| Metric | Coverage |",
      "|--------|----------|",
      "| Lines | \(.lines.pct)% |",
      "| Statements | \(.statements.pct)% |",
      "| Functions | \(.functions.pct)% |",
      "| Branches | \(.branches.pct)% |"
    ' >> $GITHUB_STEP_SUMMARY
  fi
  shell: /usr/bin/bash -e {0}

I expected something like a "coverage percentage" value, but nothing appears, there's zero output</issue_description>

Comments on the Issue (you are @copilot in this section)

Fixes #24


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI changed the title [WIP] Fix display issue in coverage summary for end-to-end tests Fix coverage summary not displaying in CI when tests fail Oct 12, 2025
Copilot AI requested a review from Wint3rmute October 12, 2025 15:21
Copilot finished work on behalf of Wint3rmute October 12, 2025 15:21
@Wint3rmute Wint3rmute marked this pull request as ready for review October 12, 2025 15:26
@Wint3rmute Wint3rmute closed this Oct 12, 2025
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.

Nothing displayed in end-to-end tests stage under "Display coverage summary"

2 participants