Repository navigation
Make the full test suite pass on Node.js LTS and latest - #2
Merged
Merged
Conversation
Backport of bb8eca9 (Got 12) to v11. The lock replaced `write`/`end` with a function throwing `The payload has been already provided` and relied on the order of `pipe` listeners to unlock right before a piped source ends. Since Node.js 17.3, `stream.pipeline()` calls `end()` from its own listener after the lock is re-applied, so `pipeline(request, got.stream(''), response)` throws that TypeError as an uncaught exception. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VZiY7VMgg1nEMkCezwMXEC
`clone-response` copies `complete` onto the cloned response before the body has been piped, so it stays `false`. With keep-alive agents (the default since Node.js 20), the ClientRequest is already destroyed when the promise API checks `request.aborted`, which is derived from both values, so it returned early and the request never settled. Make `complete` on the clone reflect whether the original response has been fully piped (`writableEnded`). Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VZiY7VMgg1nEMkCezwMXEC
- Accept the `Invalid URL` error format with `input` (invalid-url helper) - Accept `::1` for localhost, `keep-alive` connections and V8's JSON parse error message - Accept IPv4 or IPv6 for `dnsLookupIpVersion: 'auto'` - Pass a numeric `family` in the deprecation test, since Node.js now rejects `'4'` before Got's warning is observed - Honor `options.all` in the fake `lookup` - Accept `The server aborted pending request` for broken gzip streams - Create test certificates with CA and server extensions required by OpenSSL 3, and accept `ERR_OSSL_BAD_DECRYPT` - Use a static expired certificate fixture, since OpenSSL 3.5 no longer creates certificates with negative validity - Skip key passphrase tests on macOS, as upstream does Most of these match the upstream test changes. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VZiY7VMgg1nEMkCezwMXEC
Dev dependencies stay resolved as of 2021-06-15 (TypeScript 4.0.3 tooling), runtime dependencies are the latest in range like consumers get, plus pem 1.14.8 for OpenSSL 3. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VZiY7VMgg1nEMkCezwMXEC
GitHub Actions runners resolve unknown hosts with EAI_AGAIN. The message assertion already allowed it; upstream accepts both codes too. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01VZiY7VMgg1nEMkCezwMXEC
This was referenced Sep 14, 2026
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.
Makes the complete v11 test suite pass on Node.js LTS and latest and runs it on CI. That's the release gate for
@kikobeats/got.Before this PR, 63 of 534 tests failed on Node.js 24.20.0. Two of those failures were real bugs in got v11 on modern Node.js, not outdated tests.
Bug fixes (
source/)1.
stream.pipeline()into a Got stream throws an uncaughtTypeErrorpipeline(request, got.stream(''), response)crashed the process withThe payload has been already providedon Node.js 18 and later.The stream lock swapped
write/endfor a throwing function and relied onpipelistener order to unlock right before the source ended. Since Node.js 17.3,pipeline()callsend()from its own listener after the lock is back on.Fix: backport of upstream bb8eca9 ("Remove stream lock - unreliable since Node 17.3.0"), including removal of the two tests that asserted the lock.
2. Cached responses never resolve with keep-alive agents
got(url, {cache})never settles, on the first request as well as later ones, on Node.js 20 and later, where keep-alive is the default. Repro: 18 resolves; 20, 22, 24.20.0 and 26 hang, with stock[email protected]too.clone-responsecopiescompleteonto the clone before the body is piped, so it staysfalse. By the time the promise API checksrequest.aborted(theClientRequestis destroyed andcompleteis false), the keep-aliveClientRequesthas already been released. Soabortedis wronglytrueand the body is never read.Fix: on the
clone-responsePassThrough,completebecomes a getter backed bywritableEnded. RealIncomingMessageobjects and cache hits don't change. Upstream replaced this logic entirely in the Got 12 rewrite, so there's nothing smaller to backport. The existingcache.tsandcancel.tstests cover it: 10 of them hang without the fix.Test updates (
test/)These tests are outdated for current Node.js and OpenSSL. Most of the updates match upstream's own changes to the same tests.
arguments,helpers,error(Invalid URL)invalid-urlhelper acceptsInvalid URLwithinputas well as the oldInvalid URL: <input>promise(response IP)127.0.0.1or::1error(properties)connection: keep-aliveresponse-parse(ParseErrors)/^Unexpected token/for V8's new messagehttp(DNS auto)http(deprecatedfamily)family: 4; Node.js now rejects'4'before Got'sDeprecationWarningcan be observedtimeout(early lookup)lookuphonorsoptions.allgzip(premature close)The server aborted pending requesterror(DNS errors)ENOTFOUNDorEAI_AGAIN; GitHub runners returnEAI_AGAINstream(pipeline)code: 'ECONNREFUSED', sincelocalhostnow fails with an empty-messageAggregateErrorunsuitable certificate purposeotherwise)https(invalid passphrase)ERR_OSSL_BAD_DECRYPTorERR_OSSL_EVP_BAD_DECRYPThttps(key passphrases)https(expired certificate)test/fixtures/expired-certificate(expired 2000-01-02, CA valid until 2100); OpenSSL 3.5 refuses negative-daysThe fixture includes a private key for a certificate that expired in 2000. It's test-only, and the CA's private key isn't committed.
CI
.github/workflows/test.ymlruns build and the fullavasuite onlts/*andlatest.@types/[email protected]and[email protected](OpenSSL 3 support) are installed without being saved.xo0.34'seslint-plugin-avacallsutil.isDate, which was removed in Node.js 23, so it can't run on LTS or latest.Verification
lts/*(Node.js 24.20.0) andlatest(Node.js 26.8.2), OpenSSL 3.0.13test.failingfrom v11.8.6)node:24.20.0(OpenSSL 3.0.20), CI stepsnode:26= 26.8.2 (OpenSSL 3.5.6), CI stepsclient certificate PFXtest.skipin the source; 2 are IPv6 tests that skip without an external IPv6 interface./usr/bin/opensslis LibreSSL, which creates legacy PKCS#12 that Node.js can't read. It passes withOPENSSL_BIN=$(brew --prefix openssl@3)/bin/openssl.🤖 Generated with Claude Code
https://claude.ai/code/session_01VZiY7VMgg1nEMkCezwMXEC