@argos-ci/util 3.0.0 → 3.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/browser.d.ts +17 -1
- package/dist/browser.js +1 -1
- package/dist/chunk-CBWOZNU5.js +41 -0
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/browser.d.ts
CHANGED
|
@@ -28,13 +28,29 @@ type ScreenshotMetadata = {
|
|
|
28
28
|
repeat?: number | null;
|
|
29
29
|
/** @description The location of the test in the source code */
|
|
30
30
|
location?: {
|
|
31
|
-
/** @description The file
|
|
31
|
+
/** @description The located file */
|
|
32
32
|
file: string;
|
|
33
33
|
/** @description The line number in the file */
|
|
34
34
|
line: number;
|
|
35
35
|
/** @description The column number in the file */
|
|
36
36
|
column: number;
|
|
37
37
|
};
|
|
38
|
+
/** @description Annotations associated to the test */
|
|
39
|
+
annotations?: {
|
|
40
|
+
/** @description The type of annotation */
|
|
41
|
+
type: string;
|
|
42
|
+
/** @description The description of the annotation */
|
|
43
|
+
description?: string;
|
|
44
|
+
/** @description The location of the annotation in the source code */
|
|
45
|
+
location?: {
|
|
46
|
+
/** @description The located file */
|
|
47
|
+
file: string;
|
|
48
|
+
/** @description The line number in the file */
|
|
49
|
+
line: number;
|
|
50
|
+
/** @description The column number in the file */
|
|
51
|
+
column: number;
|
|
52
|
+
};
|
|
53
|
+
}[];
|
|
38
54
|
} | null) | null;
|
|
39
55
|
browser?: {
|
|
40
56
|
/** @description The name of the browser */
|
package/dist/browser.js
CHANGED
|
@@ -0,0 +1,41 @@
|
|
|
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/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.
|
|
4
|
+
"version": "3.1.1",
|
|
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": "867a93c5ffc01d55c7385d3ac3903c4c3ab270b6"
|
|
51
51
|
}
|