Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Closed
@air2

Description

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

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

        AltStyle によって変換されたページ (->オリジナル) /