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 <[email protected]>

PR-URL: #35616
Reviewed-By: Denys Otrishko <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
  • 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
Original file line number Diff line number Diff line change
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.