@allurereport/plugin-allure2 3.0.0-beta.12 → 3.0.0-beta.14

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/plugin.d.ts CHANGED
@@ -1,9 +1,10 @@
1
- import { type AllureStore, type Plugin, type PluginContext } from "@allurereport/plugin-api";
1
+ import { type AllureStore, type Plugin, type PluginContext, type PluginSummary } from "@allurereport/plugin-api";
2
2
  import type { Allure2PluginOptions } from "./model.js";
3
3
  export declare class Allure2Plugin implements Plugin {
4
4
  #private;
5
5
  readonly options: Allure2PluginOptions;
6
6
  constructor(options?: Allure2PluginOptions);
7
+ info(context: PluginContext, store: AllureStore): Promise<PluginSummary>;
7
8
  update: (context: PluginContext, store: AllureStore) => Promise<void>;
8
9
  done: (context: PluginContext, store: AllureStore) => Promise<void>;
9
10
  }
package/dist/plugin.js CHANGED
@@ -4,7 +4,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
4
4
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
5
  };
6
6
  var _Allure2Plugin_generate;
7
- import { preciseTreeLabels } from "@allurereport/plugin-api";
7
+ import { getWorstStatus } from "@allurereport/core-api";
8
+ import { preciseTreeLabels, } from "@allurereport/plugin-api";
8
9
  import { convertTestResult } from "./converters.js";
9
10
  import { generateAttachmentsData, generateCategoriesData, generateDefaultWidgetData, generateEmptyTrendData, generateEnvironmentJson, generateExecutorJson, generatePackagesData, generateStaticFiles, generateSummaryJson, generateTestResults, generateTimelineData, generateTree, generateTrendData, } from "./generators.js";
10
11
  import { InMemoryReportDataWriter, ReportFileDataWriter } from "./writer.js";
@@ -72,5 +73,19 @@ export class Allure2Plugin {
72
73
  await this.update(context, store);
73
74
  };
74
75
  }
76
+ async info(context, store) {
77
+ const allTrs = await store.allTestResults();
78
+ const duration = allTrs.reduce((acc, { duration: trDuration = 0 }) => acc + trDuration, 0);
79
+ const worstStatus = getWorstStatus(allTrs.map(({ status }) => status));
80
+ const createdAt = allTrs.reduce((acc, { stop }) => Math.max(acc, stop || 0), 0);
81
+ return {
82
+ name: this.options.reportName || context.reportName,
83
+ stats: await store.testsStatistic(),
84
+ status: worstStatus ?? "passed",
85
+ duration,
86
+ createdAt,
87
+ plugin: "Allure2",
88
+ };
89
+ }
75
90
  }
76
91
  _Allure2Plugin_generate = new WeakMap();
package/dist/writer.js CHANGED
@@ -6,6 +6,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
6
6
  var _InMemoryReportDataWriter_data;
7
7
  import { mkdir, writeFile } from "node:fs/promises";
8
8
  import { join, resolve } from "node:path";
9
+ import { join as joinPosix } from "node:path/posix";
9
10
  export class FileSystemReportDataWriter {
10
11
  constructor(output) {
11
12
  this.output = output;
@@ -67,19 +68,19 @@ export class ReportFileDataWriter {
67
68
  this.reportFiles = reportFiles;
68
69
  }
69
70
  async writeData(fileName, data) {
70
- await this.reportFiles.addFile(join("data", fileName), Buffer.from(JSON.stringify(data), "utf-8"));
71
+ await this.reportFiles.addFile(joinPosix("data", fileName), Buffer.from(JSON.stringify(data), "utf-8"));
71
72
  }
72
73
  async writeWidget(fileName, data) {
73
- await this.reportFiles.addFile(join("widgets", fileName), Buffer.from(JSON.stringify(data), "utf-8"));
74
+ await this.reportFiles.addFile(joinPosix("widgets", fileName), Buffer.from(JSON.stringify(data), "utf-8"));
74
75
  }
75
76
  async writeAttachment(source, file) {
76
77
  const contentBuffer = await file.asBuffer();
77
78
  if (!contentBuffer) {
78
79
  return;
79
80
  }
80
- await this.reportFiles.addFile(join("data", "attachments", source), contentBuffer);
81
+ await this.reportFiles.addFile(joinPosix("data", "attachments", source), contentBuffer);
81
82
  }
82
83
  async writeTestCase(test) {
83
- await this.reportFiles.addFile(join("data", "test-cases", `${test.uid}.json`), Buffer.from(JSON.stringify(test), "utf8"));
84
+ await this.reportFiles.addFile(joinPosix("data", "test-cases", `${test.uid}.json`), Buffer.from(JSON.stringify(test), "utf8"));
84
85
  }
85
86
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/plugin-allure2",
3
- "version": "3.0.0-beta.12",
3
+ "version": "3.0.0-beta.14",
4
4
  "description": "The classic version of Allure HTML report",
5
5
  "keywords": [
6
6
  "allure",
@@ -30,10 +30,10 @@
30
30
  "test": "rimraf ./out && vitest run"
31
31
  },
32
32
  "dependencies": {
33
- "@allurereport/core-api": "3.0.0-beta.12",
34
- "@allurereport/plugin-api": "3.0.0-beta.12",
35
- "@allurereport/web-allure2": "3.0.0-beta.12",
36
- "@allurereport/web-commons": "3.0.0-beta.12",
33
+ "@allurereport/core-api": "3.0.0-beta.14",
34
+ "@allurereport/plugin-api": "3.0.0-beta.14",
35
+ "@allurereport/web-allure2": "3.0.0-beta.14",
36
+ "@allurereport/web-commons": "3.0.0-beta.14",
37
37
  "handlebars": "^4.7.8"
38
38
  },
39
39
  "devDependencies": {