@allurereport/core 3.19.1 → 3.20.0

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/report.js CHANGED
@@ -14,7 +14,7 @@ import console from "node:console";
14
14
  import { randomUUID } from "node:crypto";
15
15
  import { once } from "node:events";
16
16
  import { createReadStream, createWriteStream, existsSync, readFileSync } from "node:fs";
17
- import { lstat, mkdtemp, readdir, realpath, rename, rm, writeFile } from "node:fs/promises";
17
+ import { lstat, mkdtemp, readdir, rename, rm, writeFile } from "node:fs/promises";
18
18
  import { tmpdir } from "node:os";
19
19
  import { basename, dirname, join, resolve } from "node:path";
20
20
  import { promisify } from "node:util";
@@ -81,9 +81,7 @@ const getExecutorReportUrl = (executor) => {
81
81
  return undefined;
82
82
  }
83
83
  try {
84
- const navUrl = new URL(reportUrl);
85
- navUrl.pathname = navUrl.pathname.endsWith("/") ? navUrl.pathname : `${navUrl.pathname}/`;
86
- return navUrl.toString();
84
+ return new URL(reportUrl).toString();
87
85
  }
88
86
  catch {
89
87
  return undefined;
@@ -319,8 +317,7 @@ export class AllureReport {
319
317
  });
320
318
  await Promise.all(entries.map((dirent) => limit(async () => {
321
319
  try {
322
- const path = await measurePerfAggregate(PERF_METRIC_NAMES.generateReadResultsRealpath, () => realpath(join(resultsDirPath, dirent.name)));
323
- await this.readResult(new PathResultFile(path, dirent.name));
320
+ await this.readResult(new PathResultFile(join(resultsDirPath, dirent.name), dirent.name));
324
321
  }
325
322
  catch (e) {
326
323
  console.error(`can't read result file ${dirent.name}`, e);
@@ -1,4 +1,4 @@
1
- import type { ResolutionRule, ResolutionsConfig, TestResult } from "@allurereport/core-api";
1
+ import type { IssueResolutionRule, ResolutionIssue, ResolutionRule, ResolutionsConfig, TestResult } from "@allurereport/core-api";
2
2
  import type { AllureStore } from "@allurereport/plugin-api";
3
3
  export declare const DEFAULT_KNOWN_ISSUES_PATH = "known-issues.json";
4
4
  export declare const validateResolutionsConfig: (config?: ResolutionsConfig) => void;
@@ -12,5 +12,6 @@ export declare const KNOWN_FROM_RESULT_RESOLUTION: {
12
12
  };
13
13
  export declare const getResolutionByRules: (testResult: TestResult, config?: ResolutionsConfig) => ResolutionRule | undefined;
14
14
  export declare const isIgnoredFailure: (testResult: TestResult) => boolean;
15
+ export declare const createResolutionIssue: (rule: IssueResolutionRule, config?: ResolutionsConfig) => ResolutionIssue;
15
16
  export declare const resolveExactIssuesFilePath: (pathOrDir: string | undefined, label: string) => Promise<string | undefined>;
16
17
  export declare const writeKnownIssues: (store: AllureStore, knownIssuesPath?: string) => Promise<void>;
@@ -52,7 +52,7 @@ const validateIssueUrl = (rule, template, errors) => {
52
52
  }
53
53
  let url;
54
54
  try {
55
- url = new URL(template.urlTemplate.replace("%s", encodeURIComponent(rule.issue.id)));
55
+ url = new URL(template.urlTemplate.replace("%s", () => encodeURIComponent(rule.issue.id)));
56
56
  }
57
57
  catch {
58
58
  errors.push(`resolutions.links.${rule.issue.type}.urlTemplate must resolve to an absolute URL`);
@@ -155,6 +155,21 @@ export const getResolutionByRules = (testResult, config) => {
155
155
  return undefined;
156
156
  };
157
157
  export const isIgnoredFailure = (testResult) => testResult.resolution === "muted" || testResult.resolution === "accepted";
158
+ export const createResolutionIssue = (rule, config) => {
159
+ const template = config?.links?.[rule.issue.type];
160
+ const issue = { ...rule.issue, comment: rule.comment };
161
+ if (!template) {
162
+ return issue;
163
+ }
164
+ return {
165
+ ...issue,
166
+ link: {
167
+ name: template.nameTemplate?.replace("%s", () => rule.issue.id) ?? rule.issue.id,
168
+ url: template.urlTemplate.replace("%s", () => encodeURIComponent(rule.issue.id)),
169
+ type: rule.issue.type,
170
+ },
171
+ };
172
+ };
158
173
  export const resolveExactIssuesFilePath = async (pathOrDir, label) => {
159
174
  if (!pathOrDir)
160
175
  return undefined;
@@ -48,15 +48,18 @@ export class RetrySubstore {
48
48
  });
49
49
  }
50
50
  retriesByTr(testResult) {
51
- if (!testResult.retryHash || testResult.isRetry) {
51
+ if (!testResult.retryHash) {
52
52
  return NO_RETRIES;
53
53
  }
54
54
  const attempts = __classPrivateFieldGet(this, _RetrySubstore_testResultsByRetryHash, "f").get(testResult.retryHash) ?? [];
55
+ if (attempts.length <= 1) {
56
+ return NO_RETRIES;
57
+ }
55
58
  const index = attempts.findIndex((attempt) => attempt.id === testResult.id);
56
- if (index !== 0) {
59
+ if (index === -1) {
57
60
  return NO_RETRIES;
58
61
  }
59
- return attempts.slice(1);
62
+ return attempts.filter((attempt) => attempt.id !== testResult.id);
60
63
  }
61
64
  reset() {
62
65
  __classPrivateFieldGet(this, _RetrySubstore_testResultsByRetryHash, "f").clear();
@@ -13,7 +13,7 @@ var _DefaultAllureStore_instances, _DefaultAllureStore_testResults, _DefaultAllu
13
13
  import { extname } from "node:path";
14
14
  import { DEFAULT_ENVIRONMENT, DEFAULT_ENVIRONMENT_IDENTITY, calculateEnvironmentHash, calculateParametersHash, calculateRetryHash, calculateTestCaseHash, compareBy, createDictionary, fallbackTestCaseIdLabelName, getWorstStatus, createHistoryTestResultLookup, normalizeHistoryDataPoint, ordinal, reverse, resolveMetricSamples, validateEnvironmentId, validateEnvironmentName, } from "@allurereport/core-api";
15
15
  import { md5, } from "@allurereport/plugin-api";
16
- import { getResolutionByRules, isIgnoredFailure } from "../resolutions.js";
16
+ import { createResolutionIssue, getResolutionByRules, isIgnoredFailure } from "../resolutions.js";
17
17
  import { environmentIdentityById, normalizeEnvironmentDescriptorMap, resolveEnvironmentIdentity, resolveStoredEnvironmentIdentity, validateAllowedEnvironmentId, } from "../utils/environment.js";
18
18
  import { createFlakyDetector } from "../utils/flaky.js";
19
19
  import { getStatusTransition } from "../utils/new.js";
@@ -1195,7 +1195,7 @@ _DefaultAllureStore_testResults = new WeakMap(), _DefaultAllureStore_attachments
1195
1195
  testResult.resolution = rule.resolution;
1196
1196
  testResult.resolutionComment = rule.comment;
1197
1197
  if (rule.resolution === "issue") {
1198
- __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_associateResolutionIssue).call(this, { ...rule.issue, comment: rule.comment }, testResult.id);
1198
+ __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_associateResolutionIssue).call(this, createResolutionIssue(rule, __classPrivateFieldGet(this, _DefaultAllureStore_resolutionsConfig, "f")), testResult.id);
1199
1199
  }
1200
1200
  }, _DefaultAllureStore_associateResolutionIssue = function _DefaultAllureStore_associateResolutionIssue(resolutionIssue, testResultId) {
1201
1201
  __classPrivateFieldGet(this, _DefaultAllureStore_instances, "m", _DefaultAllureStore_removeResolutionIssueAssociation).call(this, testResultId);
@@ -19,7 +19,6 @@ export declare const PERF_METRIC_NAMES: {
19
19
  readonly generateReadResultsXcresultCheck: "generate.readResults.xcresultCheck";
20
20
  readonly generateReadResultsReaddir: "generate.readResults.readdir";
21
21
  readonly generateReadResultsFiles: "generate.readResults.files";
22
- readonly generateReadResultsRealpath: "generate.readResults.realpath";
23
22
  readonly generateReadResultsReaderRead: "generate.readResults.reader.read";
24
23
  readonly generatePluginsDone: "generate.plugins.done";
25
24
  readonly storeVisitTestResultConvert: "store.visitTestResult.convert";
@@ -24,7 +24,6 @@ export const PERF_METRIC_NAMES = {
24
24
  generateReadResultsXcresultCheck: "generate.readResults.xcresultCheck",
25
25
  generateReadResultsReaddir: "generate.readResults.readdir",
26
26
  generateReadResultsFiles: "generate.readResults.files",
27
- generateReadResultsRealpath: "generate.readResults.realpath",
28
27
  generateReadResultsReaderRead: "generate.readResults.reader.read",
29
28
  generatePluginsDone: "generate.plugins.done",
30
29
  storeVisitTestResultConvert: "store.visitTestResult.convert",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/core",
3
- "version": "3.19.1",
3
+ "version": "3.20.0",
4
4
  "description": "Collection of generic Allure utilities used across the entire project",
5
5
  "keywords": [
6
6
  "allure"
@@ -25,26 +25,26 @@
25
25
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
26
26
  },
27
27
  "dependencies": {
28
- "@allurereport/ci": "3.19.1",
29
- "@allurereport/cli-commons": "3.19.1",
30
- "@allurereport/core-api": "3.19.1",
31
- "@allurereport/plugin-agent": "3.19.1",
32
- "@allurereport/plugin-allure2": "3.19.1",
33
- "@allurereport/plugin-api": "3.19.1",
34
- "@allurereport/plugin-awesome": "3.19.1",
35
- "@allurereport/plugin-classic": "3.19.1",
36
- "@allurereport/plugin-csv": "3.19.1",
37
- "@allurereport/plugin-dashboard": "3.19.1",
38
- "@allurereport/plugin-jira": "3.19.1",
39
- "@allurereport/plugin-log": "3.19.1",
40
- "@allurereport/plugin-progress": "3.19.1",
41
- "@allurereport/plugin-slack": "3.19.1",
42
- "@allurereport/plugin-testops": "3.19.1",
43
- "@allurereport/plugin-testplan": "3.19.1",
44
- "@allurereport/reader": "3.19.1",
45
- "@allurereport/reader-api": "3.19.1",
46
- "@allurereport/service": "3.19.1",
47
- "@allurereport/summary": "3.19.1",
28
+ "@allurereport/ci": "3.20.0",
29
+ "@allurereport/cli-commons": "3.20.0",
30
+ "@allurereport/core-api": "3.20.0",
31
+ "@allurereport/plugin-agent": "3.20.0",
32
+ "@allurereport/plugin-allure2": "3.20.0",
33
+ "@allurereport/plugin-api": "3.20.0",
34
+ "@allurereport/plugin-awesome": "3.20.0",
35
+ "@allurereport/plugin-classic": "3.20.0",
36
+ "@allurereport/plugin-csv": "3.20.0",
37
+ "@allurereport/plugin-dashboard": "3.20.0",
38
+ "@allurereport/plugin-jira": "3.20.0",
39
+ "@allurereport/plugin-log": "3.20.0",
40
+ "@allurereport/plugin-progress": "3.20.0",
41
+ "@allurereport/plugin-slack": "3.20.0",
42
+ "@allurereport/plugin-testops": "3.20.0",
43
+ "@allurereport/plugin-testplan": "3.20.0",
44
+ "@allurereport/reader": "3.20.0",
45
+ "@allurereport/reader-api": "3.20.0",
46
+ "@allurereport/service": "3.20.0",
47
+ "@allurereport/summary": "3.20.0",
48
48
  "glob": "^13.0.6",
49
49
  "handlebars": "^4.7.9",
50
50
  "jiti": "^2.5.1",