From 14548ef479e3817fefc07f4b22cf19b72d111cee Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 22:19:57 +0000 Subject: [PATCH 1/2] docs: explain why console coverage reporters print mid-run (#465) 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 Claude-Session: https://claude.ai/code/session_01WUv8r5MtAAp1pTkx3fSG1a --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index f76542f0..5612ea1f 100644 --- a/README.md +++ b/README.md @@ -521,6 +521,25 @@ You can specify custom coverage reporter(s) to use. For example, to output text **Tip:** find list of reporters [here](https://istanbul.js.org/docs/advanced/alternative-reporters/) +### Console reporters print in the middle of the test output + +Console reporters such as `text` and `text-summary` can print their table in the middle of your Cypress output, often just before the result of the last test in a spec. Why? The plugin generates the report from an `after()` hook at the end of each spec, while Cypress is still printing that spec's results. The same happens when a [`coverage:report` script](#custom-nyc-command) prints to the terminal. Because the hook runs once per spec, you see the table again after every spec, too. + +This is cosmetic, and your coverage numbers are still correct. To get the summary once, after all the Cypress output, keep only file reporters in your NYC config (the default reporters are all file reporters), and print the summary yourself after `cypress run` finishes: + +```json +{ + "nyc": { + "reporter": ["lcov", "json"] + }, + "scripts": { + "test": "cypress run && nyc report --reporter=text-summary" + } +} +``` + +`nyc report` reads the coverage the plugin saved in `.nyc_output`, so it doesn't need to run your tests again. Use `--reporter=text` instead if you want the file-by-file table. + ## Custom NYC command Sometimes, the NYC tool might be installed in a different folder, not the current or parent folder, or you might want to customize the report command. In that case, put the custom command into `package.json` in the [same folder as your Cypress config file](#where-nyc-options-are-read-from), and this plugin will automatically use it. From 30296b5be943e380b8f4fcd780a68e938c47989d Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 1 Nov 2026 22:25:10 +0000 Subject: [PATCH 2/2] docs: tighten console reporter note (#465) Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01WUv8r5MtAAp1pTkx3fSG1a --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 5612ea1f..79ea379e 100644 --- a/README.md +++ b/README.md @@ -521,11 +521,11 @@ You can specify custom coverage reporter(s) to use. For example, to output text **Tip:** find list of reporters [here](https://istanbul.js.org/docs/advanced/alternative-reporters/) -### Console reporters print in the middle of the test output +### Console reporters print mid-run -Console reporters such as `text` and `text-summary` can print their table in the middle of your Cypress output, often just before the result of the last test in a spec. Why? The plugin generates the report from an `after()` hook at the end of each spec, while Cypress is still printing that spec's results. The same happens when a [`coverage:report` script](#custom-nyc-command) prints to the terminal. Because the hook runs once per spec, you see the table again after every spec, too. +The report is generated in an `after()` hook at the end of each spec, while Cypress is still printing results. So console reporters such as `text` and `text-summary`, or a [`coverage:report` script](#custom-nyc-command) that prints, can appear before the last test's result, once per spec. The numbers are still correct. -This is cosmetic, and your coverage numbers are still correct. To get the summary once, after all the Cypress output, keep only file reporters in your NYC config (the default reporters are all file reporters), and print the summary yourself after `cypress run` finishes: +To print the summary once at the end, use only file reporters (like the defaults) and run `nyc report` after `cypress run`: ```json { @@ -538,7 +538,7 @@ This is cosmetic, and your coverage numbers are still correct. To get the summar } ``` -`nyc report` reads the coverage the plugin saved in `.nyc_output`, so it doesn't need to run your tests again. Use `--reporter=text` instead if you want the file-by-file table. +`nyc report` reads the saved `.nyc_output`, so tests don't run again. Use `--reporter=text` for the per-file table. ## Custom NYC command