Skip to content

Commit

Permalink
Merge pull request #15 from jpreisner/fix/rapport-html-url-sans-nom
Browse files Browse the repository at this point in the history
fix(#13): Correction du rapport HTML quand aucun nom n'est spécifié pour chaque URL
  • Loading branch information
jules-delecour-dav authored Dec 13, 2021
2 parents ef59a4b + 8f65761 commit 2f7dc76
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions cli-core/analysis.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ async function analyseURL(browser, pageInformations, options) {
result.pageInformations = pageInformations;
result.tryNb = TRY_NB;
result.tabId = TAB_ID;
result.index = options.index;
return result;
}

Expand Down Expand Up @@ -258,7 +259,8 @@ async function createJsonReports(browser, pagesInformations, options, proxy, hea
timeout:TIMEOUT,
tabId: i,
proxy: proxy,
headers: headers
headers: headers,
index: index
}));
index++;
//console.log(`Start of analysis #${index}/${pagesInformations.length}`)
Expand All @@ -273,7 +275,8 @@ async function createJsonReports(browser, pagesInformations, options, proxy, hea
tabId: results.tabId,
tryNb: results.tryNb + 1,
proxy: proxy,
headers: headers
headers: headers,
index: results.index
})); // convert is NEEDED, variable size array
}else{
let filePath = path.resolve(SUBRESULTS_DIRECTORY,`${resultId}.json`)
Expand All @@ -297,7 +300,8 @@ async function createJsonReports(browser, pagesInformations, options, proxy, hea
timeout:TIMEOUT,
tabId: results.tabId,
proxy: proxy,
headers: headers
headers: headers,
index
})); // No need for convert, fixed size array
index++;
//console.log(`Start of analysis #${index}/${pagesInformations.length}`)
Expand Down
2 changes: 1 addition & 1 deletion cli-core/reportHtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function readAllReports(fileList) {
fileList.forEach((file)=>{
let report_data = JSON.parse(fs.readFileSync(file.path).toString());
const pageName = report_data.pageInformations.name || report_data.pageInformations.url;
const pageFilename = report_data.pageInformations.name ? `${removeForbiddenCharacters(report_data.pageInformations.name)}.html` : `${report_data.tabId}.html`;
const pageFilename = report_data.pageInformations.name ? `${removeForbiddenCharacters(report_data.pageInformations.name)}.html` : `${report_data.index}.html`;

if (report_data.success) {
let bestPractices = extractBestPractices(report_data.bestPractices);
Expand Down

0 comments on commit 2f7dc76

Please sign in to comment.