From 4cc298a133fead34d62f21c8fd75c02cf40b6341 Mon Sep 17 00:00:00 2001 From: Denis Pushkarev Date: Wed, 21 Dec 2022 01:07:43 +0700 Subject: [PATCH] fix a couple of tests --- packages/core-js/internals/schedulers-fix.js | 2 +- tests/compat/tests.js | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/core-js/internals/schedulers-fix.js b/packages/core-js/internals/schedulers-fix.js index 0445431e5864..2d38413e9499 100644 --- a/packages/core-js/internals/schedulers-fix.js +++ b/packages/core-js/internals/schedulers-fix.js @@ -12,7 +12,7 @@ var Function = global.Function; var WRAP = /MSIE .\./.test(USER_AGENT) || ENGINE_IS_BUN && (function () { var version = global.Bun.version.split('.'); return version.length < 3 || version[0] == 0 && (version[1] < 3 || version[1] == 3 && version[2] == 0); -}); +})(); // IE9- / Bun 0.3.0- setTimeout / setInterval / setImmediate additional parameters fix // https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#timers diff --git a/tests/compat/tests.js b/tests/compat/tests.js index a46d1581bdd0..15b5d9406426 100644 --- a/tests/compat/tests.js +++ b/tests/compat/tests.js @@ -223,11 +223,17 @@ function createStringTrimMethodTest(METHOD_NAME) { } function IMMEDIATE() { - return setImmediate && clearImmediate && !IS_BUN; + return setImmediate && clearImmediate && !(IS_BUN && (function () { + var version = global.Bun.version.split('.'); + return version.length < 3 || version[0] == 0 && (version[1] < 3 || version[1] == 3 && version[2] == 0); + })()); } function TIMERS() { - return !IS_BUN && !/MSIE .\./.test(USERAGENT); + return !(/MSIE .\./.test(USERAGENT) || IS_BUN && (function () { + var version = global.Bun.version.split('.'); + return version.length < 3 || version[0] == 0 && (version[1] < 3 || version[1] == 3 && version[2] == 0); + })()); } GLOBAL.tests = {