Yicong-Huang opened a new issue, #4864:
URL: https://github.com/apache/texera/issues/4864

   ### Task Summary
   
   Re-enable the 43 `*.component.spec.ts` files that #4862 had to exclude. The 
new `@angular/build:unit-test` builder type-checks each component's template 
against the bundle's standalone scope (not the declaring NgModule's scope), so 
NgModule-declared components fail to resolve their template directives — 
`[ngModel]`, `<nz-dropdown-menu>`, custom selectors like 
`<texera-user-avatar>`, etc. ~1000 NG8002/NG8001/NG8004 errors before exclusion.
   
   ### Two viable approaches
   
   **A. Convert components to standalone** (Angular's recommended direction)
   
   For each affected component:
   1. `@Component({ standalone: false, ... })` → `@Component({ standalone: 
true, imports: [CommonModule, FormsModule, ...moduleSpecificModules], ... })`
   2. Remove the component from the declaring NgModule's `declarations` array; 
add to `imports` instead.
   
   Pros: future-proof, matches Angular team direction, eliminates the implicit 
NgModule scope dependency.
   Cons: per-component imports list must be derived from what each template 
uses; ~43 components to migrate.
   
   **B. Schema overrides at the spec level**
   
   For each component spec, add `schemas: [CUSTOM_ELEMENTS_SCHEMA]` to TestBed 
setup so the strict template checker tolerates unknown elements.
   
   Pros: faster to apply.
   Cons: silently masks real bugs (typos in element names won't fail tests), 
and only addresses NG8001-style errors — `[ngModel]` not being resolved is 
NG8002 which schemas don't suppress.
   
   **Recommendation**: A. Doing this in chunks (group by feature area) keeps 
each PR reviewable.
   
   ### Affected files
   
   43 files matching `**/*.component.spec.ts`. Currently excluded by 
`tsconfig.spec.json` and `angular.json`'s test-target `exclude`.
   
   ### Definition of done
   
   - All 43 component specs compile under the unit-test builder
   - Each runs to either passing or a documented runtime issue (likely a 
separate follow-up)
   - Exclusion entries removed from `tsconfig.spec.json` and `angular.json`
   
   ### Tracking
   
   - Umbrella: #4861
   - Predecessor: #4863


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to