Skip to content

docs: explain why console coverage reporters print mid-run - #1009

Merged
jennifer-shehane merged 2 commits into
masterfrom
claude/coverage-report-docs-tc9t9s
Nov 1, 2026
Merged

jennifer-shehane merged 2 commits into
masterfrom
claude/coverage-report-docs-tc9t9s

Conversation

@jennifer-shehane

@jennifer-shehane jennifer-shehane commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Additional details

Ever seen the coverage table pop up right before your last test's result? That's what #465 is about, and it still happens on master.

The plugin builds the report in the support file's after() hook (lib/support.ts), which runs at the end of each spec while Cypress is still printing that spec's results. Two things then write straight to the terminal and interleave with the test output:

  • nyc's console reporters (text, text-summary)
  • a custom coverage:report script, which runs with stdio: 'inherit' (lib/task.ts)

It's cosmetic, and the coverage numbers are correct.

This PR adds a short "Console reporters print mid-run" subsection under Custom reporters in the README. It explains the cause and shows the workaround from the issue thread: keep only file reporters in the nyc config, then run nyc report --reporter=text-summary after cypress run.

It's a docs-only change. Generating the report from the after:run event would fix the ordering for real, but that's a bigger change, and it would fit better alongside #506.

A couple of notes for reviewers:

  • The example uses cypress run && nyc report ..., so the summary won't print when a test fails. I kept && on purpose, because ; would hide Cypress's failing exit code in CI.
  • The plugin combines every nyc config file it finds, but the nyc CLI only reads the first one. So if someone spreads their settings across several files, the summary could differ slightly from the plugin's report. That felt like too much of an edge case for the README.

Steps to test

  1. Read the new "Console reporters print mid-run" subsection under "Custom reporters" in README.md.
  2. Run npm run check:markdown and confirm the #custom-nyc-command link resolves.
  3. Optional: in a test app, set "reporter": ["lcov", "json"] in the nyc config, run cypress run && npx nyc report --reporter=text-summary, and check that the summary prints once, after all the Cypress output.

I ran npm run build, npm test (30/30) and npm run format:check, and all three passed.

How has the user experience changed?

No change to the plugin's behavior. The README now explains the mid-run output and how to avoid it.


Generated by Claude Code


Note

Low Risk
Documentation-only change; no runtime or configuration behavior is modified.

Overview
Adds a Console reporters print mid-run subsection under Custom reporters in the README (closes #465).

It documents that coverage reports run from the support file's per-spec after() hook while Cypress is still printing results, so nyc console reporters (text, text-summary) and printing coverage:report scripts can interleave with test output once per spec even though the numbers are correct.

The doc recommends using file-only reporters during the run and deferring a single summary with cypress run && nyc report --reporter=text-summary, noting that nyc report reads .nyc_output without re-running tests.

Reviewed by Cursor Bugbot for commit 30296b5. Bugbot is set up for automated code reviews on this repo. Configure here.

The report is generated from the support file's after() hook while the
spec is still running, so text reporters and a coverage:report script
that prints to stdout interleave with Cypress's own output. Document the
cause and the workaround: keep file reporters in the NYC config and run
`nyc report --reporter=text-summary` after `cypress run`.

Reporting from the after:run node event would fix the ordering for real,
but that's a larger change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r5MtAAp1pTkx3fSG1a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WUv8r5MtAAp1pTkx3fSG1a
@jennifer-shehane
jennifer-shehane merged commit 05fd22b into master Nov 1, 2026
32 checks passed
@jennifer-shehane
jennifer-shehane deleted the claude/coverage-report-docs-tc9t9s branch November 1, 2026 22:42
@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown

🎉 This PR is included in version 4.1.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Coverage report appears before end of Cypress output?

2 participants