@argos-ci/util 1.0.0 → 1.2.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 CHANGED
@@ -10,6 +10,8 @@ type ScreenshotMetadata = {
10
10
  id?: string;
11
11
  title: string;
12
12
  titlePath: string[];
13
+ retries?: number;
14
+ retry?: number;
13
15
  location?: {
14
16
  file: string;
15
17
  line: number;
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
- export { getGitRepositoryPath, readVersionFromPackage, ScreenshotMetadata, getMetadataPath, writeMetadata, readMetadata, getScreenshotName };
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
- export { getGitRepositoryPath, getMetadataPath, getScreenshotName, readMetadata, readVersionFromPackage, writeMetadata };
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.0.0",
4
+ "version": "1.2.0",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -15,13 +15,13 @@
15
15
  "type": "module",
16
16
  "exports": {
17
17
  ".": {
18
- "import": "./dist/index.mjs",
19
18
  "types": "./dist/index.d.ts",
19
+ "import": "./dist/index.mjs",
20
20
  "default": "./dist/index.mjs"
21
21
  },
22
22
  "./browser": {
23
- "import": "./dist/browser.mjs",
24
23
  "types": "./dist/browser.d.ts",
24
+ "import": "./dist/browser.mjs",
25
25
  "default": "./dist/browser.mjs"
26
26
  },
27
27
  "./package.json": "./package.json"
@@ -36,5 +36,5 @@
36
36
  "devDependencies": {
37
37
  "@types/node": "^16.0.0"
38
38
  },
39
- "gitHead": "f864cced9e48669efab2a35fde612570600b94a7"
39
+ "gitHead": "ac02d37ca89f73359fba70cfe9b579396c3260d8"
40
40
  }