Skip to content

Karma builder in 20.1 CLI version cannot execute 3rd party templates with structural directives #62573

Closed

Description

@destus90

Command

test

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

20.0

Description

When upgrading to [email protected] it is not possible for karma builder to execute 3rd party component's template.

Everything works fine in 20.0.

Minimal Reproduction

git clone https://github.com/destus90/karma-builder-spec-template-execute
npm ci
npm test

Exception or Error

Error: NG0303: Can't bind to 'ngSwitch' since it isn't a known property of 'ng-container' (used in the '_CellComponent' component template).
1. If 'ng-container' is an Angular component and it has the 'ngSwitch' input, then verify that it is included in the '@Component.imports' of this component.
2. If 'ng-container' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@Component.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@Component.schemas' of this component.

Your Environment

Angular CLI: 20.1.0
Node: 24.3.0
Package Manager: npm 11.4.2
OS: win32 x64

Angular: 20.1.0
... animations, build, cdk, cli, common, compiler, compiler-cli
... core, forms, localize, platform-browser
... platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.0
@angular-devkit/core         20.1.0
@angular-devkit/schematics   20.1.0
@schematics/angular          20.1.0
rxjs                         7.8.2
typescript                   5.8.3
zone.js                      0.15.0

Anything else relevant?

No response

Activity

  1. added theissue type on Jul 10, 2025
  2. removed theissue type on Jul 10, 2025
  3. alan-agius4 commented on Jul 10, 2025

    @alan-agius4
    Contributor

    This seems to be caused by a change in the framework.

  4. JeanMeche commented on Jul 10, 2025

    @JeanMeche
    Member

    Fwiw, there is no issue when the tests run with aot: true.

  5. added
    area: testing
    on Jul 10, 2025
  6. added this to the needsTriage milestone on Jul 10, 2025
  7. xutzin commented on Jul 11, 2025

    @xutzin

    Same issue here after upgrading to Angular CLI 20.1.0.

    Error: NG0303: Can't bind to 'ngTemplateOutlet' since it isn't a known property of 'ng-container' (used in the '_XhrButtonComponent' component template).
    1. If 'ng-container' is an Angular component and it has the 'ngTemplateOutlet' input, then verify that it is included in the '@Component.imports' of this component.
    2. If 'ng-container' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@Component.schemas' of this component to suppress this message.
    3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@Component.schemas' of this component.
    

    I'm also seeing another issue after upgrading to v20.1.
    In one of our components (ZgcODataTableTemplateComponent), we define an @Input() dataset, which worked fine before.
    Now it throws the following error during test execution:

    TypeError: Cannot set property dataset of [object HTMLElement] which has only a getter
        at EmulatedEncapsulationDomRenderer2.setProperty (http://localhost:9876/base/node_modules/@angular/platform-browser/fesm2022/dom_renderer.mjs:614:16)
        at BaseAnimationRenderer.setProperty (http://localhost:9876/base/node_modules/@angular/animations/fesm2022/browser.mjs:3988:27)
        at setDomProperty (http://localhost:9876/base/node_modules/@angular/core/fesm2022/debug_node.mjs:8073:18)
        at ɵɵdomProperty (http://localhost:9876/base/node_modules/@angular/core/fesm2022/debug_node.mjs:22759:9)
        at _ZgcODataTableTemplateComponent_Template (ng:///_ZgcODataTableTemplateComponent/ɵcmp.js:452:52)
        at executeTemplate (http://localhost:9876/base/node_modules/@angular/core/fesm2022/debug_node.mjs:7913:9)
        at refreshView (http://localhost:9876/base/node_modules/@angular/core/fesm2022/debug_node.mjs:8943:13)
        at detectChangesInView (http://localhost:9876/base/node_modules/@angular/core/fesm2022/debug_node.mjs:9163:9)
        at detectChangesInViewIfAttached (http://localhost:9876/base/node_modules/@angular/core/fesm2022/debug_node.mjs:9123:5)
        at detectChangesInComponent (http://localhost:9876/base/node_modules/@angular/core/fesm2022/debug_node.mjs:9111:5)
    

    Not sure if it's related, but both issues appeared after the upgrade.

  8. JoostK commented on Jul 16, 2025

    @JoostK
    Member

    There is a bug specific to JIT compilation, in particular this line:

    const hasDirectiveDependencies = declarations.every(

    It should use .some(...). Changing it locally fixes the reproduction.

  9. added 2 commits that reference this issue on Jul 16, 2025
    6c2a201
    ff0541d
  10. added a commit that references this issue on Jul 17, 2025
    8ad10fd
  11. added a commit that references this issue on Jul 17, 2025
    3171d01
  12. angular-automatic-lock-bot commented on Aug 17, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  13. locked and limited conversation to collaborators on Aug 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: testing

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions