@allurereport/ci 3.20.0 → 3.21.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.
@@ -48,6 +48,17 @@ const getRepositoryFromUrl = () => {
48
48
  const repositoryUrl = getRepositoryUrl();
49
49
  return repositoryUrl ? resolveRepositoryFromGitUrl(repositoryUrl) : undefined;
50
50
  };
51
+ const getBrowserRepositoryUrl = (repositoryUrl) => {
52
+ try {
53
+ const url = new URL(repositoryUrl);
54
+ url.username = "";
55
+ url.password = "";
56
+ return url.toString().replace(/\/$/, "");
57
+ }
58
+ catch {
59
+ return repositoryUrl;
60
+ }
61
+ };
51
62
  export const azure = {
52
63
  type: CiType.Azure,
53
64
  get detected() {
@@ -101,7 +112,7 @@ export const azure = {
101
112
  return `${repositoryUrl}/pull/${pullRequestId}`;
102
113
  }
103
114
  if (repositoryProvider === "TfsGit" || repositoryProvider === "TfsVersionControl") {
104
- return `${repositoryUrl}/pullrequest/${pullRequestId}`;
115
+ return `${getBrowserRepositoryUrl(repositoryUrl)}/pullrequest/${pullRequestId}`;
105
116
  }
106
117
  return "";
107
118
  },
@@ -117,8 +117,9 @@ const renderTable = (rows, includeResolutions, options) => {
117
117
  return [`| ${headers.join(" | ")} |`, `| ${divider.join(" | ")} |`, ...body.map((row) => `| ${row} |`)].join("\n");
118
118
  };
119
119
  const reportHref = (report) => report.remoteHref ?? report.href;
120
- const reportLabel = (report) => report.plugin ?? report.name;
121
120
  const isAwesomeReport = (report) => report?.pluginId?.toLowerCase() === "awesome" || report?.plugin?.toLowerCase() === "awesome";
121
+ const isAllureTestOpsReport = (report) => report?.pluginId?.toLowerCase() === "testops";
122
+ const reportLabel = (report) => isAllureTestOpsReport(report) ? report.name : (report.plugin ?? report.name);
122
123
  const appendReportFilter = (href, filter) => {
123
124
  const hashIndex = href.indexOf("#");
124
125
  const base = hashIndex === -1 ? href : href.slice(0, hashIndex);
@@ -135,7 +136,7 @@ const createDefaultReportFilterHref = (reports) => {
135
136
  return href ? appendReportFilter(href, filter) : undefined;
136
137
  };
137
138
  };
138
- const reportLinkKind = (report) => report.plugin?.toLowerCase() === "testops" ? "testops" : "report";
139
+ const reportLinkKind = (report) => isAllureTestOpsReport(report) ? "testops" : "report";
139
140
  const toReportLink = (report) => {
140
141
  const href = reportHref(report);
141
142
  return href
@@ -157,7 +158,7 @@ const renderReportLinks = (reports) => {
157
158
  const links = sortLinks(reports.map(toReportLink).filter((item) => item !== undefined));
158
159
  const reportLinks = links.filter(({ kind }) => kind === "report");
159
160
  const testOpsLinks = links.filter(({ kind }) => kind === "testops");
160
- return [renderLinks("Reports", reportLinks), renderLinks("TestOps", testOpsLinks)].filter((line) => line !== undefined);
161
+ return [renderLinks("Reports", reportLinks), renderLinks("Allure TestOps", testOpsLinks)].filter((line) => line !== undefined);
161
162
  };
162
163
  const pluginSummaryToStatusStats = (report) => ({
163
164
  failed: report.stats.failed ?? 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@allurereport/ci",
3
- "version": "3.20.0",
3
+ "version": "3.21.0",
4
4
  "description": "Utilities set to get useful report data from different CI",
5
5
  "keywords": [
6
6
  "allure",
@@ -28,17 +28,20 @@
28
28
  "build": "run clean && tsc --project ./tsconfig.json",
29
29
  "clean": "rimraf ./dist",
30
30
  "test": "rimraf ./out && vitest run",
31
+ "test:unit": "yarn test",
31
32
  "lint": "oxlint --import-plugin src test features stories",
32
33
  "lint:fix": "oxlint --import-plugin --fix src test features stories"
33
34
  },
34
35
  "dependencies": {
35
- "@allurereport/core-api": "3.20.0",
36
- "@allurereport/plugin-api": "3.20.0",
36
+ "@allurereport/core-api": "3.21.0",
37
+ "@allurereport/plugin-api": "3.21.0",
37
38
  "axios": "^1.20.0",
38
39
  "glob": "^13.0.6"
39
40
  },
40
41
  "devDependencies": {
42
+ "@allurereport/test-config": "3.21.0",
41
43
  "@types/node": "^20",
44
+ "@vitest/coverage-istanbul": "^4.1.0",
42
45
  "@vitest/runner": "^2.1.8",
43
46
  "@vitest/snapshot": "^5.0.1",
44
47
  "allure-js-commons": "^3",