angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

fix(@angular/build): fix setup files duplicate modules

Open yjaaidi opened this issue 2 months ago • 1 comments

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:

  • [X] The commit message follows our guidelines: https://github.com/angular/angular-cli/blob/main/CONTRIBUTING.md#-commit-message-guidelines
  • [X] Tests for the changes have been added (for bug fixes / features)
  • [X] Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • [X] 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
  • [X] No

Other information

yjaaidi avatar Nov 13 '25 15:11 yjaaidi

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 😊

yjaaidi avatar Nov 13 '25 15:11 yjaaidi