test: fix intl tests on small-icu builds

PR-URL: https://github.com/nodejs/node/pull/41939
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Antoine du Hamel 2022-02-14 18:28:34 +01:00 committed by GitHub
parent aff8b874e3
commit f282e4a94d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -104,6 +104,12 @@ if (!common.hasIntl) {
const numberFormat = new Intl.NumberFormat(['en']).format(12345.67890);
assert.strictEqual(numberFormat, '12,345.679');
}
// If list is specified and doesn't contain 'en-US' then return.
if (process.config.variables.icu_locales && !haveLocale('en-US')) {
common.printSkipMessage('detailed Intl tests because American English is ' +
'not listed as supported.');
return;
}
// Number format resolved options
{
const numberFormat = new Intl.NumberFormat('en-US', { style: 'percent' });