fix(@angular/build): only compile included test files in unit-test builder - #34134
Open
alan-agius4 wants to merge 1 commit into
Open
alan-agius4 wants to merge 1 commit into
alan-agius4 wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a rootFiles option to the Angular application builder and compiler options, allowing the TypeScript compilation to restrict its root names to only the specified files (such as test, setup, and provider files). This change prevents compilation errors in non-included test files during unit testing. The feedback suggests ensuring that if a custom main file is provided in the Karma options, it is also included in the rootFiles list to avoid compilation warnings or errors.
alan-agius4
force-pushed
the
fix-unit-test-include-compilation
branch
2 times, most recently
from
September 21, 2026 13:18
5f80743 to
3317656
Compare
…ilder When running the `unit-test` builder with `--include`, TypeScript compilation previously compiled all test files matched by the tsconfig file, causing compilation errors in unrelated test files to fail the test run. This change introduces an `excludeFiles` option that excludes test files not matched by the include patterns from the TypeScript program's root files, while preserving ambient declarations and application source files. Fixes angular#34089
alan-agius4
force-pushed
the
fix-unit-test-include-compilation
branch
from
September 21, 2026 17:54
3317656 to
d492fce
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running the
unit-testbuilder with--include, TypeScript compilation previously compiled all test files matched by the tsconfig file, causing compilation errors in unrelated test files to fail the test run.This change introduces a
rootFilesoption that restricts the TypeScript program's root files to only the test files to be executed (plus setup files and providers), while preserving ambient.d.tsdeclaration files discovered byreadConfiguration.Fixes #34089