Skip to content

fix(@angular/build): support extra test setup files with unit-test vitest runner #30664

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

clydin
Copy link
Member

@clydin clydin commented Jul 7, 2025

When using the experimental unit-test builder with Vitest, a new setupFiles option is now available. This option is similar to the Vitest option in that it allows for setup and configuration prior to each test. The setupFiles are executed after any application polyfills as well as after the TestBed initialization. If custom TestBed initialization is needed (this is not typical), The TestBed environment can first be reset in a setupFile and then initialized as needed. Note that resetting the TestBed environment in this way will cause the providersFile to no longer add any providers to the tests and any custom providers would need to be manually added during initialization.

@clydin clydin added the target: rc This PR is targeted for the next release-candidate label Jul 7, 2025
…test runner When using the experimental unit-test builder with Vitest, a new `setupFiles` option is now available. This option is similar to the Vitest option in that it allows for setup and configuration prior to each test. The `setupFiles` are executed after any application polyfills as well as after the TestBed initialization. If custom TestBed initialization is needed (this is not typical), The TestBed environment can first be reset in a setupFile and then initialized as needed. Note that resetting the TestBed environment in this way will cause the `providersFile` to no longer add any providers to the tests and any custom providers would need to be manually added during initialization.
@clydin clydin force-pushed the unit-test/setup-files branch from 27e8f9e to 4ec2a33 Compare July 7, 2025 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: @angular/build target: rc This PR is targeted for the next release-candidate
1 participant