/
githubmirror
/
joomla-cms
Обзор
Документация
Войти
/
githubmirror
/
joomla-cms
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
5.4-dev
tests/System/plugins/logs.mjs
42 строки
759 B
Allon Moritz
[5.3] Does check the server error logs in system tests (#45409)
30 апр 2025, 09:27
Не верифицирован
30 апр 2025, 09:27
74e625d
Код
Авторство
О чём код?
import { existsSync, readFileSync, writeFileSync } from 'node:fs'; /** * Checks if there are entries written to the logs file. * * @param {object} config - The Cypress configuration object * * @returns null */ function checkForLogs(config) { const { logFile } = config.env; if (!existsSync(logFile)) { return null; } const log = readFileSync(logFile, 'utf8'); if (!log) { return null; } throw new Error(log); } /** * Clears the log file. * * @param {object} config - The Cypress configuration object * * @returns null */ function clearLogs(config) { const { logFile } = config.env; if (!existsSync(logFile)) { return null; } writeFileSync(logFile, ''); return null; } export { checkForLogs, clearLogs };