@allurereport/core 3.0.0-beta.16 → 3.0.0-beta.17

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/config.d.ts CHANGED
@@ -17,25 +17,4 @@ export declare const loadConfig: (configPath: string) => Promise<Config>;
17
17
  export declare const resolveConfig: (config: Config, override?: ConfigOverride) => Promise<FullConfig>;
18
18
  export declare const readConfig: (cwd?: string, configPath?: string, override?: ConfigOverride) => Promise<FullConfig>;
19
19
  export declare const getPluginInstance: (config: FullConfig, predicate: (plugin: PluginInstance) => boolean) => PluginInstance | undefined;
20
- export declare const enforcePlugin: (config: FullConfig, pluginInstance: PluginInstance) => {
21
- name: string;
22
- output: string;
23
- historyPath: string;
24
- knownIssuesPath: string;
25
- qualityGate?: import("@allurereport/plugin-api").QualityGateConfig;
26
- defaultLabels?: import("@allurereport/core-api").DefaultLabelsConfig;
27
- environments?: import("@allurereport/core-api").EnvironmentsConfig;
28
- variables?: import("@allurereport/core-api").ReportVariables;
29
- reportFiles: import("@allurereport/plugin-api").ReportFiles;
30
- readers?: import("@allurereport/reader-api").ResultsReader[];
31
- plugins?: PluginInstance[];
32
- appendHistory?: boolean;
33
- known?: import("@allurereport/core-api").KnownTestFailure[];
34
- realTime?: any;
35
- allureService?: {
36
- url?: string;
37
- project?: string;
38
- accessToken?: string;
39
- };
40
- };
41
20
  export declare const resolvePlugin: (path: string) => Promise<any>;
package/dist/config.js CHANGED
@@ -104,17 +104,6 @@ export const readConfig = async (cwd = process.cwd(), configPath, override) => {
104
104
  export const getPluginInstance = (config, predicate) => {
105
105
  return config?.plugins?.find(predicate);
106
106
  };
107
- export const enforcePlugin = (config, pluginInstance) => {
108
- const newConfig = { ...config };
109
- const instance = getPluginInstance(newConfig, (item) => item.plugin.constructor === pluginInstance.plugin.constructor);
110
- if (!instance) {
111
- newConfig.plugins = [pluginInstance];
112
- }
113
- else {
114
- newConfig.plugins = [instance];
115
- }
116
- return newConfig;
117
- };
118
107
  export const resolvePlugin = async (path) => {
119
108
  if (!path.startsWith("@allurereport/plugin-")) {
120
109
  try {
package/dist/index.d.ts CHANGED
@@ -8,7 +8,7 @@ export * from "./utils/new.js";
8
8
  export * from "./utils/flaky.js";
9
9
  export * from "./history.js";
10
10
  export * from "./known.js";
11
- export { resolveConfig, readConfig, getPluginInstance, enforcePlugin } from "./config.js";
11
+ export { resolveConfig, readConfig, getPluginInstance } from "./config.js";
12
12
  export * from "./report.js";
13
13
  export * from "./plugin.js";
14
14
  export * from "./qualityGate.js";
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ export * from "./utils/new.js";
7
7
  export * from "./utils/flaky.js";
8
8
  export * from "./history.js";
9
9
  export * from "./known.js";
10
- export { resolveConfig, readConfig, getPluginInstance, enforcePlugin } from "./config.js";
10
+ export { resolveConfig, readConfig, getPluginInstance } from "./config.js";
11
11
  export * from "./report.js";
12
12
  export * from "./plugin.js";
13
13
  export * from "./qualityGate.js";
package/dist/report.js CHANGED
@@ -9,7 +9,8 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
9
9
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
- var _AllureReport_instances, _AllureReport_reportName, _AllureReport_store, _AllureReport_readers, _AllureReport_plugins, _AllureReport_reportFiles, _AllureReport_eventEmitter, _AllureReport_events, _AllureReport_qualityGate, _AllureReport_realTime, _AllureReport_output, _AllureReport_history, _AllureReport_allureServiceClient, _AllureReport_state, _AllureReport_stage, _AllureReport_publish_get, _AllureReport_update, _AllureReport_eachPlugin, _AllureReport_getPluginState;
12
+ var _AllureReport_instances, _AllureReport_reportName, _AllureReport_ci, _AllureReport_store, _AllureReport_readers, _AllureReport_plugins, _AllureReport_reportFiles, _AllureReport_eventEmitter, _AllureReport_events, _AllureReport_qualityGate, _AllureReport_realTime, _AllureReport_output, _AllureReport_history, _AllureReport_allureServiceClient, _AllureReport_state, _AllureReport_stage, _AllureReport_publish_get, _AllureReport_update, _AllureReport_eachPlugin, _AllureReport_getPluginState;
13
+ import { detect } from "@allurereport/ci";
13
14
  import { allure1, allure2, attachments, cucumberjson, junitXml, readXcResultBundle } from "@allurereport/reader";
14
15
  import { PathResultFile } from "@allurereport/reader-api";
15
16
  import { AllureRemoteHistory, AllureServiceClient, KnownError, UnknownError } from "@allurereport/service";
@@ -31,6 +32,7 @@ export class AllureReport {
31
32
  constructor(opts) {
32
33
  _AllureReport_instances.add(this);
33
34
  _AllureReport_reportName.set(this, void 0);
35
+ _AllureReport_ci.set(this, void 0);
34
36
  _AllureReport_store.set(this, void 0);
35
37
  _AllureReport_readers.set(this, void 0);
36
38
  _AllureReport_plugins.set(this, void 0);
@@ -133,7 +135,7 @@ export class AllureReport {
133
135
  const pluginFiles = (await context.state.get("files")) ?? {};
134
136
  for (const [filename, filepath] of Object.entries(pluginFiles)) {
135
137
  if (/^(data|widgets|index\.html$)/.test(filename)) {
136
- __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").addReportFile({
138
+ await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").addReportFile({
137
139
  reportUuid: this.reportUuid,
138
140
  pluginId: context.id,
139
141
  filename,
@@ -141,7 +143,7 @@ export class AllureReport {
141
143
  });
142
144
  }
143
145
  else {
144
- __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").addReportAsset({
146
+ await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f").addReportAsset({
145
147
  filename,
146
148
  filepath,
147
149
  });
@@ -152,6 +154,8 @@ export class AllureReport {
152
154
  if (!summary) {
153
155
  return;
154
156
  }
157
+ summary.pullRequestHref = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestUrl;
158
+ summary.jobHref = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobUrl;
155
159
  if (context.publish) {
156
160
  summary.remoteHref = `${this.reportUrl}/${context.id}/`;
157
161
  remoteHrefs.push(summary.remoteHref);
@@ -160,7 +164,7 @@ export class AllureReport {
160
164
  ...summary,
161
165
  href: `${context.id}/`,
162
166
  });
163
- context.reportFiles.addFile("summary.json", Buffer.from(JSON.stringify(summary)));
167
+ await context.reportFiles.addFile("summary.json", Buffer.from(JSON.stringify(summary)));
164
168
  });
165
169
  if (__classPrivateFieldGet(this, _AllureReport_instances, "a", _AllureReport_publish_get)) {
166
170
  await __classPrivateFieldGet(this, _AllureReport_allureServiceClient, "f")?.completeReport({
@@ -244,6 +248,7 @@ export class AllureReport {
244
248
  reportName: __classPrivateFieldGet(this, _AllureReport_reportName, "f"),
245
249
  state: pluginState,
246
250
  reportFiles: pluginFiles,
251
+ ci: __classPrivateFieldGet(this, _AllureReport_ci, "f"),
247
252
  };
248
253
  try {
249
254
  await consumer.call(this, plugin, pluginContext);
@@ -262,7 +267,9 @@ export class AllureReport {
262
267
  const { name, readers = [allure1, allure2, cucumberjson, junitXml, attachments], plugins = [], known, reportFiles, qualityGate, realTime, historyPath, defaultLabels = {}, variables = {}, environments, output, allureService: allureServiceConfig, } = opts;
263
268
  __classPrivateFieldSet(this, _AllureReport_allureServiceClient, allureServiceConfig?.url ? new AllureServiceClient(allureServiceConfig) : undefined, "f");
264
269
  this.reportUuid = randomUUID();
265
- __classPrivateFieldSet(this, _AllureReport_reportName, name, "f");
270
+ __classPrivateFieldSet(this, _AllureReport_ci, detect(), "f");
271
+ const reportTitleSuffix = __classPrivateFieldGet(this, _AllureReport_ci, "f")?.pullRequestName ?? __classPrivateFieldGet(this, _AllureReport_ci, "f")?.jobRunName;
272
+ __classPrivateFieldSet(this, _AllureReport_reportName, [name, reportTitleSuffix].filter(Boolean).join(" – "), "f");
266
273
  __classPrivateFieldSet(this, _AllureReport_eventEmitter, new EventEmitter(), "f");
267
274
  __classPrivateFieldSet(this, _AllureReport_events, new Events(__classPrivateFieldGet(this, _AllureReport_eventEmitter, "f")), "f");
268
275
  __classPrivateFieldSet(this, _AllureReport_realTime, realTime, "f");
@@ -299,7 +306,7 @@ export class AllureReport {
299
306
  return __classPrivateFieldGet(this, _AllureReport_qualityGate, "f").result;
300
307
  }
301
308
  }
302
- _AllureReport_reportName = new WeakMap(), _AllureReport_store = new WeakMap(), _AllureReport_readers = new WeakMap(), _AllureReport_plugins = new WeakMap(), _AllureReport_reportFiles = new WeakMap(), _AllureReport_eventEmitter = new WeakMap(), _AllureReport_events = new WeakMap(), _AllureReport_qualityGate = new WeakMap(), _AllureReport_realTime = new WeakMap(), _AllureReport_output = new WeakMap(), _AllureReport_history = new WeakMap(), _AllureReport_allureServiceClient = new WeakMap(), _AllureReport_state = new WeakMap(), _AllureReport_stage = new WeakMap(), _AllureReport_update = new WeakMap(), _AllureReport_eachPlugin = new WeakMap(), _AllureReport_instances = new WeakSet(), _AllureReport_publish_get = function _AllureReport_publish_get() {
309
+ _AllureReport_reportName = new WeakMap(), _AllureReport_ci = new WeakMap(), _AllureReport_store = new WeakMap(), _AllureReport_readers = new WeakMap(), _AllureReport_plugins = new WeakMap(), _AllureReport_reportFiles = new WeakMap(), _AllureReport_eventEmitter = new WeakMap(), _AllureReport_events = new WeakMap(), _AllureReport_qualityGate = new WeakMap(), _AllureReport_realTime = new WeakMap(), _AllureReport_output = new WeakMap(), _AllureReport_history = new WeakMap(), _AllureReport_allureServiceClient = new WeakMap(), _AllureReport_state = new WeakMap(), _AllureReport_stage = new WeakMap(), _AllureReport_update = new WeakMap(), _AllureReport_eachPlugin = new WeakMap(), _AllureReport_instances = new WeakSet(), _AllureReport_publish_get = function _AllureReport_publish_get() {
303
310
  return __classPrivateFieldGet(this, _AllureReport_plugins, "f").some(({ enabled, options }) => enabled && options.publish);
304
311
  }, _AllureReport_getPluginState = function _AllureReport_getPluginState(init, id) {
305
312
  return init ? new DefaultPluginState({}) : __classPrivateFieldGet(this, _AllureReport_state, "f")?.[id];
@@ -66,6 +66,7 @@ export const testResultRawToState = (stateData, raw, context) => {
66
66
  readerId: context.readerId,
67
67
  metadata: context.metadata ?? {},
68
68
  },
69
+ titlePath: raw.titlePath ?? [],
69
70
  };
70
71
  };
71
72
  const processTestCase = ({ testCases }, raw) => {
@@ -39,6 +39,7 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
39
39
  allFixtures(): Promise<TestFixtureResult[]>;
40
40
  allHistoryDataPoints(): Promise<HistoryDataPoint[]>;
41
41
  allKnownIssues(): Promise<KnownTestFailure[]>;
42
+ allNewTestResults(): Promise<TestResult[]>;
42
43
  testCaseById(tcId: string): Promise<TestCase | undefined>;
43
44
  testResultById(trId: string): Promise<TestResult | undefined>;
44
45
  attachmentById(attachmentId: string): Promise<AttachmentLink | undefined>;
@@ -219,6 +219,16 @@ export class DefaultAllureStore {
219
219
  async allKnownIssues() {
220
220
  return __classPrivateFieldGet(this, _DefaultAllureStore_known, "f");
221
221
  }
222
+ async allNewTestResults() {
223
+ const allTrs = await this.allTestResults();
224
+ const allHistoryDps = await this.allHistoryDataPoints();
225
+ return allTrs.filter((tr) => {
226
+ if (!tr.historyId) {
227
+ return true;
228
+ }
229
+ return !allHistoryDps.some((dp) => dp.testResults[tr.historyId]);
230
+ });
231
+ }
222
232
  async testCaseById(tcId) {
223
233
  return __classPrivateFieldGet(this, _DefaultAllureStore_testCases, "f").get(tcId);
224
234
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/core",
3
- "version": "3.0.0-beta.16",
3
+ "version": "3.0.0-beta.17",
4
4
  "description": "Collection of generic Allure utilities used across the entire project",
5
5
  "keywords": [
6
6
  "allure"
@@ -25,21 +25,22 @@
25
25
  "test": "vitest run"
26
26
  },
27
27
  "dependencies": {
28
- "@allurereport/core-api": "3.0.0-beta.16",
29
- "@allurereport/plugin-allure2": "3.0.0-beta.16",
30
- "@allurereport/plugin-api": "3.0.0-beta.16",
31
- "@allurereport/plugin-awesome": "3.0.0-beta.16",
32
- "@allurereport/plugin-classic": "3.0.0-beta.16",
33
- "@allurereport/plugin-csv": "3.0.0-beta.16",
34
- "@allurereport/plugin-dashboard": "3.0.0-beta.16",
35
- "@allurereport/plugin-log": "3.0.0-beta.16",
36
- "@allurereport/plugin-progress": "3.0.0-beta.16",
37
- "@allurereport/plugin-slack": "3.0.0-beta.16",
38
- "@allurereport/plugin-testplan": "3.0.0-beta.16",
39
- "@allurereport/reader": "3.0.0-beta.16",
40
- "@allurereport/reader-api": "3.0.0-beta.16",
41
- "@allurereport/service": "3.0.0-beta.16",
42
- "@allurereport/summary": "3.0.0-beta.16",
28
+ "@allurereport/ci": "3.0.0-beta.17",
29
+ "@allurereport/core-api": "3.0.0-beta.17",
30
+ "@allurereport/plugin-allure2": "3.0.0-beta.17",
31
+ "@allurereport/plugin-api": "3.0.0-beta.17",
32
+ "@allurereport/plugin-awesome": "3.0.0-beta.17",
33
+ "@allurereport/plugin-classic": "3.0.0-beta.17",
34
+ "@allurereport/plugin-csv": "3.0.0-beta.17",
35
+ "@allurereport/plugin-dashboard": "3.0.0-beta.17",
36
+ "@allurereport/plugin-log": "3.0.0-beta.17",
37
+ "@allurereport/plugin-progress": "3.0.0-beta.17",
38
+ "@allurereport/plugin-slack": "3.0.0-beta.17",
39
+ "@allurereport/plugin-testplan": "3.0.0-beta.17",
40
+ "@allurereport/reader": "3.0.0-beta.17",
41
+ "@allurereport/reader-api": "3.0.0-beta.17",
42
+ "@allurereport/service": "3.0.0-beta.17",
43
+ "@allurereport/summary": "3.0.0-beta.17",
43
44
  "handlebars": "^4.7.8",
44
45
  "markdown-it": "^14.1.0"
45
46
  },
@@ -53,8 +54,8 @@
53
54
  "@typescript-eslint/parser": "^8.0.0",
54
55
  "@vitest/runner": "^2.1.9",
55
56
  "@vitest/snapshot": "^2.1.9",
56
- "allure-js-commons": "^3.0.9",
57
- "allure-vitest": "^3.0.9",
57
+ "allure-js-commons": "^3.3.0",
58
+ "allure-vitest": "^3.3.0",
58
59
  "eslint": "^8.57.0",
59
60
  "eslint-config-prettier": "^9.1.0",
60
61
  "eslint-plugin-import": "^2.29.1",