Skip to content

Karma reporter:angular-polyfills factory does not return a reporter which breaks karma in some situations #31039

Closed

Description

@air2

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

When migrating/upgrading from angular 19 to 20 the update tool migrated the tests from @angular-devkit/build-angular to @angular/build

This means the webpack plugin is not used anymore, but a new angular-polyfills plugin is now used. Which is defined in @angular/build package. It's good to understand that karma uses the di library for it's dependency injection. The AngularPolyfillsPlugin is defined in such a way. The type is set to factory and a function is provided, which is run by karma. All is fine so far, however karma expects the factory function to return a reporter. This is currently not happening. It just returns undefined.

When using the karma test explorer plugin for Visual Code karma will load all defined reporters in the MultiReporter defined in multi.js in the karma project class. This will access the adapters property of every reporter and push to it.

The problem is, the factory function of the angular-polyfills reporter returns undefined. Therefor kamra crashes on startup if run with multiple reporters, which it does in case of the Karma Test Explorer extension. If the factory function would return { adapters:[] } all works fine and Karma Test Explorer is all happy again, because now karma does not crash when executed.

However I am not an expert at all in karma reporters and the di library. So it is very well possible, some other solution, change is more appropriate to fix this issue. And I am fully aware karma is deprecated, but because there is no stable, non experimental replacement available just yet, I would really really appreciate it, if this plugin get fixed so karma will work again in scenarios other as ng test.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw


Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 20.1.6
Node: 22.16.0
Package Manager: npm 11.5.2
OS: win32 x64

Angular: 20.1.7
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                      Version
------------------------------------------------------
@angular-devkit/architect    0.2001.6
@angular-devkit/core         20.1.6
@angular-devkit/schematics   20.1.6
@angular/build               20.2.0
@angular/cdk                 20.2.0
@angular/cli                 20.1.6
@schematics/angular          20.1.6
rxjs                         7.8.2
typescript                   5.8.3
zone.js                      0.15.1

Anything else?

No response

Activity

  1. transferred this issue fromangular/angularon Aug 26, 2025
  2. added a commit that references this issue on Aug 27, 2025
    0b6ebb2
  3. added 2 commits that reference this issue on Aug 27, 2025
    4b49a20
    b6816b0
  4. angular-automatic-lock-bot commented on Sep 27, 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.

  5. locked and limited conversation to collaborators on Sep 27, 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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions