Skip to content

fix(vitest): respect reporters from target options in vitest executor#34663

Merged
leosvelperez merged 1 commit intomasterfrom
gh-34495
Mar 2, 2026
Merged

fix(vitest): respect reporters from target options in vitest executor#34663
leosvelperez merged 1 commit intomasterfrom
gh-34495

Conversation

@leosvelperez
Copy link
Copy Markdown
Member

Current Behavior

The vitest executor ignores reporter/reporters set in target options (project.json). Both forms leak through as passthrough CLI args, causing vitest's resolveConfig to override the reporters array (which includes NxReporter), making the executor hang indefinitely.

Additionally, when the vite config uses reporter (singular), the config value always overrides the reporters array passed as inline options — again removing NxReporter.

Expected Behavior

Target-level reporter/reporters options take priority over config-file values. NxReporter is always preserved in the final reporters array regardless of configuration source.

Priority chain: target reporter (singular) > target reporters (plural) > config reporter (singular) > config reporters (plural).

Related Issue(s)

Fixes #34495

@leosvelperez leosvelperez requested a review from a team as a code owner March 2, 2026 14:18
@leosvelperez leosvelperez requested a review from Coly010 March 2, 2026 14:18
@netlify
Copy link
Copy Markdown

netlify bot commented Mar 2, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit a55fab5
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69a59dd9042b6700080ec62c
😎 Deploy Preview https://deploy-preview-34663--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@netlify
Copy link
Copy Markdown

netlify bot commented Mar 2, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit a55fab5
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69a59dd9d734ad000871963b
😎 Deploy Preview https://deploy-preview-34663--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud bot commented Mar 2, 2026

View your CI Pipeline Execution ↗ for commit a55fab5

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ✅ Succeeded 1h 1m 37s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 2m 20s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 7s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-03-02 15:31:21 UTC

Target-level `reporter`/`reporters` options were being passed through
to vitest as CLI args, causing vitest's resolveConfig to override the
reporters array (which includes NxReporter), making the executor hang.

Extract both forms from passThroughOptions and give them priority over
config-file reporters. Set `reporter: []` to neutralize config's singular
`reporter` from overriding NxReporter in vitest's resolveConfig step 2.

Fallback chain: target reporter > target reporters > config reporter
(singular) > config reporters (plural).

Fixes #34495
@leosvelperez leosvelperez enabled auto-merge (squash) March 2, 2026 14:28
@leosvelperez leosvelperez merged commit 2c802ba into master Mar 2, 2026
23 of 24 checks passed
@leosvelperez leosvelperez deleted the gh-34495 branch March 2, 2026 15:31
FrozenPandaz pushed a commit that referenced this pull request Mar 4, 2026
…#34663)

## Current Behavior

The vitest executor ignores `reporter`/`reporters` set in target options
(project.json). Both forms leak through as passthrough CLI args, causing
vitest's `resolveConfig` to override the `reporters` array (which
includes NxReporter), making the executor hang indefinitely.

Additionally, when the vite config uses `reporter` (singular), the
config value always overrides the `reporters` array passed as inline
options — again removing NxReporter.

## Expected Behavior

Target-level `reporter`/`reporters` options take priority over
config-file values. NxReporter is always preserved in the final
reporters array regardless of configuration source.

Priority chain: target `reporter` (singular) > target `reporters`
(plural) > config `reporter` (singular) > config `reporters` (plural).

## Related Issue(s)

Fixes #34495

(cherry picked from commit 2c802ba)
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 8, 2026

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 Mar 8, 2026
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.

@nx/vitest doesn't pass through reporters from target options

2 participants