Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 9, 2025

Conversation

enki
Copy link
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
Copy link

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

Copy link
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
Copy link

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
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy