Skip to content

fix(vite): NxReporter compatible with Vitest ≥0.29#31425

Merged
Coly010 merged 1 commit intonrwl:masterfrom
VibeOOO:fix/nx-reporter-cross-version
Jun 9, 2025
Merged

fix(vite): NxReporter compatible with Vitest ≥0.29#31425
Coly010 merged 1 commit intonrwl:masterfrom
VibeOOO:fix/nx-reporter-cross-version

Conversation

@enki
Copy link
Copy Markdown
Contributor

@enki enki commented Jun 2, 2025

Current Behavior

Running nx test … --reporter=verbose (or any additional Vitest reporter) on
projects that use Vitest ≥ 0.29 hangs indefinitely at the end of the run.
vitest itself finishes, but the Nx task-runner never receives the done
signal because NxReporter only implements the legacy
onFinished() hook
.
When multiple reporters are configured, Vitest now emits
onTestRunEnd() instead of onFinished(), so the promise in NxReporter
remains unresolved and the worker process stays alive forever.

Expected Behavior

nx test (and affected nx run-many --target=test) exits cleanly on all
Vitest versions, regardless of how many reporters are passed.

  • NxReporter resolves its internal promise via either
    onTestRunEnd (Vitest ≥ 0.29) or onFinished (Vitest ≤ 0.28).
  • No functional change in watch-mode.
  • No extra timers or fallbacks – just one shared helper.

Implementation Notes

  • Added onTestRunEnd method that delegates to a private _handleFinished.
  • Re-implemented onFinished as a thin delegate to the same helper.
  • Original error-detection logic is untouched.

Related Issue(s)

Closes nrwl/nx#<insert-issue-number-if/when-one-exists>

@enki enki requested a review from a team as a code owner June 2, 2025 17:01
@enki enki requested a review from Coly010 June 2, 2025 17:01
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 2, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Updated (UTC)
nx-dev ⬜️ Ignored (Inspect) Visit Preview Jun 2, 2025 5:04pm

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented Jun 9, 2025

View your CI Pipeline Execution ↗ for commit 5a03956.

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 35m 44s View ↗
nx run-many -t check-imports check-commit check... ✅ Succeeded 18s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 3s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 2s View ↗
nx documentation ✅ Succeeded 55s View ↗

☁️ Nx Cloud last updated this comment at 2025-06-09 09:42:39 UTC

@Coly010 Coly010 merged commit c9021b0 into nrwl:master Jun 9, 2025
9 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants