Skip to content

Commit 5afeb3b

Browse files
committed
fix(stepByStepReport): no records html is generated when running with run-workers
1 parent f7dae22 commit 5afeb3b

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

lib/plugin/stepByStepReport.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -141,39 +141,39 @@ module.exports = function (config) {
141141
await recorder.add(() => {
142142
const recordedTests = getRecordFoldersWithDetails(reportDir)
143143
generateRecordsHtml(recordedTests)
144-
});
145-
});
144+
})
145+
})
146146

147147
function getRecordFoldersWithDetails(dirPath) {
148-
let results = {};
148+
let results = {}
149149

150150
try {
151-
const items = fs.readdirSync(dirPath, { withFileTypes: true });
151+
const items = fs.readdirSync(dirPath, { withFileTypes: true })
152152

153-
items.forEach(item => {
153+
items.forEach((item) => {
154154
if (item.isDirectory() && item.name.startsWith('record_')) {
155-
const recordFolderPath = path.join(dirPath, item.name);
156-
const indexPath = path.join(recordFolderPath, 'index.html');
155+
const recordFolderPath = path.join(dirPath, item.name)
156+
const indexPath = path.join(recordFolderPath, 'index.html')
157157

158-
let name = '';
158+
let name = ''
159159
if (fs.existsSync(indexPath)) {
160160
try {
161-
const htmlContent = fs.readFileSync(indexPath, 'utf-8');
162-
const $ = cheerio.load(htmlContent);
163-
name = $('.navbar-brand').text().trim();
161+
const htmlContent = fs.readFileSync(indexPath, 'utf-8')
162+
const $ = cheerio.load(htmlContent)
163+
name = $('.navbar-brand').text().trim()
164164
} catch (err) {
165-
console.error(`Error reading index.html in ${recordFolderPath}:`, err.message);
165+
console.error(`Error reading index.html in ${recordFolderPath}:`, err.message)
166166
}
167167
}
168168

169169
results[name || 'Unkown'] = `${item.name}/index.html`
170170
}
171-
});
171+
})
172172
} catch (err) {
173-
console.error(`Error reading directory ${dirPath}:`, err.message);
173+
console.error(`Error reading directory ${dirPath}:`, err.message)
174174
}
175175

176-
return results;
176+
return results
177177
}
178178

179179
function generateRecordsHtml(recordedTests) {

0 commit comments

Comments
 (0)