Skip to content

[NO QA] fix: Markdown for meaningless changes is invalid in E2E Performance pipeline #59533

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

Merged
Merged
Changes from 1 commit
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
14 changes: 8 additions & 6 deletions tests/e2e/compare/output/markdown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,13 @@ const buildDetailsTable = (entries: Entry[], numberOfTables = 1) => {
return [''];
}

const entriesPerTable = Math.floor(entries.length / numberOfTables);
const safeNumberOfTables = numberOfTables === 0 ? 1 : numberOfTables;

const entriesPerTable = Math.floor(entries.length / safeNumberOfTables);
const tables: string[] = [];
for (let i = 0; i < numberOfTables; i++) {
for (let i = 0; i < safeNumberOfTables; i++) {
const start = i * entriesPerTable;
const end = i === numberOfTables - 1 ? entries.length : start + entriesPerTable;
const end = i === safeNumberOfTables - 1 ? entries.length : start + entriesPerTable;
const tableEntries = entries.slice(start, end);

const rows = tableEntries.map((entry) => [entry.name, buildDurationDetailsEntry(entry)]);
Expand Down Expand Up @@ -119,14 +121,14 @@ const buildMarkdown = (data: Data, skippedTests: string[], numberOfExtraFiles?:
}

if (skippedTests.length > 0) {
mainFile += `⚠️ Some tests did not pass successfully, so some results are omitted from final report: ${skippedTests.join(', ')}`;
mainFile += `\n\n⚠️ Some tests did not pass successfully, so some results are omitted from final report: ${skippedTests.join(', ')}`;
}

mainFile += '\n\n### Significant Changes To Duration';
mainFile += `\n${buildSummaryTable(data.significance)}`;
mainFile += `\n${buildDetailsTable(data.significance, 1).at(0)}`;

const meaninglessDetailsTables = buildDetailsTable(data.meaningless, nExtraFiles);
const meaninglessDetailsTables = buildDetailsTable(data.meaningless, nExtraFiles === 0 ? 1 : nExtraFiles);

if (nExtraFiles === 0) {
mainFile += '\n\n### Meaningless Changes To Duration';
Expand All @@ -142,7 +144,7 @@ const buildMarkdown = (data: Data, skippedTests: string[], numberOfExtraFiles?:
extraFile += nExtraFiles > 0 ? ` (${i + 2}/${nExtraFiles + 1})` : '';

extraFile += '\n\n### Meaningless Changes To Duration';
extraFile += nExtraFiles > 0 ? ` (${i + 1}/${nExtraFiles + 1})` : '';
extraFile += nExtraFiles > 1 ? ` (${i + 1}/${nExtraFiles})` : '';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't nExtraFiles here always greater than 0 since on line 133 we check if it is 0 then return?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why i fixed this to check for whether nExtraFiles is greater than 1 (2 or higher). Only then, we want to append the (1/2) index

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you might have marked the wrong line? I fixed it 3 lines above. Also i changed this to be nExtraFiles >= 2, so it's easier to read

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I marked all lines from 144 to 147, but yeah, I meant the 144 only, thanks!


extraFile += `\n${buildSummaryTable(data.meaningless, true)}`;
extraFile += `\n${meaninglessDetailsTables.at(i)}`;
Expand Down
Loading