From 990d51a793f898a39457cb5e14b11eadeda1fb2e Mon Sep 17 00:00:00 2001 From: James Wright Date: Fri, 26 Jan 2024 17:13:36 -0800 Subject: [PATCH] Fix or disable tests that are incompatible with older versions of Node. --- lib/ecmascript.ts | 1 + test/ecmascript.mjs | 9 ++++++--- test/expected-failures.txt | 3 +++ 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lib/ecmascript.ts b/lib/ecmascript.ts index 20b03ecf..396c448c 100644 --- a/lib/ecmascript.ts +++ b/lib/ecmascript.ts @@ -3236,6 +3236,7 @@ export function GetAvailableNamedTimeZoneIdentifier( ['Nsw', 'NSW'], ['Dar_Es_Salaam', 'Dar_es_Salaam'], ['Port_Of_Spain', 'Port_of_Spain'], + ['Port-Au-Prince', 'Port-au-Prince'], ['Isle_Of_Man', 'Isle_of_Man'], ['Comodrivadavia', 'ComodRivadavia'], ['Knox_In', 'Knox_IN'], diff --git a/test/ecmascript.mjs b/test/ecmascript.mjs index f2f78636..91bb4ec9 100644 --- a/test/ecmascript.mjs +++ b/test/ecmascript.mjs @@ -450,7 +450,9 @@ describe('ECMAScript', () => { }); describe('GetAvailableNamedTimeZoneIdentifier', () => { - it('Case-normalizes time zone IDs', () => { + // Some environments don't support Intl.supportedValuesOf. + const itOrSkipIfNoIntlSupportedValuesOf = () => (Intl?.supportedValuesOf ? it : it.skip); + itOrSkipIfNoIntlSupportedValuesOf('Case-normalizes time zone IDs', () => { // eslint-disable-next-line max-len // curl -s https://raw.githubusercontent.com/unicode-org/cldr-json/main/cldr-json/cldr-bcp47/bcp47/timezone.json > cldr-timezone.json const cldrTimeZonePath = new URL('./cldr-timezone.json', import.meta.url); @@ -470,7 +472,8 @@ describe('ECMAScript', () => { const missingFromCLDR = ['CET', 'EET', 'MET', 'WET']; // All IDs that we know about - const ids = [...new Set([...missingFromCLDR, ...cldrIdentifiers, ...Intl.supportedValuesOf('timeZone')])]; + const IntlNativeIdentifiers = Intl.supportedValuesOf('timeZone'); + const ids = [...new Set([...missingFromCLDR, ...cldrIdentifiers, ...IntlNativeIdentifiers])]; for (const id of ids) { const lower = id.toLowerCase(); @@ -480,7 +483,7 @@ describe('ECMAScript', () => { equal(ES.GetAvailableNamedTimeZoneIdentifier(lower)?.identifier, id); } }); - it('Returns canonical IDs', () => { + itOrSkipIfNoIntlSupportedValuesOf('Returns canonical IDs', () => { const ids = Intl.supportedValuesOf('timeZone'); for (const id of ids) { equal(ES.GetAvailableNamedTimeZoneIdentifier(id).primaryIdentifier, id); diff --git a/test/expected-failures.txt b/test/expected-failures.txt index 28fdab2c..1e8e1383 100644 --- a/test/expected-failures.txt +++ b/test/expected-failures.txt @@ -2,3 +2,6 @@ # expected test failures for the transpiled or optimized builds of the polyfill, # see expected-failures-es5.txt and expected-failures-opt.txt respectively. +# Upstream commit 076f2871 introduces a second ToString call on a calendar when +# canonicalizing the timezone name. +staging/Intl402/Temporal/old/date-time-format.js