@midscene/test 1.13.1-beta-20260921080849.0 → 1.13.1
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.
- package/dist/es/cli/index.mjs +13 -27
- package/dist/es/cli/index.mjs.map +1 -1
- package/dist/es/test-cli.mjs +16 -28
- package/dist/es/test-cli.mjs.map +1 -1
- package/dist/lib/cli/index.js +12 -26
- package/dist/lib/cli/index.js.map +1 -1
- package/dist/lib/test-cli.js +15 -27
- package/dist/lib/test-cli.js.map +1 -1
- package/dist/types/cli/index.d.ts +1 -4
- package/package.json +13 -13
package/dist/es/cli/index.mjs
CHANGED
|
@@ -9,7 +9,7 @@ import { JSON_SCHEMA, load } from "js-yaml";
|
|
|
9
9
|
import { createHash, randomUUID } from "node:crypto";
|
|
10
10
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
11
11
|
import { setMaxListeners } from "node:events";
|
|
12
|
-
import { TestRunReportAssembler
|
|
12
|
+
import { TestRunReportAssembler } from "@midscene/core/report";
|
|
13
13
|
import { getDebug } from "@midscene/shared/logger";
|
|
14
14
|
const registry_NodeRegistry = NodeRegistry;
|
|
15
15
|
const projectIdFromIndex = (index)=>`project-${index}`;
|
|
@@ -724,6 +724,7 @@ const selectProjects = (projects, names)=>{
|
|
|
724
724
|
return projects.filter((project)=>requested.has(project.name));
|
|
725
725
|
};
|
|
726
726
|
async function prepareProject(project, projectRoot, runDir, defaultTimeoutMs, options = {}) {
|
|
727
|
+
const platform = options.platform?.trim();
|
|
727
728
|
const fileSelection = project.files ?? DEFAULT_TEST_FILE_SELECTION;
|
|
728
729
|
const prerequisiteFile = options.prerequisiteFile ? resolve(options.prerequisiteFile) : void 0;
|
|
729
730
|
const mainFiles = options.files ?? discoverResolvedTestFiles(projectRoot, fileSelection);
|
|
@@ -795,7 +796,9 @@ async function prepareProject(project, projectRoot, runDir, defaultTimeoutMs, op
|
|
|
795
796
|
const prerequisiteDocument = documents.find((document)=>document.sourcePath === prerequisiteSource?.sourcePath);
|
|
796
797
|
return {
|
|
797
798
|
project,
|
|
798
|
-
platform
|
|
799
|
+
...platform ? {
|
|
800
|
+
platform
|
|
801
|
+
} : {},
|
|
799
802
|
documentConcurrency: options.documentConcurrency ?? 1,
|
|
800
803
|
...prerequisiteDocument ? {
|
|
801
804
|
prerequisiteDocumentId: prerequisiteDocument.documentId
|
|
@@ -1007,32 +1010,13 @@ const asNotRun = (documentId, collectedCase, projectName, reason)=>({
|
|
|
1007
1010
|
notRunReason: reason
|
|
1008
1011
|
});
|
|
1009
1012
|
const summarize = (projects)=>{
|
|
1010
|
-
const
|
|
1011
|
-
const documentAttemptByRunId = new Map(project.documents.map((document)=>[
|
|
1012
|
-
document.documentRunId,
|
|
1013
|
-
document.attemptIndex ?? 0
|
|
1014
|
-
]));
|
|
1015
|
-
return latestById(project.cases, (item)=>item.caseId).map((item)=>({
|
|
1016
|
-
status: item.status,
|
|
1017
|
-
...item.run ? {
|
|
1018
|
-
run: item.run
|
|
1019
|
-
} : {},
|
|
1020
|
-
...item.attempts ? {
|
|
1021
|
-
attempts: item.attempts
|
|
1022
|
-
} : {},
|
|
1023
|
-
retryCount: item.documentRunId ? documentAttemptByRunId.get(item.documentRunId) ?? 0 : 0
|
|
1024
|
-
}));
|
|
1025
|
-
});
|
|
1013
|
+
const cases = projects.flatMap((project)=>latestById(project.cases, (item)=>item.caseId));
|
|
1026
1014
|
const documents = projects.flatMap((project)=>latestById(project.documents, (item)=>item.documentId));
|
|
1027
|
-
const health = calculateTestRunHealth(healthCases);
|
|
1028
1015
|
return {
|
|
1029
|
-
total:
|
|
1030
|
-
passed:
|
|
1031
|
-
failed:
|
|
1032
|
-
notRun:
|
|
1033
|
-
passedAfterRetry: health.passedAfterRetry,
|
|
1034
|
-
finalPassRate: health.finalPassRate,
|
|
1035
|
-
firstPassRate: health.firstPassRate,
|
|
1016
|
+
total: cases.length,
|
|
1017
|
+
passed: cases.filter((item)=>'success' === item.status).length,
|
|
1018
|
+
failed: cases.filter((item)=>'failed' === item.status).length,
|
|
1019
|
+
notRun: cases.filter((item)=>'not-run' === item.status).length,
|
|
1036
1020
|
filtered: projects.reduce((total, project)=>total + project.filteredCaseCount, 0),
|
|
1037
1021
|
collectionErrors: projects.reduce((total, project)=>total + project.collectionErrors.length, 0),
|
|
1038
1022
|
documentFailures: documents.filter((document)=>'failed' === document.status).length,
|
|
@@ -1093,7 +1077,9 @@ async function runPreparedTestProject(plan) {
|
|
|
1093
1077
|
return {
|
|
1094
1078
|
projectId: project.projectId,
|
|
1095
1079
|
name: project.name,
|
|
1096
|
-
|
|
1080
|
+
...prepared.platform ? {
|
|
1081
|
+
platform: prepared.platform
|
|
1082
|
+
} : {},
|
|
1097
1083
|
status: projectFailed ? 'failed' : 'success',
|
|
1098
1084
|
retry: project.retry,
|
|
1099
1085
|
fileSelection: prepared.fileSelection,
|