Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests(i18n): update canonical locale test for node 12 #9396

Merged
merged 1 commit into from
Jul 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ branches:
matrix:
include:
- node_js: "10"
- node_js: "11"
- node_js: "12"
if: head_branch IS blank AND branch = master
dist: trusty
cache:
Expand Down
3 changes: 2 additions & 1 deletion lighthouse-core/test/lib/i18n/locales-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ describe('locales', () => {
const deprecatedCodes = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on locales.js.. it looks like there's also these ones:

'bs': 'hr',
'ln': 'fr',
'nb': 'no',
'tl': 'fil',

this list is spelled out concretely somewhere in the CLDR, too

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on locales.js.. it looks like there's also these ones:

the ICU in Chrome Canary (V8 7.7) and Node 12.6 (V8 7.5) stil have these as canonical locales. The intent of the test was just to double check that if someone asks for one of the locales we have strings for that they'll actually get it, and deprecatedCodes was to handle the awkward time when a locale is deprecated on the bleeding edge but not in our earliest supported Chrome/Node.

Since they aren't deprecated in the latest version of V8/Intl yet, and since the switch to deprecated is a nice trigger to double check our locales here, I think we should leave these out for now

in: 'id',
iw: 'he',
mo: 'ro',
};

for (const locale of Object.keys(locales)) {
const canonicalLocale = Intl.getCanonicalLocales(locale)[0];
const substitute = deprecatedCodes[locale];
assert.ok(locale === canonicalLocale || substitute === canonicalLocale,
`locale code '${locale}' not canonical`);
`locale code '${locale}' not canonical ('${canonicalLocale}' found instead)`);
}

// Deprecation subsitutes should be removed from the test if no longer used.
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4280,6 +4280,11 @@ is-windows@^1.0.2:
resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d"
integrity sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==

is-wsl@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-1.1.0.tgz#1f16e4aa22b04d1336b66188a66af3c600c3a66d"
integrity sha1-HxbkqiKwTRM2tmGIpmrzxgDDpm0=

is-wsl@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-2.1.0.tgz#94369bbeb2249ef07b831b1b08590e686330ccbb"
Expand Down