Make TODOCS placeholder case-insensitive (#33205)

This commit is contained in:
Sarah Schneider 2022-12-05 15:53:22 -05:00 коммит произвёл GitHub
Родитель 62fe074080
Коммит 9613805a95
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -42,7 +42,7 @@ const languageCodes = Object.keys(languages)
// This is a string that contributors can use in markdown and yaml files as a placeholder.
// If any placeholders slip through, this test will flag them.
const placeholder = 'TODOCS'
const placeholderRegex = new RegExp(`\\b${placeholder}\\b`, 'g')
const placeholderRegex = new RegExp(`\\b${placeholder}\\b`, 'gi')
// WARNING: Complicated RegExp below!
//
@ -480,8 +480,11 @@ describe('lint markdown content', () => {
test('placeholder string is not present in any markdown files', async () => {
const matches = rawContent.match(placeholderRegex) || []
const placeholderStr = matches.length === 1 ? 'placeholder' : 'placeholders'
const errorMessage = `
Found ${matches.length} placeholder string '${placeholder}' in this file! Please update all placeholders.
Found ${matches.length} ${placeholderStr} '${matches.join(
', '
)}' in this file! Please update all placeholders.
`
expect(matches.length, errorMessage).toBe(0)
})