test(compiler-cli): add compliance coverage for under-tested emit behaviors#69913
Draft
mattrbeck wants to merge 2 commits into
Draft
test(compiler-cli): add compliance coverage for under-tested emit behaviors#69913mattrbeck wants to merge 2 commits into
mattrbeck wants to merge 2 commits into
Conversation
mattrbeck
force-pushed
the
test/compliance-additional-coverage
branch
3 times, most recently
from
July 23, 2026 17:43
f718c90 to
e79acac
Compare
…aviors Adds file-based compliance test cases for a number of compiler emit behaviors that are currently exercised only in ngtsc unit tests (or not covered at all) rather than in the compliance suite. Each case is added to the existing compliance directory that matches its area, alongside the related cases, rather than in a separate tree. New cases span: - NgModule (r3_compiler_compliance/ng_modules): the setNgModuleScope JIT scope call, injector providers (useClass/useExisting/useValue/multi/ useFactory), same-file ModuleWithProviders, standalone declarables in imports, exports-only re-exports, and nested-array / forwardRef injector imports. - DI: constructor injection flags (@Optional/@Self/@SkipSelf/@Host/ @Attribute) in r3_view_compiler_di, and @Injectable providedIn variants ('platform'/'any'/a module type) in service_decorator. - Directives/components (r3_compiler_compliance, r3_view_compiler_bindings, r3_view_compiler_styling, r3_view_compiler_input_outputs): @input transforms, @HostBinding/@HostListener merged with the host object, host [class]/[style] bindings, exportAs read via a template-reference query, cross-file inheritance (InheritDefinitionFeature), and OnPush change detection / encapsulation metadata. - Signals (signal_inputs): input()/input.required()/model()/output(). - Templates: two-way binding to a model (r3_view_compiler_bindings), @defer with triggers (r3_view_compiler_deferred), multi-slot content projection with ngProjectAs (r3_compiler_compliance), and @for with track and @empty (r3_view_compiler_control_flow). - i18n (r3_view_compiler_i18n): $localize meaning/description/id metadata and placeholders, i18n attributes, plural and nested (select-in-plural) ICUs, and an i18n block wrapping @if/@else. - Sanitization: sanitizeUrlOrResourceUrl for ambiguous host src/href on an attribute-only directive (r3_view_compiler_bindings), trustConstantResourceUrl for static resource URLs and an SVG xlink:href binding (r3_compiler_compliance elements). Each case runs in full and/or local compilation mode, with expected files verified against the compiler output and golden partials generated.
mattrbeck
force-pushed
the
test/compliance-additional-coverage
branch
from
July 23, 2026 18:08
e79acac to
6430218
Compare
…, declaration ordering, and forwardRef exports Adds compliance test coverage for: - Pipe resolution precedence across imported modules (last imported pipe is selected) - Directive/component ordering in component dependencies (imported module declarables before local declarations) - ForwardRef module unwrapping in NgModule exports to injector imports
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.
A number of compiler emit behaviors are exercised only in ngtsc unit tests, or are not covered anywhere, rather than in the file-based compliance suite. For example the
ɵɵsetNgModuleScopeJIT-scope call is always elided behind…in existing goldens, andɵɵsanitizeUrlOrResourceUrl(the runtime URL/resource-URL sanitizer used for ambiguous host bindings) has no compliance coverage. This change adds compliance test cases for these behaviors.Coverage added, by destination directory:
r3_compiler_compliance/ng_modules—ɵɵsetNgModuleScope(declarations/imports/exports; previously only ever elided), injector providers (useClass/useExisting/useValue/multi/useFactory+deps), same-fileforRoot()ModuleWithProviders(raw call in the injector, unwrapped module in the scope), standalone declarables excluded from the injector but kept in scope, exports-only re-exported modules, nested-array/constant injector imports (with full-mode scope flattening), andforwardRefimports lowered to a closure in the scope.r3_view_compiler_di/diandservice_decorator— constructor injection flags (@Optional/@Self/@SkipSelf/@Host/@Attribute), and@Injectable({ providedIn })variants ('platform','any', a module type).r3_compiler_compliance/components_and_directives,r3_view_compiler_bindings,r3_view_compiler_styling,r3_view_compiler_input_outputs—@Inputtransforms encoded inline in the inputs map,@HostBinding/@HostListenermerged with thehostobject, host[class]/[style]map bindings plus a[style.width.px]unit binding,exportAsread via a template-referenceviewQuery, cross-file inheritance (ɵɵInheritDefinitionFeature), and OnPush change-detection / encapsulation metadata.signal_inputs—input()/input.required()/model()/output()metadata (signal input flag, model two-way output).r3_view_compiler_bindings/r3_view_compiler_deferred/r3_compiler_compliance/r3_view_compiler_control_flow— two-way binding to a signalmodel(), a@deferblock (interaction trigger + prefetch-on-idle + placeholder/loading timing), multi-slot content projection withngProjectAs, and an@forblock with atrackfunction and@empty.r3_view_compiler_i18n— a$localizemessage withmeaning|description@@idmetadata and interpolation/tag placeholders,ɵɵi18nAttributes, plural and nested (select-in-plural) ICUs viaɵɵi18nPostprocess, and an i18n block wrapping@if/@else.r3_view_compiler_bindings/host_bindingsandr3_compiler_compliance/elements—ɵɵsanitizeUrlOrResourceUrlfor ambiguoussrc/hrefhost bindings on an attribute-only directive (element unknown at compile time),ɵɵtrustConstantResourceUrlfor static security-sensitive resource URLs, and an SVG-namespacedxlink:hrefbinding.Note: the prettier reformatting of the existing
TEST_CASES.jsonfiles this change appends to is split into #69916 to keep this diff to pure additions. Until that lands, theng-dev formatcheck here will fail on those files; rebasing on top of it clears the check.