@argos-ci/util 4.2.1 → 4.2.3
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.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { type ScreenshotMetadata, clearCaptureIndex, getMetadataPath, getScreenshotName, getTestRunKey, nextCaptureIndex, normalizeBaseNames, resetCaptureIndexes, validateThreshold };
|
|
1
|
+
import { a as clearCaptureIndex, c as resetCaptureIndexes, d as getMetadataPath, i as getScreenshotName, l as normalizeBaseNames, n as hasPlay, o as getTestRunKey, r as mergeTags, s as nextCaptureIndex, t as validateThreshold, u as ScreenshotMetadata } from "./threshold-7lU01Zbd.mjs";
|
|
2
|
+
export { type ScreenshotMetadata, clearCaptureIndex, getMetadataPath, getScreenshotName, getTestRunKey, hasPlay, mergeTags, nextCaptureIndex, normalizeBaseNames, resetCaptureIndexes, validateThreshold };
|
package/dist/browser.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
export { clearCaptureIndex, getMetadataPath, getScreenshotName, getTestRunKey, nextCaptureIndex, normalizeBaseNames, resetCaptureIndexes, validateThreshold };
|
|
1
|
+
import { a as getMetadataPath, c as nextCaptureIndex, i as getScreenshotName, l as resetCaptureIndexes, n as hasPlay, o as clearCaptureIndex, r as mergeTags, s as getTestRunKey, t as validateThreshold, u as normalizeBaseNames } from "./threshold-CW8P4JMe.mjs";
|
|
2
|
+
export { clearCaptureIndex, getMetadataPath, getScreenshotName, getTestRunKey, hasPlay, mergeTags, nextCaptureIndex, normalizeBaseNames, resetCaptureIndexes, validateThreshold };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as clearCaptureIndex, c as resetCaptureIndexes, d as getMetadataPath, i as getScreenshotName, l as normalizeBaseNames, n as hasPlay, o as getTestRunKey, r as mergeTags, s as nextCaptureIndex, t as validateThreshold, u as ScreenshotMetadata } from "./threshold-7lU01Zbd.mjs";
|
|
2
2
|
//#region src/fs.d.ts
|
|
3
3
|
/**
|
|
4
4
|
* Create a directory if it doesn't exist.
|
|
@@ -39,4 +39,4 @@ export declare function readMetadata(screenshotPath: string): Promise<Screenshot
|
|
|
39
39
|
*/
|
|
40
40
|
export declare function getPlaywrightTracePath(screenshotPath: string): Promise<string | null>;
|
|
41
41
|
//#endregion
|
|
42
|
-
export { ScreenshotMetadata, clearCaptureIndex, getMetadataPath, getScreenshotName, getTestRunKey, nextCaptureIndex, normalizeBaseNames, resetCaptureIndexes, validateThreshold };
|
|
42
|
+
export { ScreenshotMetadata, clearCaptureIndex, getMetadataPath, getScreenshotName, getTestRunKey, hasPlay, mergeTags, nextCaptureIndex, normalizeBaseNames, resetCaptureIndexes, validateThreshold };
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as getMetadataPath, c as nextCaptureIndex, i as getScreenshotName, l as resetCaptureIndexes, n as hasPlay, o as clearCaptureIndex, r as mergeTags, s as getTestRunKey, t as validateThreshold, u as normalizeBaseNames } from "./threshold-CW8P4JMe.mjs";
|
|
2
2
|
import { randomBytes } from "node:crypto";
|
|
3
3
|
import { access, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
4
4
|
import { tmpdir } from "node:os";
|
|
@@ -101,4 +101,4 @@ async function getPlaywrightTracePath(screenshotPath) {
|
|
|
101
101
|
}
|
|
102
102
|
}
|
|
103
103
|
//#endregion
|
|
104
|
-
export { clearCaptureIndex, createDirectory, createTemporaryDirectory, getGitRepositoryPath, getMetadataPath, getPlaywrightTracePath, getScreenshotName, getTestRunKey, nextCaptureIndex, normalizeBaseNames, readMetadata, readVersionFromPackage, resetCaptureIndexes, validateThreshold, writeMetadata };
|
|
104
|
+
export { clearCaptureIndex, createDirectory, createTemporaryDirectory, getGitRepositoryPath, getMetadataPath, getPlaywrightTracePath, getScreenshotName, getTestRunKey, hasPlay, mergeTags, nextCaptureIndex, normalizeBaseNames, readMetadata, readVersionFromPackage, resetCaptureIndexes, validateThreshold, writeMetadata };
|
|
@@ -151,10 +151,23 @@ declare function getScreenshotName(name: string, options?: {
|
|
|
151
151
|
viewportWidth?: number;
|
|
152
152
|
}): string;
|
|
153
153
|
//#endregion
|
|
154
|
+
//#region src/story.d.ts
|
|
155
|
+
/**
|
|
156
|
+
* Merge the tags of a story given by several sources (the story, its
|
|
157
|
+
* parameters…), deduplicated and without empty values.
|
|
158
|
+
*/
|
|
159
|
+
declare function mergeTags(...tags: unknown[]): string[];
|
|
160
|
+
/**
|
|
161
|
+
* Return whether a story has a play function.
|
|
162
|
+
* Handles the `play` field of a composed story (itself a function) and the
|
|
163
|
+
* `playFunction` field of a story context.
|
|
164
|
+
*/
|
|
165
|
+
declare function hasPlay(story: unknown): boolean;
|
|
166
|
+
//#endregion
|
|
154
167
|
//#region src/threshold.d.ts
|
|
155
168
|
/**
|
|
156
169
|
* Validates the threshold value.
|
|
157
170
|
*/
|
|
158
171
|
declare function validateThreshold(threshold: number): void;
|
|
159
172
|
//#endregion
|
|
160
|
-
export {
|
|
173
|
+
export { clearCaptureIndex as a, resetCaptureIndexes as c, getMetadataPath as d, getScreenshotName as i, normalizeBaseNames as l, hasPlay as n, getTestRunKey as o, mergeTags as r, nextCaptureIndex as s, validateThreshold as t, ScreenshotMetadata as u };
|
|
@@ -86,6 +86,25 @@ function sanitizeFilename(name) {
|
|
|
86
86
|
return sanitized;
|
|
87
87
|
}
|
|
88
88
|
//#endregion
|
|
89
|
+
//#region src/story.ts
|
|
90
|
+
/**
|
|
91
|
+
* Merge the tags of a story given by several sources (the story, its
|
|
92
|
+
* parameters…), deduplicated and without empty values.
|
|
93
|
+
*/
|
|
94
|
+
function mergeTags(...tags) {
|
|
95
|
+
const merged = tags.flatMap((tag) => Array.isArray(tag) ? tag : tag ? [tag] : []);
|
|
96
|
+
return Array.from(new Set(merged)).filter((tag) => typeof tag === "string" && tag !== "");
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Return whether a story has a play function.
|
|
100
|
+
* Handles the `play` field of a composed story (itself a function) and the
|
|
101
|
+
* `playFunction` field of a story context.
|
|
102
|
+
*/
|
|
103
|
+
function hasPlay(story) {
|
|
104
|
+
if (!story || typeof story !== "object" && typeof story !== "function") return false;
|
|
105
|
+
return "play" in story && typeof story.play === "function" || "playFunction" in story && typeof story.playFunction === "function";
|
|
106
|
+
}
|
|
107
|
+
//#endregion
|
|
89
108
|
//#region src/threshold.ts
|
|
90
109
|
/**
|
|
91
110
|
* Validates the threshold value.
|
|
@@ -94,4 +113,4 @@ function validateThreshold(threshold) {
|
|
|
94
113
|
if (threshold < 0 || threshold > 1) throw new Error("The threshold must be between 0 and 1.");
|
|
95
114
|
}
|
|
96
115
|
//#endregion
|
|
97
|
-
export {
|
|
116
|
+
export { getMetadataPath as a, nextCaptureIndex as c, getScreenshotName as i, resetCaptureIndexes as l, hasPlay as n, clearCaptureIndex as o, mergeTags as r, getTestRunKey as s, validateThreshold as t, normalizeBaseNames as u };
|
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": "4.2.
|
|
4
|
+
"version": "4.2.3",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
"url": "https://github.com/argos-ci/argos-javascript/issues"
|
|
15
15
|
},
|
|
16
16
|
"keywords": [
|
|
17
|
-
"
|
|
18
|
-
"argos"
|
|
17
|
+
"argos",
|
|
18
|
+
"argos-ci",
|
|
19
|
+
"utilities"
|
|
19
20
|
],
|
|
20
21
|
"publishConfig": {
|
|
21
22
|
"access": "public"
|
|
@@ -48,5 +49,5 @@
|
|
|
48
49
|
"@types/node": "catalog:",
|
|
49
50
|
"vitest": "catalog:"
|
|
50
51
|
},
|
|
51
|
-
"gitHead": "
|
|
52
|
+
"gitHead": "810aab42c890851ea19ba96f49c4f167a5f2e3df"
|
|
52
53
|
}
|