Skip to content

Commit 226c180

Browse files
jasnellBethGriggs
authored andcommittedDec 7, 2020
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 <jasnell@gmail.com> PR-URL: #35616 Reviewed-By: Denys Otrishko <shishugi@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent f6ebd81 commit 226c180

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

‎test/common/index.js

+9
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,15 @@ let knownGlobals = [
262262
queueMicrotask,
263263
];
264264

265+
// TODO(@jasnell): This check can be temporary. AbortController is
266+
// not currently supported in either Node.js 12 or 10, making it
267+
// difficult to run tests comparitively on those versions. Once
268+
// all supported versions have AbortController as a global, this
269+
// check can be removed and AbortController can be added to the
270+
// knownGlobals list above.
271+
if (global.AbortController)
272+
knownGlobals.push(global.AbortController);
273+
265274
if (global.gc) {
266275
knownGlobals.push(global.gc);
267276
}

0 commit comments

Comments
 (0)
Please sign in to comment.