/
githubmirror
/
webpack
Обзор
Документация
Войти
/
githubmirror
/
webpack
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
test/helpers/infrastructureLogErrors.js
37 строк
984 B
Alexander Akait
refactor: strict types for the test suite (#21147)
09 июн 2026, 20:15
Не верифицирован
09 июн 2026, 20:15
9bd0b91
Код
Авторство
О чём код?
"use strict"; /** @typedef {{ run: number, options?: unknown }} Config */ /** * @param {string} log log line * @param {Config} config config * @returns {string | undefined} error message */ const PERSISTENCE_CACHE_INVALIDATE_ERROR = (log, config) => { if (config.run < 2) return; const match = /^\[webpack\.cache\.PackFileCacheStrategy\] Pack got invalid because of write to:(.+)$/.exec( log ); if (match) { return `Pack got invalid because of write to: ${match[1].trim()}`; } }; const errorsFilter = [PERSISTENCE_CACHE_INVALIDATE_ERROR]; /** * @param {string[]} logs logs * @param {Config} config config * @returns {{ message: string }[]} errors */ module.exports = function filterInfraStructureErrors(logs, config) { /** @type {{ message: string }[]} */ const results = []; for (const log of logs) { for (const filter of errorsFilter) { const result = filter(log, config); if (result) results.push({ message: result }); } } return results; };