Repository navigation
Conversation
On Node 26, InspectorProxyCdpRewritingHacks-test.js fails over HTTPS:
"Debugger.getScriptSource fetches source from server" gets
`fetch failed` instead of the script source.
`withFetchSelfSignedCertsForAllTests` spies on the global `fetch` and
passes it an `Agent` from the undici package (6.x) that accepts
self-signed certificates. The global `fetch` runs on the undici bundled
with Node, which is 8.x on Node 26 and calls the dispatcher with a
handler interface that undici 6 rejects ("invalid onError method").
Answer the spied `fetch` calls with the undici package's `request`,
which the other helpers in FetchUtils.js already use, and wrap the
status and body text in a `Response`. The package's own `fetch` is not
an option: it throws under Jest because the environment's `performance`
has no `markResourceTiming`. The helper no longer calls the original
`fetch`, so its `fetchOriginal` parameter is removed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Summary:
On Node 26, one dev-middleware test fails over HTTPS:
withFetchSelfSignedCertsForAllTestsspies on the globalfetchand passes it anAgentfrom theundicipackage (6.23.0) that accepts the test server's self-signed certificate. The globalfetchruns on the undici bundled with Node, which is 8.x on Node 26. It calls the dispatcher with a handler interface that undici 6 rejects, so the request fails withInvalidArgumentError: invalid onError method.This change answers the spied
fetchcalls with theundicipackage'srequest, which the other helpers inFetchUtils.jsalready use, and wraps the status and body text in aResponse. The helper no longer calls the originalfetch, so itsfetchOriginalparameter is removed. The Flow definition for undici gainsbody.text().The
undicipackage's ownfetchwould be a smaller change, but it throwsmarkResourceTiming is not a functionunder Jest, whoseperformanceglobal lacks that method.Changelog:
[INTERNAL] [FIXED] - Fix the dev-middleware HTTPS tests on Node 26
Test Plan:
Run on Node 26.12.0 against
94aee19ac9:main: 1 of 143 tests fails ("fetches source from server" over HTTPS, as above); 11 of 12 suites pass.The cause reproduces outside Jest: on Node 26,
fetch(url, {dispatcher: new (require('undici').Agent)()})rejects withfetch failed, caused byInvalidArgumentError: invalid onError methodfrom undici 6'sAgent.dispatch.yarn flow-checkreports no errors.yarn eslint --max-warnings 0andprettier --checkpass on the three changed files. I did not run the suite on Node 22 or 24.🤖 Generated with Claude Code