Repository navigation
Conversation
When running component tests in TestBed, an application may include provideClientHydration() (e.g. from appConfig.providers) or use defer blocks with hydrate triggers without hydration providers configured. In these testing scenarios, there is no serialized server state in TransferState. As a result, Angular emitted spurious warnings: - NG0505: warning that client hydration was requested but no serialized info was found. - NG0508: warning that incremental hydration is not enabled for @defer hydrate triggers. This commit introduces an internal IS_TESTING token, provided by TestBedCompiler and BrowserTestingModule, which suppresses these warnings in test environments. Fixes angular#62053
JeanMeche
force-pushed
the
fix/hydration-test-warning
branch
from
November 11, 2026 22:39
66908e0 to
d42979a
Compare
JeanMeche
marked this pull request as ready for review
November 11, 2026 23:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running component tests in TestBed, an application configuration may include
provideClientHydration()(e.g. fromappConfig.providers) or use@deferblocks withhydratetriggers without hydration providers configured.In these testing scenarios, there is no serialized server state in
TransferStatebecause the tests run purely in the test runner. As a result, Angular emitted spurious warnings:NG0505: warning that client hydration was requested on the client, but no serialized information was present in the server response.NG0508: warning that incremental hydration is not enabled when@defer (hydrate ...)triggers are used.This commit introduces an internal
IS_TESTINGtoken (defaulting tofalse), which is provided astruebyTestBedCompilerandBrowserTestingModule. It suppresses both warnings when running inside a testing environment.Fixes #62053