test: hold unit-test HTTP in the testing backend - #5899
Merged
norman-abramovitz merged 2 commits intoSep 9, 2026
Conversation
Every gate run printed around two hundred happy-dom `DOMException [AbortError]` traces with no file attributed. Hooking happy-dom's fetch shows real requests, one per test, aborted when the window is torn down: the branding service's company-config.json and friends. The cause is the test platform. The workspace setup initialises the TestBed platform for all eight projects with a module that provides only zoneless change detection; core's own setup does pair the http providers but never runs, because the platform already exists. Angular hands every injector a root HttpClient on the fetch backend even when nothing provides one, so a spec that never mentions HttpClient still reaches the network. The platform module now provides the client and the testing backend, so requests are held unless a spec overrides them. The specs that provided their own real client pair it with the testing backend, as CF_BASE_TEST_PROVIDERS now does; six that mixed the deprecated modules with a real provider are converted, one of which (running instances) was still sending an app-stats request. The narrowed `make test frontend` run no longer passes the ignore-unhandled-errors flag that cloudfoundry#5890 removed from the full run. Holding the requests exposed a spec that had been passing on a failed one: the CF permission checks read the endpoint list from EndpointsDataService, whose /pp/v1/info fetch failed under the real backend, so the "all endpoints" checks reduced over an empty list and returned true by default. That spec now answers /pp/v1/info and each endpoint's feature flags from the same fixtures the store module is built from. With real data the private-domain-creation check on the second endpoint is true, not false, since the fixture enables the flag there; a new case covers a flag that is disabled on its endpoint.
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.
Every
make check gaterun has been printing around two hundred happy-dom stack traces of the formDOMException [AbortError]: The operation was abortedat the head of the vitest output, with no file attributed. A sequential verbose run attributes them to 56 spec files, and hooking happy-dom'sFetch.sendRequestshows what they are: real requests, one per test —GET /assets/company-config.jsonfrom the branding service and friends — aborted when the window is torn down after each file.The cause is the test platform. The workspace setup initialises the TestBed platform once for all eight projects, and its module provides only zoneless change detection. Core's own setup does pair
provideHttpClient()withprovideHttpClientTesting(), but it never runs, because the platform already exists. Angular hands every injector a rootHttpClienton the fetch backend even when nothing provides one, so a spec that never mentions HttpClient still reaches the network.Closing the class rather than the symptom:
provideHttpClient()andprovideHttpClientTesting(), so requests are held in the testing backend unless a spec overrides it.CF_BASE_TEST_PROVIDERSnow does — 79 with a bareprovideHttpClient(), four importingHttpClientModule, and six that mixed a deprecatedHttpClientTestingModuleimport with a realprovideHttpClient()provider in the same TestBed, where the real backend won. One of those six (running instances) was still sending anapp-statsrequest and was the last AbortError in the log.make test frontend PROJECT=... SCOPE=...run still passed--dangerouslyIgnoreUnhandledErrors, which fix: make the gate warning-free and stop ignoring unhandled test errors #5890 removed from the full run; it is gone here too, with its stale comment.Two greps now come back empty and are the standing check: a spec with a real client and no testing backend, and a spec that mixes a deprecated HTTP module with a real provider.
Holding the requests exposed a spec that had been passing on a failed one.
current-user-permissions-and-cfchecker.service.spec.tsdrives the CF permission checkers, which read the connected endpoint list fromEndpointsDataService. That service fetches/pp/v1/info; under the real backend the fetch failed, the endpoint list came back empty, and the "all endpoints" checks reduced over nothing — whichreduceChecksanswerstrueby default. The feature-flag assertions were never reached. The spec now answers/pp/v1/infoand each endpoint's/pp/v1/cf/feature_flags/{cnsi}from the same fixtures the store module is built from, so the checks run over the two CF endpoints and their real flags. With real data the private-domain-creation check on the second endpoint istrue, notfalse— that fixture enables the flag there — and a new case covers a flag that is disabled on its endpoint (diego_docker), so enabled, disabled and absent are each asserted.make check gategreen: 3745 passed, 2 skipped, zero AbortError lines.