Skip to content

fix(vitest): preserve explicit reporters - #2294

Merged
aeppling merged 2 commits into
rtk-ai:developfrom
jsiu93:fix/vitest-reporter-passthrough
Jun 20, 2026
Merged

aeppling merged 2 commits into
rtk-ai:developfrom
jsiu93:fix/vitest-reporter-passthrough

Conversation

@jsiu93

@jsiu93 jsiu93 commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Closes #2233.

Summary

  • Preserve explicit Vitest --reporter arguments instead of replacing them with --reporter=json.
  • Bypass Vitest summary compression when the user requested a reporter, so verbose per-test output remains visible.
  • Keep the default compact JSON reporter path unchanged when no reporter is specified.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets
  • cargo test --quiet vitest_cmd::tests
  • cargo test --all --quiet

@aeppling aeppling self-assigned this Jun 19, 2026
@aeppling

Copy link
Copy Markdown
Contributor

Hey @jsiu93, thanks for addressing this issue. Confirmed it fixes the bug with no regression. Two things before merge:

One blocker: truncated passthrough has no recovery path. On a large all-passing --reporter=verbose run, output is capped at passthrough_max_chars (verified: 80-test suite returns 15 tests) with the truncation marker but no [full output] hint and no tee file, since the existing tee_and_hint is failures-only and the run exits 0.

Reuse force_tee_hint or force_tee_tail_hint from src/core/tee.rs (both tee regardless of exit code) so the full output stays recoverable, per the CONTRIBUTING checklist. Avoid double-teeing with the tee_and_hint already in run_test.

Test gap. None of the new tests exceed passthrough_max_chars, which is why this slipped through. Add one with input larger than the cap asserting both the marker and the recovery hint.

Explicit Vitest reporters can produce successful output that exceeds the passthrough cap. Track truncation as structured state and use force_tee_hint so the full verbose output remains recoverable.
@jsiu93

jsiu93 commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @aeppling, fixed in f9469d1.

The Vitest passthrough path now carries a truncated flag. When explicit --reporter output exceeds passthrough_max_chars, run_test uses force_tee_hint so successful verbose runs get a [full output] tee file. Regular output still uses tee_and_hint, which keeps the existing recovery behavior and avoids double teeing.

I added a regression test with output over the cap that asserts both the truncation marker and the recovery hint.

Verified locally with cargo fmt --all -- --check, cargo clippy --all-targets -- -D warnings, cargo test, and cargo test --all. I also smoke-tested against vitejs/vite: 129 passing tests with --reporter=verbose now print the truncation marker plus [full output], and the tee log contains the full test summary.

@aeppling

Copy link
Copy Markdown
Contributor

LGTM, will be in next release.

Thanks for contributing to RTK !

@aeppling
aeppling merged commit e3f60e9 into rtk-ai:develop Jun 20, 2026
11 checks passed
@aeppling aeppling mentioned this pull request Jun 20, 2026
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.

rtk vitest filter is not --reporter-aware: --reporter=verbose is ignored and output collapses to PASS/FAIL counts

2 participants