@allurereport/core 3.0.0-beta.3 → 3.0.0-beta.4

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/history.js CHANGED
@@ -54,5 +54,5 @@ export const writeHistory = async (historyPath, data) => {
54
54
  const path = resolve(historyPath);
55
55
  const parentDir = dirname(path);
56
56
  await mkdir(parentDir, { recursive: true });
57
- await writeFile(path, JSON.stringify(data) + "\n", { encoding: "utf-8", flag: "a+" });
57
+ await writeFile(path, `${JSON.stringify(data)}\n`, { encoding: "utf-8", flag: "a+" });
58
58
  };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from "./api.js";
1
+ export type * from "./api.js";
2
2
  export * from "./utils/misc.js";
3
3
  export * from "./utils/crypto.js";
4
4
  export * from "./history.js";
package/dist/index.js CHANGED
@@ -1,4 +1,3 @@
1
- export * from "./api.js";
2
1
  export * from "./utils/misc.js";
3
2
  export * from "./utils/crypto.js";
4
3
  export * from "./history.js";
package/dist/plugin.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { PluginState, ReportFiles } from "@allurereport/plugin-api";
1
+ import type { PluginState, ReportFiles } from "@allurereport/plugin-api";
2
2
  export declare class DefaultPluginState implements PluginState {
3
3
  #private;
4
4
  constructor(state: Record<string, any>);
package/dist/report.js CHANGED
@@ -126,7 +126,7 @@ export class AllureReport {
126
126
  if (initState) {
127
127
  __classPrivateFieldSet(this, _AllureReport_state, {}, "f");
128
128
  }
129
- for (let descriptor of __classPrivateFieldGet(this, _AllureReport_plugins, "f")) {
129
+ for (const descriptor of __classPrivateFieldGet(this, _AllureReport_plugins, "f")) {
130
130
  if (!descriptor.enabled) {
131
131
  continue;
132
132
  }
@@ -1,5 +1,5 @@
1
- import { AttachmentLink, TestCase, TestFixtureResult, TestResult } from "@allurereport/core-api";
2
- import { RawFixtureResult, RawTestResult, ReaderContext } from "@allurereport/reader-api";
1
+ import type { AttachmentLink, TestCase, TestFixtureResult, TestResult } from "@allurereport/core-api";
2
+ import type { RawFixtureResult, RawTestResult, ReaderContext } from "@allurereport/reader-api";
3
3
  export declare const __unknown = "#___unknown_value___#";
4
4
  export type StateData = {
5
5
  testCases: Map<string, TestCase>;
@@ -1,4 +1,4 @@
1
- import { notNull, } from "@allurereport/core-api";
1
+ import { notNull } from "@allurereport/core-api";
2
2
  import { findByLabelName } from "@allurereport/core-api";
3
3
  import { md5 } from "@allurereport/plugin-api";
4
4
  import MarkdownIt from "markdown-it";
@@ -100,9 +100,9 @@ const processAttachmentLink = ({ attachments, visitAttachmentLink }, attach) =>
100
100
  });
101
101
  }
102
102
  const id = md5(attach.originalFileName);
103
- let previous = attachments.get(id);
103
+ const previous = attachments.get(id);
104
104
  if (!previous) {
105
- const link = {
105
+ const linkExpected = {
106
106
  id,
107
107
  originalFileName: attach.originalFileName,
108
108
  ext: extname(attach.originalFileName),
@@ -111,9 +111,9 @@ const processAttachmentLink = ({ attachments, visitAttachmentLink }, attach) =>
111
111
  used: true,
112
112
  missed: true,
113
113
  };
114
- attachments.set(id, link);
115
- visitAttachmentLink(link);
116
- return createAttachmentStep(link);
114
+ attachments.set(id, linkExpected);
115
+ visitAttachmentLink(linkExpected);
116
+ return createAttachmentStep(linkExpected);
117
117
  }
118
118
  if (previous.used) {
119
119
  return createAttachmentStep({
@@ -240,13 +240,13 @@ const processTagLabels = (label) => {
240
240
  if (label.name === "tag" && label.value) {
241
241
  const matchTag = label.value.match(idLabelMatcher);
242
242
  if (matchTag) {
243
- const id = matchTag?.groups?.["id"];
243
+ const id = matchTag?.groups?.id;
244
244
  return id ? [{ name: "ALLURE_ID", value: id }] : [];
245
245
  }
246
246
  const matchLabel = label.value.match(tagLabelMatcher);
247
247
  if (matchLabel) {
248
- const name = matchLabel?.groups?.["name"];
249
- const value = matchLabel?.groups?.["value"];
248
+ const name = matchLabel?.groups?.name;
249
+ const value = matchLabel?.groups?.value;
250
250
  return name && value ? [{ name, value }] : [];
251
251
  }
252
252
  }
@@ -1,8 +1,8 @@
1
- import { AttachmentLink, HistoryDataPoint, HistoryTestResult, KnownTestFailure, Statistic, TestCase, TestFixtureResult, TestResult } from "@allurereport/core-api";
2
- import { AllureStore, ResultFile } from "@allurereport/plugin-api";
1
+ import type { AttachmentLink, HistoryDataPoint, HistoryTestResult, KnownTestFailure, Statistic, TestCase, TestFixtureResult, TestResult } from "@allurereport/core-api";
2
+ import type { AllureStore, ResultFile } from "@allurereport/plugin-api";
3
3
  import type { RawFixtureResult, RawMetadata, RawTestResult, ReaderContext, ResultsVisitor } from "@allurereport/reader-api";
4
- import { EventEmitter } from "node:events";
5
- import { AllureStoreEvents } from "../utils/event.js";
4
+ import type { EventEmitter } from "node:events";
5
+ import type { AllureStoreEvents } from "../utils/event.js";
6
6
  export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
7
7
  #private;
8
8
  readonly indexTestResultByTestCase: Map<string, TestResult[]>;
@@ -15,8 +15,8 @@ export declare class DefaultAllureStore implements AllureStore, ResultsVisitor {
15
15
  constructor(history?: HistoryDataPoint[], known?: KnownTestFailure[], eventEmitter?: EventEmitter<AllureStoreEvents>);
16
16
  visitTestResult(raw: RawTestResult, context: ReaderContext): Promise<void>;
17
17
  visitTestFixtureResult(result: RawFixtureResult, context: ReaderContext): Promise<void>;
18
- visitAttachmentFile(resultFile: ResultFile, context: ReaderContext): Promise<void>;
19
- visitMetadata(metadata: RawMetadata, context: ReaderContext): Promise<void>;
18
+ visitAttachmentFile(resultFile: ResultFile): Promise<void>;
19
+ visitMetadata(metadata: RawMetadata): Promise<void>;
20
20
  allTestCases(): Promise<TestCase[]>;
21
21
  allTestResults(options?: {
22
22
  includeHidden: boolean;
@@ -10,7 +10,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
10
10
  return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
11
  };
12
12
  var _DefaultAllureStore_testResults, _DefaultAllureStore_attachments, _DefaultAllureStore_attachmentContents, _DefaultAllureStore_testCases, _DefaultAllureStore_metadata, _DefaultAllureStore_history, _DefaultAllureStore_known, _DefaultAllureStore_fixtures, _DefaultAllureStore_eventEmitter;
13
- import { compareBy, nullsLast, ordinal, reverse, } from "@allurereport/core-api";
13
+ import { compareBy, nullsLast, ordinal, reverse } from "@allurereport/core-api";
14
14
  import { md5 } from "@allurereport/plugin-api";
15
15
  import { extname } from "node:path";
16
16
  import { testFixtureResultRawToState, testResultRawToState } from "./convert.js";
@@ -93,7 +93,7 @@ export class DefaultAllureStore {
93
93
  index(this.indexAttachmentByFixture, testFixtureResult.id, ...attachmentLinks);
94
94
  __classPrivateFieldGet(this, _DefaultAllureStore_eventEmitter, "f")?.emit("testFixtureResult", testFixtureResult.id);
95
95
  }
96
- async visitAttachmentFile(resultFile, context) {
96
+ async visitAttachmentFile(resultFile) {
97
97
  const originalFileName = resultFile.getOriginalFileName();
98
98
  const id = md5(originalFileName);
99
99
  __classPrivateFieldGet(this, _DefaultAllureStore_attachmentContents, "f").set(id, resultFile);
@@ -118,7 +118,7 @@ export class DefaultAllureStore {
118
118
  }
119
119
  __classPrivateFieldGet(this, _DefaultAllureStore_eventEmitter, "f")?.emit("attachmentFile", id);
120
120
  }
121
- async visitMetadata(metadata, context) {
121
+ async visitMetadata(metadata) {
122
122
  Object.keys(metadata).forEach((key) => __classPrivateFieldGet(this, _DefaultAllureStore_metadata, "f").set(key, metadata[key]));
123
123
  }
124
124
  async allTestCases() {
@@ -145,7 +145,6 @@ export class DefaultAllureStore {
145
145
  return Array.from(__classPrivateFieldGet(this, _DefaultAllureStore_fixtures, "f").values());
146
146
  }
147
147
  async allHistoryDataPoints() {
148
- console.log(__classPrivateFieldGet(this, _DefaultAllureStore_history, "f"));
149
148
  return __classPrivateFieldGet(this, _DefaultAllureStore_history, "f");
150
149
  }
151
150
  async allKnownIssues() {
@@ -178,11 +177,10 @@ export class DefaultAllureStore {
178
177
  return [];
179
178
  }
180
179
  return (this.indexTestResultByHistoryId.get(tr.historyId) ?? [])
181
- .filter((tr) => tr.hidden)
180
+ .filter((r) => r.hidden)
182
181
  .sort(nullsLast(compareBy("start", reverse(ordinal()))));
183
182
  }
184
183
  async historyByTrId(trId) {
185
- console.log(__classPrivateFieldGet(this, _DefaultAllureStore_history, "f"));
186
184
  const tr = await this.testResultById(trId);
187
185
  if (!tr?.historyId) {
188
186
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/core",
3
- "version": "3.0.0-beta.3",
3
+ "version": "3.0.0-beta.4",
4
4
  "description": "Collection of generic Allure utilities used across the entire project",
5
5
  "keywords": [
6
6
  "allure"
@@ -20,20 +20,22 @@
20
20
  "scripts": {
21
21
  "build": "run clean && tsc --project ./tsconfig.json",
22
22
  "clean": "rimraf ./dist",
23
+ "eslint": "eslint ./src/**/*.{js,jsx,ts,tsx}",
24
+ "eslint:format": "eslint --fix ./src/**/*.{js,jsx,ts,tsx}",
23
25
  "test": "vitest run"
24
26
  },
25
27
  "dependencies": {
26
- "@allurereport/core-api": "3.0.0-beta.3",
27
- "@allurereport/plugin-api": "3.0.0-beta.3",
28
- "@allurereport/plugin-awesome": "3.0.0-beta.3",
29
- "@allurereport/plugin-classic": "3.0.0-beta.3",
30
- "@allurereport/plugin-csv": "3.0.0-beta.3",
31
- "@allurereport/plugin-log": "3.0.0-beta.3",
32
- "@allurereport/plugin-progress": "3.0.0-beta.3",
33
- "@allurereport/plugin-slack": "3.0.0-beta.3",
34
- "@allurereport/plugin-testplan": "3.0.0-beta.3",
35
- "@allurereport/reader": "3.0.0-beta.3",
36
- "@allurereport/reader-api": "3.0.0-beta.3",
28
+ "@allurereport/core-api": "3.0.0-beta.4",
29
+ "@allurereport/plugin-api": "3.0.0-beta.4",
30
+ "@allurereport/plugin-awesome": "3.0.0-beta.4",
31
+ "@allurereport/plugin-classic": "3.0.0-beta.4",
32
+ "@allurereport/plugin-csv": "3.0.0-beta.4",
33
+ "@allurereport/plugin-log": "3.0.0-beta.4",
34
+ "@allurereport/plugin-progress": "3.0.0-beta.4",
35
+ "@allurereport/plugin-slack": "3.0.0-beta.4",
36
+ "@allurereport/plugin-testplan": "3.0.0-beta.4",
37
+ "@allurereport/reader": "3.0.0-beta.4",
38
+ "@allurereport/reader-api": "3.0.0-beta.4",
37
39
  "markdown-it": "^14.1.0"
38
40
  },
39
41
  "devDependencies": {