Skip to content

Conversation

@yjaaidi
Copy link
Contributor

@yjaaidi yjaaidi commented Nov 13, 2025

This includes setup files in the initial build and avoids lazy discovery and thus module duplicates.
Module duplicates can break many things such as dependency injection.

⚠️ this only handles setupFiles directly provided to the builder.
Handling setupFiles from the Vitest config requires substantial additional effort.

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?

Issue Number: #31732

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This includes setup files in the initial build and avoids lazy discovery and thus module duplicates.
Module duplicates can break many things such as dependency injection.

Closes angular#31732
@yjaaidi
Copy link
Contributor Author

yjaaidi commented Nov 13, 2025

I tried to keep this the less intrusive possible but I wonder if the right fix wouldn't involve changes to TestRunner API.
Feel free to either pick this a quick fix and revert it after the release for a proper fix, or just see it as a spike and throw it away 😊

* @param options Configuration options for generating entry points.
* @returns A map where keys are the generated unique bundle names and values are the original file paths.
*/
export function getSetupEntrypoints(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not happy with this.
I would rather have a single getEntrypoints that returns both test files and setup files then we would have to forward the setup file names to the executor somehow.

projectSourceRoot,
workspaceRoot,
removeTestExtension,
prefix: 'setup',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produces bundles named setup-test-setup which is weird.
An empty string would be better but collisions could happen with a setup file called spec-setup... or something.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant