@midscene/test 1.17.4 → 1.17.5

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.
@@ -1917,6 +1917,10 @@ const latestById = (items, id)=>[
1917
1917
  ];
1918
1918
  const notRunSuite = (prepared, reason)=>prepared.documents.flatMap((document)=>document.cases.map((item)=>asNotRun(document.documentId, item, prepared.project.name, reason)));
1919
1919
  async function runPreparedTestProject(plan) {
1920
+ const reports = new report_namespaceObject.ReportSession((0, external_node_path_namespaceObject.join)(plan.runDir, 'records'));
1921
+ return reports.run(()=>runWithReportSession(plan, reports));
1922
+ }
1923
+ async function runWithReportSession(plan, reports) {
1920
1924
  const { startedAt, runId, projectRoot, configPath, resultDir, runDir, summaryPath, reportDir, definition, projects: preparedProjects } = plan;
1921
1925
  const progress = plan.onProgress;
1922
1926
  const totalDocuments = preparedProjects.reduce((total, prepared)=>total + prepared.documents.length, 0);
@@ -2126,6 +2130,10 @@ async function runPreparedTestProject(plan) {
2126
2130
  } : {},
2127
2131
  result: completedResult
2128
2132
  }));
2133
+ let extraSources = [];
2134
+ await publish('write-report', reports.directory, async ()=>{
2135
+ extraSources = await reports.finish();
2136
+ });
2129
2137
  const writeReport = ()=>publish('write-report', reportDir, async ()=>{
2130
2138
  if (!plan.reportEnabled) return;
2131
2139
  const reportPath = await new report_namespaceObject.TestRunReportAssembler().assembleAsync({
@@ -2133,7 +2141,13 @@ async function runPreparedTestProject(plan) {
2133
2141
  outputFormat: plan.definition.output.reportFormat,
2134
2142
  reportFileName: `midscene-e2e-${runId}`,
2135
2143
  overwrite: false,
2136
- sources: (0, test_runner_namespaceObject.collectTestRunReportSources)(completedResult),
2144
+ sources: [
2145
+ ...(0, test_runner_namespaceObject.collectTestRunReportSources)(completedResult),
2146
+ ...extraSources.map((source)=>({
2147
+ ...source,
2148
+ scopeId: runId
2149
+ }))
2150
+ ],
2137
2151
  buildRunnerDump: (index)=>{
2138
2152
  reportIndex = index;
2139
2153
  const dump = (0, test_runner_namespaceObject.buildTestRunReportDump)(completedResult, index);
@@ -2174,6 +2188,7 @@ async function runPreparedTestProject(plan) {
2174
2188
  markdownPath
2175
2189
  };
2176
2190
  });
2191
+ if (completedResult.reportPath && !hasInfrastructureError) await publish('write-result', reports.directory, ()=>reports.prune());
2177
2192
  await writeSummary();
2178
2193
  if (hasInfrastructureError) throw new test_runner_namespaceObject.WorkflowExecutionFailure(completedResult, infrastructureErrors);
2179
2194
  return completedResult;