From 499750ff7a543d45bf2696459e616a61f1bac3e0 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Mon, 31 Oct 2022 14:02:56 +0100 Subject: [PATCH] test: update list of known globals This is important to allow to run v16 doc tests on more recent versions. PR-URL: https://github.com/nodejs/node/pull/45255 Refs: https://github.com/nodejs/node/actions/runs/3356902660/jobs/5562322617 Reviewed-By: Richard Lau Reviewed-By: Beth Griggs --- test/common/index.js | 40 ++++++++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 8 deletions(-) diff --git a/test/common/index.js b/test/common/index.js index b67eda86ad0e92..66ffe3cf9b1c59 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -291,6 +291,9 @@ if (global.gc) { knownGlobals.push(global.gc); } +if (global.Performance) { + knownGlobals.push(global.Performance); +} if (global.performance) { knownGlobals.push(global.performance); } @@ -301,16 +304,16 @@ if (global.PerformanceMeasure) { knownGlobals.push(global.PerformanceMeasure); } -if (global.fetch) { - knownGlobals.push( - global.fetch, - global.FormData, - global.Request, - global.Response, - global.Headers, - ); +// TODO(@ethan-arrowood): Similar to previous checks, this can be temporary +// until v16.x is EOL. Once all supported versions have structuredClone we +// can add this to the list above instead. +if (global.structuredClone) { + knownGlobals.push(global.structuredClone); } +if (global.fetch) { + knownGlobals.push(fetch); +} if (hasCrypto && global.crypto) { knownGlobals.push(global.crypto); knownGlobals.push(global.Crypto); @@ -320,6 +323,27 @@ if (hasCrypto && global.crypto) { if (global.CustomEvent) { knownGlobals.push(global.CustomEvent); } +if (global.ReadableStream) { + knownGlobals.push( + global.ReadableStream, + global.ReadableStreamDefaultReader, + global.ReadableStreamBYOBReader, + global.ReadableStreamBYOBRequest, + global.ReadableByteStreamController, + global.ReadableStreamDefaultController, + global.TransformStream, + global.TransformStreamDefaultController, + global.WritableStream, + global.WritableStreamDefaultWriter, + global.WritableStreamDefaultController, + global.ByteLengthQueuingStrategy, + global.CountQueuingStrategy, + global.TextEncoderStream, + global.TextDecoderStream, + global.CompressionStream, + global.DecompressionStream, + ); +} function allowGlobals(...allowlist) { knownGlobals = knownGlobals.concat(allowlist);