Skip to content

Commit

Permalink
test: check for AbortController existence
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
jasnell authored and BethGriggs committed Dec 7, 2020
1 parent f6ebd81 commit 226c180
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/common/index.js
Expand Up @@ -262,6 +262,15 @@ 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);

if (global.gc) {
knownGlobals.push(global.gc);
}
Expand Down

0 comments on commit 226c180

Please sign in to comment.