"cypress": "^8.7.0",
"cypress-audit": "^1.1.0",
"lighthouse": "^8.6.0"
on('task', {
lighthouse: lighthouse(),
pa11y: pa11y(console.log.bind(console)),
});
const reportT = {
lh: 'lh',
pa11y: 'pa11y',
};
const createReport = ({ report, pageUrl, reportType }) => {
const dateFormat = format(Date.now(), 'dd.MM.yyyy_HH:mm');
const [_, fPath] = pageUrl.split('http://localhost:3000/');
const folderPath = fPath || 'home';
const ext = reportType === reportT.lh ? 'html' : 'json';
const reportName = `${dateFormat}_${reportType}_report.${ext}`;
// Organize reports
fs.mkdir(`cypress/reports/${folderPath}`, { recursive: true }, (err) => {
if (err) throw err;
if (reportType === reportT.lh) {
TLDR
1️⃣ Setup
"cypress": "^8.7.0",
"cypress-audit": "^1.1.0",
"lighthouse": "^8.6.0"
on('task', {
lighthouse: lighthouse(),
pa11y: pa11y(console.log.bind(console)),
});
const reportT = {
lh: 'lh',
pa11y: 'pa11y',
};
const createReport = ({ report, pageUrl, reportType }) => {
const dateFormat = format(Date.now(), 'dd.MM.yyyy_HH:mm');
const [_, fPath] = pageUrl.split('http://localhost:3000/');
const folderPath = fPath || 'home';
const ext = reportType === reportT.lh ? 'html' : 'json';
const reportName = `${dateFormat}_${reportType}_report.${ext}`;
// Organize reports
fs.mkdir(`cypress/reports/${folderPath}`, { recursive: true }, (err) => {
if (err) throw err;
if (reportType === reportT.lh) {