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>
  • Loading branch information
jasnell committed Oct 12, 2020
1 parent bb62f4a commit 2fa6e3a
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/common/index.js
Expand Up @@ -253,7 +253,6 @@ function platformTimeout(ms) {
}

let knownGlobals = [
AbortController,
clearImmediate,
clearInterval,
clearTimeout,
Expand All @@ -264,6 +263,9 @@ let knownGlobals = [
queueMicrotask,
];

if (global.AbortController)
knownGlobals.push(global.AbortController);

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

0 comments on commit 2fa6e3a

Please sign in to comment.