From 2fa6e3a3b2c6470ca78b08322ba35c9722548f64 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Mon, 12 Oct 2020 08:27:58 -0700 Subject: [PATCH 1/2] test: check for AbortController existence Running tests comparitively on older versions of Node.js that do not have AbortController can be a pain. Only add the AbortController to knownGlobals if it actually exists. Signed-off-by: James M Snell --- test/common/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/common/index.js b/test/common/index.js index 58f35f37abf30a..27fdb0594c72b3 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -253,7 +253,6 @@ function platformTimeout(ms) { } let knownGlobals = [ - AbortController, clearImmediate, clearInterval, clearTimeout, @@ -264,6 +263,9 @@ let knownGlobals = [ queueMicrotask, ]; +if (global.AbortController) + knownGlobals.push(global.AbortController); + if (global.gc) { knownGlobals.push(global.gc); } From 9413138da2eb58929d5d94d7c8e976a7adcd8bf7 Mon Sep 17 00:00:00 2001 From: James M Snell Date: Tue, 13 Oct 2020 09:35:43 -0700 Subject: [PATCH 2/2] [Squash] add suggested comment --- test/common/index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/common/index.js b/test/common/index.js index 27fdb0594c72b3..35122e607ed991 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -263,6 +263,12 @@ let knownGlobals = [ queueMicrotask, ]; +// TODO(@jasnell): This check can be temporary. AbortController is +// not currently supported in either Node.js 12 or 10, making it +// difficult to run tests comparitively on those versions. Once +// all supported versions have AbortController as a global, this +// check can be removed and AbortController can be added to the +// knownGlobals list above. if (global.AbortController) knownGlobals.push(global.AbortController);