@argos-ci/util 1.0.0 → 1.1.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/browser.d.ts +2 -0
- package/dist/index.d.ts +8 -1
- package/dist/index.mjs +20 -2
- package/package.json +2 -2
package/dist/browser.d.ts
CHANGED
package/dist/index.d.ts
CHANGED
|
@@ -18,6 +18,8 @@ type ScreenshotMetadata = {
|
|
|
18
18
|
id?: string;
|
|
19
19
|
title: string;
|
|
20
20
|
titlePath: string[];
|
|
21
|
+
retries?: number;
|
|
22
|
+
retry?: number;
|
|
21
23
|
location?: {
|
|
22
24
|
file: string;
|
|
23
25
|
line: number;
|
|
@@ -56,4 +58,9 @@ declare function readMetadata(screenshotPath: string): Promise<ScreenshotMetadat
|
|
|
56
58
|
declare function getScreenshotName(name: string, options?: {
|
|
57
59
|
viewportWidth?: number;
|
|
58
60
|
}): string;
|
|
59
|
-
|
|
61
|
+
/**
|
|
62
|
+
* Get playwright trace from screenshot path.
|
|
63
|
+
* If not found, returns null.
|
|
64
|
+
*/
|
|
65
|
+
declare function getPlaywrightTracePath(screenshotPath: string): Promise<string | null>;
|
|
66
|
+
export { getGitRepositoryPath, readVersionFromPackage, ScreenshotMetadata, getMetadataPath, writeMetadata, readMetadata, getScreenshotName, getPlaywrightTracePath };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { exec } from 'node:child_process';
|
|
2
|
-
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { readFile, writeFile, access } from 'node:fs/promises';
|
|
3
3
|
|
|
4
4
|
let cached;
|
|
5
5
|
/**
|
|
@@ -85,4 +85,22 @@ const versionCache = new Map();
|
|
|
85
85
|
return parts.join(" ");
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
|
|
88
|
+
/**
|
|
89
|
+
* Get trace path from screenshot path.
|
|
90
|
+
*/ function getTracePath(screenshotPath) {
|
|
91
|
+
return screenshotPath + ".pw-trace.zip";
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Get playwright trace from screenshot path.
|
|
95
|
+
* If not found, returns null.
|
|
96
|
+
*/ async function getPlaywrightTracePath(screenshotPath) {
|
|
97
|
+
try {
|
|
98
|
+
const tracePath = getTracePath(screenshotPath);
|
|
99
|
+
await access(tracePath);
|
|
100
|
+
return tracePath;
|
|
101
|
+
} catch {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export { getGitRepositoryPath, getMetadataPath, getPlaywrightTracePath, getScreenshotName, readMetadata, readVersionFromPackage, writeMetadata };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/util",
|
|
3
3
|
"description": "Set of utilities used across all Argos SDKs",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.1.0",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@types/node": "^16.0.0"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "47a939474ca0c0d55ca5360dcaa5f8912547ed76"
|
|
40
40
|
}
|