Skip to content

Conversation

cexbrayat
Copy link
Member

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

it is not possible to customize the output file of a reporter for the vitest runner.

What is the new behavior?

The experimental unit-test builder now contains an additional option named outputFile that supports configuring the output file for the reporter. This option is currently only used by the vitest runner. See https://vitest.dev/config/#outputfile

Usage example:

ng test --no-watch --reporter=json --output-file=results/unit-test.json

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@angular-robot angular-robot bot added detected: feature PR contains a feature commit area: @angular/build labels Jul 9, 2025
@cexbrayat cexbrayat force-pushed the feat/vitest-output-file branch from 9e16160 to 087f61c Compare July 10, 2025 12:50
@cexbrayat cexbrayat requested a review from alan-agius4 July 10, 2025 12:50
@dougbroad-se
Copy link

The limitation of this PR is that it does not appear to support the combined outputFile object syntax where some reporters output to different files and some may still report to the console directly:
https://vitest.dev/guide/reporters.html#combining-reporters

Would be nice to still be able to log verbose/default output to the console while logging junit / other file formats to a file.

@cexbrayat
Copy link
Member Author

@dougbroad-se Yes, I deliberately chose to keep it simple for this PR. We can always add the object syntax afterwards if needed 👍

@cexbrayat cexbrayat force-pushed the feat/vitest-output-file branch from 087f61c to ccd0dc5 Compare August 15, 2025 06:40
@cexbrayat
Copy link
Member Author

@alan-agius4 I rebased on @clydin work from #30910. Can you take another look?

@cexbrayat cexbrayat force-pushed the feat/vitest-output-file branch 4 times, most recently from 0dc0a59 to 053fbd1 Compare August 19, 2025 12:43
@alan-agius4 alan-agius4 requested review from clydin and removed request for alan-agius4 August 25, 2025 19:13
@alan-agius4 alan-agius4 added the action: review The PR is still awaiting reviews from at least one requested reviewer label Aug 25, 2025
@cexbrayat cexbrayat force-pushed the feat/vitest-output-file branch 2 times, most recently from f4d70e9 to 5bccc81 Compare September 11, 2025 21:08
@clydin clydin added action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Sep 15, 2025
@clydin clydin linked an issue Sep 15, 2025 that may be closed by this pull request
@clydin clydin added the action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews label Sep 15, 2025
@clydin
Copy link
Member

clydin commented Sep 15, 2025

Can you rebase one more time? This should then be able to get merged.

Thank you for the contribution.

@clydin clydin removed the action: merge The PR is ready for merge by the caretaker label Sep 15, 2025
The experimental `unit-test` builder now contains an additional option
named `outputFile` that supports configuring the output file for the reporter.
This option is currently only used by the `vitest` runner.
See https://vitest.dev/config/#outputfile

Usage example:

```
ng test --no-watch --reporter=json --output-file=results/unit-test.json
```
@cexbrayat cexbrayat force-pushed the feat/vitest-output-file branch from 5bccc81 to 85b5400 Compare September 15, 2025 22:20
@clydin clydin added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Sep 15, 2025
@clydin clydin merged commit c0b00d7 into angular:main Sep 16, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: @angular/build detected: feature PR contains a feature commit target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Experimental vitest junit outputFile option

5 participants