Repository navigation
Open
Labels
area: serverIssues related to server-side renderingIssues related to server-side renderingarea: testingIssues related to Angular testing features, such as TestBedIssues related to Angular testing features, such as TestBed
Milestone
Description
Which @angular/* package(s) are the source of the bug?
Don't known / other
Is this a regression?
Yes
Description
Steps to reproduce:
ng new bugtest --ssr --style scss- Update all dependencies to the latest versions
- add
@defer(hydrate on idle)around any part ofsrc/app/app.component.html - add
providers: [provideClientHydration(withIncrementalHydration())]toapp.component.spec.ts ng test --watch=false
It's quite possible that I'm trying to do this the wrong way in the test, but if this is not a bug then the lack of any documentation about hydration in tests should probably be addressed. (e.g. I could not find a way to disable SSR just for tests, or to configure it properly for tests)
This does not seem to affect non-testing environments (e.g. no warnings during ng serve).
afaict this started happening on the upgrade to main version 20.0.2 (upgrade of @angular/ssr to 20.0.1) - this PR on my project. You can see these warnings all throughout the latest CI action runs on that project.
Please provide a link to a minimal reproduction of the bug
https://stackblitz.com/edit/angular-ng0505-bug
Please provide the exception or error you saw
$ ng test --watch=false --browsers=ChromeHeadless
✔ Browser application bundle generation complete.
14 06 2025 00:09:43.408:INFO [karma-server]: Karma v6.4.4 server started at http://localhost:9876/
14 06 2025 00:09:43.413:INFO [launcher]: Launching browsers ChromeHeadless with concurrency unlimited
14 06 2025 00:09:43.418:INFO [launcher]: Starting browser ChromeHeadless
14 06 2025 00:09:44.592:INFO [Chrome Headless 137.0.0.0 (Mac OS 10.15.7)]: Connected on socket hq0ruqj_KWUqyIj8AAAB with id 8331579
WARN: 'NG0505: Angular hydration was requested on the client, but there was no serialized information present in the server response, thus hydration was not enabled. Make sure the `provideClientHydration()` is included into the list of providers in the server part of the application configuration. Find more at https://angular.dev/errors/NG0505'
Chrome Headless 137.0.0.0 (Mac OS 10.15.7): Executed 0 of 3 SUCCESS (0 secs / 0 secs)
WARN: 'NG0505: Angular hydration was requested on the client, but there was no serialized information present in the server response, thus hydration was not enabled. Make sure the `provideClientHydration()` is included into the list of providers in the server part of the application configuration. Find m
WARN: 'NG0505: Angular hydration was requested on the client, but there was no serialized information present in the server response, thus hydration was not enabled. Make sure the `provideClientHydration()` is included into the list of providers in the server part of the application configuration. Find more at https://angular.dev/errors/NG0505'
Chrome Headless 137.0.0.0 (Mac OS 10.15.7): Executed 1 of 3 SUCCESS (0 secs / 0.098 secs)
WARN: 'NG0505: Angular hydration was requested on the client, but there was no serialized information present in the server response, thus hydration was not enabled. Make sure the `provideClientHydration()` is included into the list of providers in the server part of the application configuration. Find m
WARN: 'NG0505: Angular hydration was requested on the client, but there was no serialized information present in the server response, thus hydration was not enabled. Make sure the `provideClientHydration()` is included into the list of providers in the server part of the application configuration. Find more at https://angular.dev/errors/NG0505'
Chrome Headless 137.0.0.0 (Mac OS 10.15.7): Executed 2 of 3 SUCCESS (0 secs / 0.104 secs)
WARN: 'NG0505: Angular hydration was requested on the client, but there was no serialized information present in the server response, thus hydration was not enabled. Make sure the `provideClientHydration()` is included into the list of providers in the server part of the application configuration. Find m
Chrome Headless 137.0.0.0 (Mac OS 10.15.7): Executed 3 of 3 SUCCESS (0.124 secs / 0.109 secs)
TOTAL: 3 SUCCESS
Please provide the environment you discovered this bug in (run ng version)
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 20.0.2
Node: 24.1.0
Package Manager: npm 11.4.2
OS: darwin x64
Angular: 20.0.3
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
---------------------------------------------------------
@angular-devkit/architect 0.2000.2
@angular-devkit/build-angular 20.0.2
@angular-devkit/core 20.0.2
@angular-devkit/schematics 20.0.2
@angular/cli 20.0.2
@angular/ssr 20.0.2
@schematics/angular 20.0.2
rxjs 7.8.2
typescript 5.8.3
zone.js 0.15.1
Anything else?
No response
Reacted by Arthur N., Oleksandr Dede, Daniel Subelman and Antt85
Metadata
Metadata
Assignees
Labels
area: serverIssues related to server-side renderingIssues related to server-side renderingarea: testingIssues related to Angular testing features, such as TestBedIssues related to Angular testing features, such as TestBed
Activity
rdamazio commentedon Jun 14, 2025
(and this is probably related to #61741 , but also couldn't find any hints in that PR on how tests should be handled)
rdamazio commentedon Nov 8, 2025
FYI still happening with the latest Angular release versions. Any guidance on how to avoid this?
rdamazio commentedon Nov 17, 2025
I found a hacky workaround - setting
globalThis.ngServerMode = truebefore the test starts (but I have to reset it back before anyafterNextRendercalls, of course)Would be great to have an official solution.
ApplY3D commentedon Feb 2, 2026
You need to include the incremental hydration providers in your
TestBedconfiguration:rdamazio commentedon Feb 2, 2026
Yes, I've tried that, but it didn't help 😦
fix(core): suppress hydration warnings in test environments