Skip to content

Commit

Permalink
add compat tests for splitted timer modules
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jul 15, 2022
1 parent d2d1ef7 commit bba906e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions tests/compat/tests.js
Expand Up @@ -223,6 +223,10 @@ function IMMEDIATE() {
return setImmediate && clearImmediate;
}

function TIMERS() {
return !/MSIE .\./.test(USERAGENT);
}

GLOBAL.tests = {
// TODO: Remove this module from `core-js@4` since it's split to modules listed below
'es.symbol': [SYMBOLS_SUPPORT, function () {
Expand Down Expand Up @@ -1851,16 +1855,17 @@ GLOBAL.tests = {
return Object.getOwnPropertyDescriptor(GLOBAL, 'queueMicrotask').value;
},
'web.set-immediate': IMMEDIATE,
'web.set-interval': TIMERS,
'web.set-timeout': TIMERS,
'web.structured-clone': function () {
var error = new Error();
var test = structuredClone({ a: error, b: error });
if (!(test && test.a === test.b && test.a instanceof Error && test.stack === error.stack)) return false;
test = structuredClone(new AggregateError([1], 'a', { cause: 3 }));
return test.name == 'AggregateError' && test.errors[0] == 1 && test.message == 'a' && test.cause == 3;
},
'web.timers': function () {
return !/MSIE .\./.test(USERAGENT);
},
// TODO: Remove this module from `core-js@4` since it's split to submodules
'web.timers': TIMERS,
'web.url.constructor': URL_AND_URL_SEARCH_PARAMS_SUPPORT,
'web.url.to-json': [URL_AND_URL_SEARCH_PARAMS_SUPPORT, function () {
return URL.prototype.toJSON;
Expand Down

0 comments on commit bba906e

Please sign in to comment.