From 46b64d1f46f241ed4ff5e46369ecd29a6f8d2519 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Tue, 16 Jan 2024 12:40:03 +0100 Subject: [PATCH 1/2] Avoid structuredClone Signed-off-by: Matteo Collina --- lib/fetch/body.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/fetch/body.js b/lib/fetch/body.js index 16914c14c8f..985f9909c74 100644 --- a/lib/fetch/body.js +++ b/lib/fetch/body.js @@ -274,17 +274,13 @@ function cloneBody (body) { // 1. Let « out1, out2 » be the result of teeing body’s stream. const [out1, out2] = body.stream.tee() - const out2Clone = structuredClone(out2, { transfer: [out2] }) - // This, for whatever reasons, unrefs out2Clone which allows - // the process to exit by itself. - const [, finalClone] = out2Clone.tee() // 2. Set body’s stream to out1. body.stream = out1 // 3. Return a body whose stream is out2 and other members are copied from body. return { - stream: finalClone, + stream: out2, length: body.length, source: body.source } From 54c7c7d84868342207fac5ad8acc149666048d83 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Tue, 16 Jan 2024 12:48:31 +0100 Subject: [PATCH 2/2] Fix tests for Node.js v20.11.0 Signed-off-by: Matteo Collina --- test/mock-interceptor-unused-assertions.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/mock-interceptor-unused-assertions.js b/test/mock-interceptor-unused-assertions.js index 120a2ddedba..2fe8b824f9f 100644 --- a/test/mock-interceptor-unused-assertions.js +++ b/test/mock-interceptor-unused-assertions.js @@ -7,7 +7,7 @@ const util = require('../lib/core/util') // Since Node.js v21 `console.table` rows are aligned to the left // https://github.com/nodejs/node/pull/50135 -const tableRowsAlignedToLeft = util.nodeMajor >= 21 +const tableRowsAlignedToLeft = util.nodeMajor >= 21 || (util.nodeMajor === 20 && util.nodeMinor >= 11) // Avoid colors in the output for inline snapshots. const pendingInterceptorsFormatter = new PendingInterceptorsFormatter({ disableColors: true })