Skip to content

fix(reporters): print parent describe suites when the passed-test list is hidden (fix #10606)#10768

Open
ChihebBENCHEIKH1 wants to merge 1 commit into
vitest-dev:mainfrom
ChihebBENCHEIKH1:fix/bench-ci-describe-nesting
Open

fix(reporters): print parent describe suites when the passed-test list is hidden (fix #10606)#10768
ChihebBENCHEIKH1 wants to merge 1 commit into
vitest-dev:mainfrom
ChihebBENCHEIKH1:fix/bench-ci-describe-nesting

Conversation

@ChihebBENCHEIKH1

Copy link
Copy Markdown

Description

vitest bench under CI=1 drops every describe label from its output. The same problem hits any slow test (>slowTestThreshold) in a multi-file run: the test line prints but its parent suites do not, so the indentation ends up orphaned.

When renderSucceed is off, printTestSuite in packages/vitest/src/node/reporters/base.ts bails out and the outer visitor never emits describe headers. printTestCase still logs lines for failed tests, slow tests, inline benchmarks, and every test in a failed module — with nothing above them.

This PR tracks which suites have already been printed for the current module and, before each log line in printTestCase, walks test.parent up to the module boundary and prints any ancestor suite that is still missing. The TTY (renderSucceed=true) path is unchanged — the new helper short-circuits, and the existing suite emitter now goes through a shared dedup so the outer visitor and the new backfill do not double-print.

Fixes #10606.

Before / after

Reproduction from the issue, CI=1 pnpm bench:

 ✓  bench  test/suite.bench.ts (2 tests) 2392ms
     ✓ foo 1183ms
     ✓ foo 1208ms

With this PR:

 ✓  bench  test/suite.bench.ts (2 tests) 2392ms
   ✓ my first suite (1)
     ✓ foo 1183ms
   ✓ my second suite (1)
     ✓ foo 1208ms

The same nesting is now restored for slow tests in non-TTY mode.

Tests

  • Two new regression tests in test/e2e/test/reporters/default.test.ts, one for a slow nested test and one for inline benchmarks, both with isTTY: false. Verified they fail on main and pass with this change.
  • Existing default, agent, and merge-reports reporter snapshots updated to reflect the extra suite headers now present in CI-style output.
  • pnpm test:unit, pnpm typecheck, and pnpm lint are clean locally.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time.
  • Ideally, include a test that fails without this PR but passes with it.
  • Please, don't make changes to pnpm-lock.yaml unless you introduce a new test example.
  • Please check Allow edits by maintainers to make review process faster.

Tests

  • Run the tests with pnpm test:ci.

Documentation

  • N/A — no user-facing config change.

Changesets

  • Title uses the fix: prefix so the changelog entry reflects the bug fix.

When `renderSucceed` is off (multi-file / non-TTY / `CI=1`), `printTestSuite`
bails out so the describe headers are never emitted. `printTestCase` still
logs failed tests, slow tests, inline benchmarks and every test in a failed
module, but with no suite line above them the indentation is orphaned:
`vitest bench` under CI drops `describe` labels entirely, and slow tests
lose their nesting anywhere.

Track which suites have already been emitted and, before logging a test
line while `renderSucceed` is off, walk up `test.parent` and print any
ancestor suites that are still missing.

fix vitest-dev#10606
@netlify

netlify Bot commented Jul 13, 2026

Copy link
Copy Markdown

Deploy Preview for vitest-dev ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit e4b13b7
🔍 Latest deploy log https://app.netlify.com/projects/vitest-dev/deploys/6a5515d998df8100086c0074
😎 Deploy Preview https://deploy-preview-10768--vitest-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

5.0.0-beta.5 bench: describe labels and nesting not displayed correctly when running in CI

1 participant