Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(#13): Correction du rapport HTML quand aucun nom n'est spécifié pour chaque URL #15

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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