diff --git a/lib/plugin/stepByStepReport.js b/lib/plugin/stepByStepReport.js index 852bf329b..73425dc00 100644 --- a/lib/plugin/stepByStepReport.js +++ b/lib/plugin/stepByStepReport.js @@ -141,39 +141,39 @@ module.exports = function (config) { await recorder.add(() => { const recordedTests = getRecordFoldersWithDetails(reportDir) generateRecordsHtml(recordedTests) - }); - }); + }) + }) function getRecordFoldersWithDetails(dirPath) { - let results = {}; + let results = {} try { - const items = fs.readdirSync(dirPath, { withFileTypes: true }); + const items = fs.readdirSync(dirPath, { withFileTypes: true }) - items.forEach(item => { + items.forEach((item) => { if (item.isDirectory() && item.name.startsWith('record_')) { - const recordFolderPath = path.join(dirPath, item.name); - const indexPath = path.join(recordFolderPath, 'index.html'); + const recordFolderPath = path.join(dirPath, item.name) + const indexPath = path.join(recordFolderPath, 'index.html') - let name = ''; + let name = '' if (fs.existsSync(indexPath)) { try { - const htmlContent = fs.readFileSync(indexPath, 'utf-8'); - const $ = cheerio.load(htmlContent); - name = $('.navbar-brand').text().trim(); + const htmlContent = fs.readFileSync(indexPath, 'utf-8') + const $ = cheerio.load(htmlContent) + name = $('.navbar-brand').text().trim() } catch (err) { - console.error(`Error reading index.html in ${recordFolderPath}:`, err.message); + console.error(`Error reading index.html in ${recordFolderPath}:`, err.message) } } results[name || 'Unkown'] = `${item.name}/index.html` } - }); + }) } catch (err) { - console.error(`Error reading directory ${dirPath}:`, err.message); + console.error(`Error reading directory ${dirPath}:`, err.message) } - return results; + return results } function generateRecordsHtml(recordedTests) {