1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Ignore unit tests when verifying localized messages (#10449)

The `verify-locale-strings` script now ignores unit tests. This ensures
the use of a string literal in a unit test won't mistakenly make this
script believe that a message is used in the extension.

This came up recently in #10396, where the deletion of unit tests for
dead code triggered an unused message lint failure. This was then fixed
in #10395.
This commit is contained in:
Mark Stacey 2021-02-15 11:57:28 -03:30 committed by GitHub
parent 8a76dcc18a
commit b885cd1b40
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,10 +173,13 @@ async function verifyEnglishLocale() {
const globsToStrictSearch = [
'ui/app/components/app/metamask-translation/*.js',
];
const testGlob = '**/*.test.js';
const javascriptFiles = await glob(['ui/**/*.js', 'shared/**/*.js'], {
ignore: globsToStrictSearch,
ignore: [...globsToStrictSearch, testGlob],
});
const javascriptFilesToStrictSearch = await glob(globsToStrictSearch, {
ignore: [testGlob],
});
const javascriptFilesToStrictSearch = await glob(globsToStrictSearch);
const strictSearchRegex = /\bt\(\s*'(\w+)'\s*\)|\btranslationKey:\s*'(\w+)'/gu;
// match "t(`...`)" because constructing message keys from template strings