@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.
@@ -10,7 +10,7 @@ import { JSON_SCHEMA, load } from "js-yaml";
10
10
  import { createHash, randomUUID } from "node:crypto";
11
11
  import { mkdir, writeFile } from "node:fs/promises";
12
12
  import { setMaxListeners } from "node:events";
13
- import { TestRunReportAssembler } from "@midscene/core/report";
13
+ import { TestRunReportAssembler, calculateTestRunHealth } from "@midscene/core/report";
14
14
  import { getDebug } from "@midscene/shared/logger";
15
15
  var __webpack_modules__ = {
16
16
  "node:fs" (module) {
@@ -21,7 +21,7 @@ var __webpack_modules__ = {
21
21
  },
22
22
  "./package.json" (module) {
23
23
  module.exports = {
24
- rE: "1.13.2"
24
+ rE: "1.13.3"
25
25
  };
26
26
  }
27
27
  };
@@ -1221,13 +1221,32 @@ const asNotRun = (documentId, collectedCase, projectName, reason)=>({
1221
1221
  notRunReason: reason
1222
1222
  });
1223
1223
  const summarize = (projects)=>{
1224
- const cases = projects.flatMap((project)=>latestById(project.cases, (item)=>item.caseId));
1224
+ const healthCases = projects.flatMap((project)=>{
1225
+ const documentAttemptByRunId = new Map(project.documents.map((document)=>[
1226
+ document.documentRunId,
1227
+ document.attemptIndex ?? 0
1228
+ ]));
1229
+ return latestById(project.cases, (item)=>item.caseId).map((item)=>({
1230
+ status: item.status,
1231
+ ...item.run ? {
1232
+ run: item.run
1233
+ } : {},
1234
+ ...item.attempts ? {
1235
+ attempts: item.attempts
1236
+ } : {},
1237
+ retryCount: item.documentRunId ? documentAttemptByRunId.get(item.documentRunId) ?? 0 : 0
1238
+ }));
1239
+ });
1225
1240
  const documents = projects.flatMap((project)=>latestById(project.documents, (item)=>item.documentId));
1241
+ const health = calculateTestRunHealth(healthCases);
1226
1242
  return {
1227
- total: cases.length,
1228
- passed: cases.filter((item)=>'success' === item.status).length,
1229
- failed: cases.filter((item)=>'failed' === item.status).length,
1230
- notRun: cases.filter((item)=>'not-run' === item.status).length,
1243
+ total: health.total,
1244
+ passed: health.passed,
1245
+ failed: health.failed,
1246
+ notRun: health.notRun,
1247
+ passedAfterRetry: health.passedAfterRetry,
1248
+ finalPassRate: health.finalPassRate,
1249
+ firstPassRate: health.firstPassRate,
1231
1250
  filtered: projects.reduce((total, project)=>total + project.filteredCaseCount, 0),
1232
1251
  collectionErrors: projects.reduce((total, project)=>total + project.collectionErrors.length, 0),
1233
1252
  documentFailures: documents.filter((document)=>'failed' === document.status).length,