fix(reporters): print parent describe suites when the passed-test list is hidden (fix #10606)#10768
Open
ChihebBENCHEIKH1 wants to merge 1 commit into
Open
Conversation
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
✅ Deploy Preview for vitest-dev ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
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.
Description
vitest benchunderCI=1drops everydescribelabel 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
renderSucceedis off,printTestSuiteinpackages/vitest/src/node/reporters/base.tsbails out and the outer visitor never emits describe headers.printTestCasestill 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, walkstest.parentup 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:With this PR:
The same nesting is now restored for slow tests in non-TTY mode.
Tests
test/e2e/test/reporters/default.test.ts, one for a slow nested test and one for inline benchmarks, both withisTTY: false. Verified they fail onmainand pass with this change.default,agent, andmerge-reportsreporter snapshots updated to reflect the extra suite headers now present in CI-style output.pnpm test:unit,pnpm typecheck, andpnpm lintare clean locally.Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
pnpm-lock.yamlunless you introduce a new test example.Tests
pnpm test:ci.Documentation
Changesets
fix:prefix so the changelog entry reflects the bug fix.