Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"node": "^20.17.0 || >=22.9.0"
},
"devDependencies": {
"@flakiness/flakiness-report": "^0.28.0",
"@flakiness/flakiness-report": "^0.31.0",
"@flakiness/playwright": "^1.3.3",
"@playwright/test": "^1.58.2",
"@types/debug": "^4.1.12",
Expand Down
13 changes: 11 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/normalizeReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function normalizeReport(report: FlakinessReport.Report): FlakinessReport
return {
...step,
duration: step.duration === 0 ? undefined : step.duration,
attachments: step.attachments && step.attachments.length ? step.attachments : undefined,
steps: step.steps && step.steps.length ? step.steps.map(cleanupTestStep) : undefined,
}
}
Expand Down
36 changes: 23 additions & 13 deletions src/readReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,31 @@ export async function readReport(reportFolder: string): Promise<{
const filenameToPath = new Map(attachmentFiles.map(file => [path.basename(file), file]));
const attachmentIdToPath = new Map<FlakinessReport.AttachmentId, FileAttachment>();
const missingAttachments = new Map<FlakinessReport.AttachmentId, FlakinessReport.Attachment>();
const visitAttachment = (attachment: FlakinessReport.Attachment) => {
const attachmentPath = filenameToPath.get(attachment.id);
if (!attachmentPath) {
missingAttachments.set(attachment.id, attachment);
} else {
attachmentIdToPath.set(attachment.id, {
contentType: attachment.contentType,
id: attachment.id,
path: attachmentPath,
type: 'file',
});
}
};
const visitStep = (step: FlakinessReport.TestStep) => {
for (const attachment of step.attachments ?? [])
visitAttachment(attachment);
for (const childStep of step.steps ?? [])
visitStep(childStep);
};
visitTests(report, (test) => {
for (const attempt of test.attempts) {
for (const attachment of attempt.attachments ?? []) {
const attachmentPath = filenameToPath.get(attachment.id);
if (!attachmentPath) {
missingAttachments.set(attachment.id, attachment);
} else {
attachmentIdToPath.set(attachment.id, {
contentType: attachment.contentType,
id: attachment.id,
path: attachmentPath,
type: 'file',
});
}
}
for (const attachment of attempt.attachments ?? [])
visitAttachment(attachment);
for (const step of attempt.steps ?? [])
visitStep(step);
}
});
return {
Expand Down