@muuktest/amikoo-reporter 1.1.0 → 1.1.1
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/gitUtils.d.ts.map +1 -1
- package/dist/gitUtils.js +68 -4
- package/dist/gitUtils.js.map +1 -1
- package/package.json +1 -1
package/dist/gitUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitUtils.d.ts","sourceRoot":"","sources":["../controlHub/gitUtils.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;
|
|
1
|
+
{"version":3,"file":"gitUtils.d.ts","sourceRoot":"","sources":["../controlHub/gitUtils.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAwHD,wBAAsB,aAAa,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CA2B7E"}
|
package/dist/gitUtils.js
CHANGED
|
@@ -8,11 +8,66 @@ const child_process_1 = require("child_process");
|
|
|
8
8
|
const dotenv_1 = __importDefault(require("dotenv"));
|
|
9
9
|
const apiUtils_1 = require("./apiUtils");
|
|
10
10
|
dotenv_1.default.config();
|
|
11
|
+
// Parse Azure DevOps repository URL to extract its components
|
|
12
|
+
// Supports formats:
|
|
13
|
+
// - https://username@dev.azure.com/organization/project/_git/repository
|
|
14
|
+
// - https://dev.azure.com/organization/project/_git/repository
|
|
15
|
+
// - https://organization.visualstudio.com/project/_git/repository
|
|
16
|
+
// params:
|
|
17
|
+
// - url (string) - Azure DevOps repository URL
|
|
18
|
+
// returns:
|
|
19
|
+
// - AzureRepoUrlParts object with extracted components, or null if invalid URL
|
|
20
|
+
function parseAzureRepoUrl(url) {
|
|
21
|
+
if (!url) {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const urlObj = new URL(url);
|
|
26
|
+
const hostname = urlObj.hostname;
|
|
27
|
+
const pathname = urlObj.pathname;
|
|
28
|
+
const username = urlObj.username || undefined;
|
|
29
|
+
if (hostname === 'dev.azure.com') {
|
|
30
|
+
const parts = pathname.split('/').filter((p) => p);
|
|
31
|
+
if (parts.length >= 4 && parts[2] === '_git') {
|
|
32
|
+
const organization = decodeURIComponent(parts[0]);
|
|
33
|
+
const project = decodeURIComponent(parts[1]);
|
|
34
|
+
const repository = decodeURIComponent(parts[3]);
|
|
35
|
+
return {
|
|
36
|
+
username,
|
|
37
|
+
organization,
|
|
38
|
+
project,
|
|
39
|
+
repository,
|
|
40
|
+
baseUrl: `https://dev.azure.com/${organization}`
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (hostname.endsWith('.visualstudio.com')) {
|
|
45
|
+
const organization = hostname.replace('.visualstudio.com', '');
|
|
46
|
+
const parts = pathname.split('/').filter((p) => p);
|
|
47
|
+
if (parts.length >= 3 && parts[1] === '_git') {
|
|
48
|
+
const project = decodeURIComponent(parts[0]);
|
|
49
|
+
const repository = decodeURIComponent(parts[2]);
|
|
50
|
+
return {
|
|
51
|
+
username,
|
|
52
|
+
organization,
|
|
53
|
+
project,
|
|
54
|
+
repository,
|
|
55
|
+
baseUrl: `https://${hostname}`
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
// Not a valid URL or not Azure format.
|
|
62
|
+
}
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
11
65
|
/**
|
|
12
66
|
* Parses a git remote URL to extract owner and repo name.
|
|
13
|
-
* Supports
|
|
14
|
-
* - https://github.com/owner/repo.git
|
|
15
|
-
* - git@github.com:owner/repo.git
|
|
67
|
+
* Supports HTTPS and SSH formats:
|
|
68
|
+
* - GitHub: https://github.com/owner/repo.git
|
|
69
|
+
* - GitHub SSH: git@github.com:owner/repo.git
|
|
70
|
+
* - Azure DevOps: https://[username@]dev.azure.com/organization/project/_git/repository
|
|
16
71
|
*/
|
|
17
72
|
function parseGitRemoteUrl(remoteUrl) {
|
|
18
73
|
const response = {
|
|
@@ -21,6 +76,15 @@ function parseGitRemoteUrl(remoteUrl) {
|
|
|
21
76
|
};
|
|
22
77
|
// Remove trailing .git if present
|
|
23
78
|
const cleanUrl = remoteUrl.replace(/\.git$/, '');
|
|
79
|
+
const parsedAzure = parseAzureRepoUrl(cleanUrl);
|
|
80
|
+
if (parsedAzure) {
|
|
81
|
+
return {
|
|
82
|
+
owner: parsedAzure.username || '',
|
|
83
|
+
repo: parsedAzure.repository,
|
|
84
|
+
organizationName: parsedAzure.organization,
|
|
85
|
+
projectName: parsedAzure.project
|
|
86
|
+
};
|
|
87
|
+
}
|
|
24
88
|
// Match HTTPS format: https://github.com/owner/repo
|
|
25
89
|
const httpsMatch = cleanUrl.match(/https?:\/\/[^\/]+\/([^\/]+)\/([^\/]+)/);
|
|
26
90
|
if (httpsMatch) {
|
|
@@ -59,7 +123,7 @@ async function getGitContext(access_token) {
|
|
|
59
123
|
repositoryId: repoData?.id?.toString() || "0",
|
|
60
124
|
repositoryName: repo,
|
|
61
125
|
branch,
|
|
62
|
-
owner: owner || 'unknown-owner'
|
|
126
|
+
owner: repoData?.owner || 'unknown-owner'
|
|
63
127
|
};
|
|
64
128
|
}
|
|
65
129
|
//# sourceMappingURL=gitUtils.js.map
|
package/dist/gitUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gitUtils.js","sourceRoot":"","sources":["../controlHub/gitUtils.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"gitUtils.js","sourceRoot":"","sources":["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AK,EAAE,eAAe,EAAE,CAAC;IAC5G,CAAC;IAED,yCAAyC;IACzC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,iBAAiB,CAAC,SAAS,CAAC,CAAC;IAErD,MAAM,IAAI,GAAG;QACZ,OAAO,EAAE,KAAK;QACb,MAAM,EAAE,IAAI;KACb,CAAA;IACD,MAAM,QAAQ,GAAG,MAAM,cAAG,CAAC,IAAI,CAAC,iBAAiB,EAAE,YAAY,EAAG,IAAI,CAAC,CAAC;IACxE,MAAM,QAAQ,GAAG,MAAM,QAAQ,EAAE,IAAI,CAAC;IACtC,OAAO;QACL,YAAY,EAAE,QAAQ,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAI,GAAG;QAC7C,cAAc,EAAE,IAAI;QACpB,MAAM;QACN,KAAK,EAAE,QAAQ,EAAE,KAAK,IAAI,eAAe;KAC1C,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@muuktest/amikoo-reporter",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Playwright reporter for Amikoo - automatically installs and configures test reporting to Amikoo AI",
|
|
5
5
|
"main": "dist/controlHubReporter.js",
|
|
6
6
|
"types": "dist/controlHubReporter.d.ts",
|