@argos-ci/util 3.1.2-alpha.4 → 3.2.1-alpha.19
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 +6 -2
- package/dist/browser.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
- package/dist/chunk-CBWOZNU5.js +0 -41
- package/dist/chunk-SBIRPBRC.js +0 -26
- package/dist/chunk-VMM7XHBS.js +0 -26
package/dist/browser.d.ts
CHANGED
|
@@ -73,14 +73,18 @@ type ScreenshotMetadata = {
|
|
|
73
73
|
version: string;
|
|
74
74
|
};
|
|
75
75
|
transient?: {
|
|
76
|
+
/** Threshold configured for this screenshot. */
|
|
76
77
|
threshold?: number;
|
|
78
|
+
/** Override the name to find the comparison baseline. */
|
|
77
79
|
baseName?: string;
|
|
80
|
+
/** Name of the parent screenshot. */
|
|
81
|
+
parentName?: string;
|
|
78
82
|
};
|
|
79
83
|
};
|
|
80
84
|
/**
|
|
81
|
-
* Get metadata path from
|
|
85
|
+
* Get metadata path from snapshot path.
|
|
82
86
|
*/
|
|
83
|
-
declare function getMetadataPath(
|
|
87
|
+
declare function getMetadataPath(snapshotPath: string): string;
|
|
84
88
|
|
|
85
89
|
/**
|
|
86
90
|
* Build a screenshot name from a test name and options.
|
package/dist/browser.js
CHANGED
package/dist/index.js
CHANGED
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": "3.1
|
|
4
|
+
"version": "3.2.1-alpha.19+4a513df",
|
|
5
5
|
"author": "Smooth Code",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -47,5 +47,5 @@
|
|
|
47
47
|
"@types/node": "catalog:",
|
|
48
48
|
"vitest": "catalog:"
|
|
49
49
|
},
|
|
50
|
-
"gitHead": "
|
|
50
|
+
"gitHead": "4a513dfc1b959dc5fb000ffb77d122c3096bf481"
|
|
51
51
|
}
|
package/dist/chunk-CBWOZNU5.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// src/metadata.ts
|
|
2
|
-
function getMetadataPath(screenshotPath) {
|
|
3
|
-
return screenshotPath + ".argos.json";
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// src/name.ts
|
|
7
|
-
function getScreenshotName(name, options = {}) {
|
|
8
|
-
return sanitizePath(
|
|
9
|
-
`${name}${options.viewportWidth ? ` vw-${options.viewportWidth}` : ""}`
|
|
10
|
-
);
|
|
11
|
-
}
|
|
12
|
-
function sanitizePath(name) {
|
|
13
|
-
return name.split("/").map((filename) => sanitizeFilename(filename)).join("/");
|
|
14
|
-
}
|
|
15
|
-
function filenameReservedRegex() {
|
|
16
|
-
return /[<>:"/\\|?*\u0000-\u001F]|[. ]$/g;
|
|
17
|
-
}
|
|
18
|
-
function windowsReservedNameRegex() {
|
|
19
|
-
return /^(con|prn|aux|nul|com\d|lpt\d)$/i;
|
|
20
|
-
}
|
|
21
|
-
function sanitizeFilename(name) {
|
|
22
|
-
const replacement = "-";
|
|
23
|
-
const sanitized = name.replace(filenameReservedRegex(), replacement);
|
|
24
|
-
if (windowsReservedNameRegex().test(sanitized)) {
|
|
25
|
-
return `${sanitized}${replacement}`;
|
|
26
|
-
}
|
|
27
|
-
return sanitized;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
// src/threshold.ts
|
|
31
|
-
function validateThreshold(threshold) {
|
|
32
|
-
if (threshold < 0 || threshold > 1) {
|
|
33
|
-
throw new Error("The threshold must be between 0 and 1.");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export {
|
|
38
|
-
getMetadataPath,
|
|
39
|
-
getScreenshotName,
|
|
40
|
-
validateThreshold
|
|
41
|
-
};
|
package/dist/chunk-SBIRPBRC.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/metadata.ts
|
|
2
|
-
function getMetadataPath(screenshotPath) {
|
|
3
|
-
return screenshotPath + ".argos.json";
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// src/name.ts
|
|
7
|
-
function getScreenshotName(name, options = {}) {
|
|
8
|
-
let parts = [name];
|
|
9
|
-
if (options.viewportWidth) {
|
|
10
|
-
parts.push(`vw-${options.viewportWidth}`);
|
|
11
|
-
}
|
|
12
|
-
return parts.join(" ");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// src/threshold.ts
|
|
16
|
-
function validateThreshold(threshold) {
|
|
17
|
-
if (threshold < 0 || threshold > 1) {
|
|
18
|
-
throw new Error("The threshold must be between 0 and 1.");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
getMetadataPath,
|
|
24
|
-
getScreenshotName,
|
|
25
|
-
validateThreshold
|
|
26
|
-
};
|
package/dist/chunk-VMM7XHBS.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
// src/metadata.ts
|
|
2
|
-
function getMetadataPath(screenshotPath) {
|
|
3
|
-
return screenshotPath + ".argos.json";
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// src/name.ts
|
|
7
|
-
function getScreenshotName(name, options = {}) {
|
|
8
|
-
const parts = [name];
|
|
9
|
-
if (options.viewportWidth) {
|
|
10
|
-
parts.push(`vw-${options.viewportWidth}`);
|
|
11
|
-
}
|
|
12
|
-
return parts.join(" ");
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// src/threshold.ts
|
|
16
|
-
function validateThreshold(threshold) {
|
|
17
|
-
if (threshold < 0 || threshold > 1) {
|
|
18
|
-
throw new Error("The threshold must be between 0 and 1.");
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
getMetadataPath,
|
|
24
|
-
getScreenshotName,
|
|
25
|
-
validateThreshold
|
|
26
|
-
};
|