How to fix unit test warnings for angular-zoneless application?

Discussão em 'Angular' iniciado por k.vincent, Março 21, 2025.

  1. k.vincent

    k.vincent Guest

    I changed my angular app V 19.x to ZoneLess app (I did uninstall the Zone.js and removed its import from polyfills.ts). All works fine. The issue is when running the unit test (using jest). The spec files have been all changed to use Zoneless adding:

    provideExperimentalZonelessChangeDetection() in providers:[] matadata etc.

    The test runs all fine and no errors, but I keep getting the following warning in the console for each spec file which is bad:

    console.warn
    NG0914: The application is using zoneless change detection, but is still loading Zone.js. Consider removing Zone.js to get the full benefits of zoneless. In applications using the Angular CLI, Zone.js is typically included in the "polyfills" section of the angular.json file.

    247 | providers: [
    > 248 | provideExperimentalZonelessChangeDetection(),
    | ^
    249 | {
    250 | provide: AppSettingsService,
    251 | useValue: getAppSettingsServiceSpy()
    },
    ...
    ]


    I have been searching and tried some options, but none of my tries fixes the warning. Any idea or a hint what could be the cause please?

    Continue reading...

Compartilhe esta Página