@midscene/test 1.13.2 → 1.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1046,13 +1046,32 @@ const asNotRun = (documentId, collectedCase, projectName, reason)=>({
1046
1046
  notRunReason: reason
1047
1047
  });
1048
1048
  const summarize = (projects)=>{
1049
- const cases = projects.flatMap((project)=>latestById(project.cases, (item)=>item.caseId));
1049
+ const healthCases = projects.flatMap((project)=>{
1050
+ const documentAttemptByRunId = new Map(project.documents.map((document)=>[
1051
+ document.documentRunId,
1052
+ document.attemptIndex ?? 0
1053
+ ]));
1054
+ return latestById(project.cases, (item)=>item.caseId).map((item)=>({
1055
+ status: item.status,
1056
+ ...item.run ? {
1057
+ run: item.run
1058
+ } : {},
1059
+ ...item.attempts ? {
1060
+ attempts: item.attempts
1061
+ } : {},
1062
+ retryCount: item.documentRunId ? documentAttemptByRunId.get(item.documentRunId) ?? 0 : 0
1063
+ }));
1064
+ });
1050
1065
  const documents = projects.flatMap((project)=>latestById(project.documents, (item)=>item.documentId));
1066
+ const health = (0, report_namespaceObject.calculateTestRunHealth)(healthCases);
1051
1067
  return {
1052
- total: cases.length,
1053
- passed: cases.filter((item)=>'success' === item.status).length,
1054
- failed: cases.filter((item)=>'failed' === item.status).length,
1055
- notRun: cases.filter((item)=>'not-run' === item.status).length,
1068
+ total: health.total,
1069
+ passed: health.passed,
1070
+ failed: health.failed,
1071
+ notRun: health.notRun,
1072
+ passedAfterRetry: health.passedAfterRetry,
1073
+ finalPassRate: health.finalPassRate,
1074
+ firstPassRate: health.firstPassRate,
1056
1075
  filtered: projects.reduce((total, project)=>total + project.filteredCaseCount, 0),
1057
1076
  collectionErrors: projects.reduce((total, project)=>total + project.collectionErrors.length, 0),
1058
1077
  documentFailures: documents.filter((document)=>'failed' === document.status).length,