@argos-ci/util 4.1.0 → 4.1.1-alpha.11.sha-4c8577c

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.
@@ -1,2 +1,2 @@
1
- import { a as getMetadataPath, i as ScreenshotMetadata, n as getScreenshotName, r as normalizeBaseNames, t as validateThreshold } from "./threshold-BbcFeciF.mjs";
1
+ import { a as getMetadataPath, i as ScreenshotMetadata, n as getScreenshotName, r as normalizeBaseNames, t as validateThreshold } from "./threshold-CTL5d5N7.mjs";
2
2
  export { type ScreenshotMetadata, getMetadataPath, getScreenshotName, normalizeBaseNames, validateThreshold };
package/dist/index.d.mts CHANGED
@@ -1,5 +1,4 @@
1
- import { a as getMetadataPath, i as ScreenshotMetadata, n as getScreenshotName, r as normalizeBaseNames, t as validateThreshold } from "./threshold-BbcFeciF.mjs";
2
-
1
+ import { a as getMetadataPath, i as ScreenshotMetadata, n as getScreenshotName, r as normalizeBaseNames, t as validateThreshold } from "./threshold-CTL5d5N7.mjs";
3
2
  //#region src/fs.d.ts
4
3
  /**
5
4
  * Create a directory if it doesn't exist.
package/dist/index.mjs CHANGED
@@ -20,7 +20,8 @@ async function createDirectory(pathname) {
20
20
  * Create temporary directory.
21
21
  */
22
22
  async function createTemporaryDirectory() {
23
- const path = join(tmpdir(), "argos." + randomBytes(16).toString("hex"));
23
+ const osTmpDirectory = tmpdir();
24
+ const path = join(osTmpDirectory, "argos." + randomBytes(16).toString("hex"));
24
25
  await createDirectory(path);
25
26
  return path;
26
27
  }
@@ -0,0 +1,129 @@
1
+ //#region src/metadata.d.ts
2
+ type ScreenshotMetadata = {
3
+ /** @description The URL of the page that was screenshotted */
4
+ url?: string | null;
5
+ /** @description An URL to an accessible preview of the screenshot */
6
+ previewUrl?: string | null;
7
+ viewport?: {
8
+ /** @description The width of the viewport */
9
+ width: number;
10
+ /** @description The height of the viewport */
11
+ height: number;
12
+ } | null;
13
+ /** @description The color scheme when the screenshot was taken */
14
+ colorScheme?: ("light" | "dark") | null;
15
+ /** @description The media type when the screenshot was taken */
16
+ mediaType?: ("screen" | "print") | null;
17
+ /** @description Tags associated with the screenshot */
18
+ tags?: string[];
19
+ test?: ({
20
+ /** @description The unique identifier of the test */
21
+ id?: string | null;
22
+ /** @description The title of the test */
23
+ title: string;
24
+ /** @description The path of titles leading to the test */
25
+ titlePath: string[];
26
+ /** @description Tags associated with the test */
27
+ tags?: string[];
28
+ /** @description The number of retries for the test */
29
+ retries?: number | null;
30
+ /** @description The current retry count */
31
+ retry?: number | null;
32
+ /** @description The repeat count for the test */
33
+ repeat?: number | null;
34
+ /** @description The location of the test in the source code */
35
+ location?: {
36
+ /** @description The located file */
37
+ file: string;
38
+ /** @description The line number in the file */
39
+ line: number;
40
+ /** @description The column number in the file */
41
+ column: number;
42
+ };
43
+ /** @description Annotations associated to the test */
44
+ annotations?: {
45
+ /** @description The type of annotation */
46
+ type: string;
47
+ /** @description The description of the annotation */
48
+ description?: string;
49
+ /** @description The location of the annotation in the source code */
50
+ location?: {
51
+ /** @description The located file */
52
+ file: string;
53
+ /** @description The line number in the file */
54
+ line: number;
55
+ /** @description The column number in the file */
56
+ column: number;
57
+ };
58
+ }[];
59
+ } | null) | null;
60
+ story?: {
61
+ /** @description Unique ID of the story */
62
+ id: string;
63
+ /** @description Tags attached to the story */
64
+ tags: string[];
65
+ /** @description Story mode */
66
+ mode?: string;
67
+ /** @description True if the story has a play function */
68
+ play?: boolean;
69
+ };
70
+ browser?: {
71
+ /** @description The name of the browser */
72
+ name: string;
73
+ /** @description The version of the browser */
74
+ version: string;
75
+ } | null;
76
+ /** @description The automation library that generated the screenshot */
77
+ automationLibrary: {
78
+ /** @description The name of the automation library */
79
+ name: string;
80
+ /** @description The version of the automation library */
81
+ version: string;
82
+ };
83
+ /** @description The Argos SDK that generated the screenshot */
84
+ sdk: {
85
+ /** @description The name of the Argos SDK */
86
+ name: string;
87
+ /** @description The version of the Argos SDK */
88
+ version: string;
89
+ };
90
+ transient?: {
91
+ /** Threshold configured for this screenshot. */
92
+ threshold?: number;
93
+ /**
94
+ * Name(s) used to find the comparison baseline, instead of the snapshot's
95
+ * own name. Several names are tried in order: the first one that exists in
96
+ * the baseline wins.
97
+ */
98
+ baseName?: string | string[];
99
+ /** Name of the parent screenshot. */
100
+ parentName?: string;
101
+ };
102
+ };
103
+ /**
104
+ * Get metadata path from snapshot path.
105
+ */
106
+ declare function getMetadataPath(snapshotPath: string): string;
107
+ //#endregion
108
+ //#region src/base-name.d.ts
109
+ /**
110
+ * Normalize the user-facing `baseName` option — a single name or an ordered
111
+ * list of candidates — into a list, or `null` when nothing was provided.
112
+ */
113
+ declare function normalizeBaseNames(baseName: string | string[] | undefined | null): string[] | null;
114
+ //#endregion
115
+ //#region src/name.d.ts
116
+ /**
117
+ * Build a screenshot name from a test name and options.
118
+ */
119
+ declare function getScreenshotName(name: string, options?: {
120
+ viewportWidth?: number;
121
+ }): string;
122
+ //#endregion
123
+ //#region src/threshold.d.ts
124
+ /**
125
+ * Validates the threshold value.
126
+ */
127
+ declare function validateThreshold(threshold: number): void;
128
+ //#endregion
129
+ export { getMetadataPath as a, ScreenshotMetadata as i, getScreenshotName as n, normalizeBaseNames as r, validateThreshold as t };
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.1.0",
4
+ "version": "4.1.1-alpha.11.sha-4c8577c",
5
5
  "author": "Smooth Code",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -48,5 +48,5 @@
48
48
  "@types/node": "catalog:",
49
49
  "vitest": "catalog:"
50
50
  },
51
- "gitHead": "a3083087b11004e0b315e2d14f1e9179cbd56da2"
51
+ "gitHead": "4c8577c08ff1d9681c5b951dc73665cc8b7955c8"
52
52
  }
@@ -1,90 +0,0 @@
1
- //#region src/metadata.d.ts
2
- type ScreenshotMetadata = {
3
- /** @description The URL of the page that was screenshotted */url?: string | null; /** @description An URL to an accessible preview of the screenshot */
4
- previewUrl?: string | null;
5
- viewport?: {
6
- /** @description The width of the viewport */width: number; /** @description The height of the viewport */
7
- height: number;
8
- } | null; /** @description The color scheme when the screenshot was taken */
9
- colorScheme?: ("light" | "dark") | null; /** @description The media type when the screenshot was taken */
10
- mediaType?: ("screen" | "print") | null; /** @description Tags associated with the screenshot */
11
- tags?: string[];
12
- test?: ({
13
- /** @description The unique identifier of the test */id?: string | null; /** @description The title of the test */
14
- title: string; /** @description The path of titles leading to the test */
15
- titlePath: string[]; /** @description Tags associated with the test */
16
- tags?: string[]; /** @description The number of retries for the test */
17
- retries?: number | null; /** @description The current retry count */
18
- retry?: number | null; /** @description The repeat count for the test */
19
- repeat?: number | null; /** @description The location of the test in the source code */
20
- location?: {
21
- /** @description The located file */file: string; /** @description The line number in the file */
22
- line: number; /** @description The column number in the file */
23
- column: number;
24
- }; /** @description Annotations associated to the test */
25
- annotations?: {
26
- /** @description The type of annotation */type: string; /** @description The description of the annotation */
27
- description?: string; /** @description The location of the annotation in the source code */
28
- location?: {
29
- /** @description The located file */file: string; /** @description The line number in the file */
30
- line: number; /** @description The column number in the file */
31
- column: number;
32
- };
33
- }[];
34
- } | null) | null;
35
- story?: {
36
- /** @description Unique ID of the story */id: string; /** @description Tags attached to the story */
37
- tags: string[]; /** @description Story mode */
38
- mode?: string; /** @description True if the story has a play function */
39
- play?: boolean;
40
- };
41
- browser?: {
42
- /** @description The name of the browser */name: string; /** @description The version of the browser */
43
- version: string;
44
- } | null; /** @description The automation library that generated the screenshot */
45
- automationLibrary: {
46
- /** @description The name of the automation library */name: string; /** @description The version of the automation library */
47
- version: string;
48
- }; /** @description The Argos SDK that generated the screenshot */
49
- sdk: {
50
- /** @description The name of the Argos SDK */name: string; /** @description The version of the Argos SDK */
51
- version: string;
52
- };
53
- transient?: {
54
- /** Threshold configured for this screenshot. */threshold?: number;
55
- /**
56
- * Name(s) used to find the comparison baseline, instead of the snapshot's
57
- * own name. Several names are tried in order: the first one that exists in
58
- * the baseline wins.
59
- */
60
- baseName?: string | string[]; /** Name of the parent screenshot. */
61
- parentName?: string;
62
- };
63
- };
64
- /**
65
- * Get metadata path from snapshot path.
66
- */
67
- declare function getMetadataPath(snapshotPath: string): string;
68
- //#endregion
69
- //#region src/base-name.d.ts
70
- /**
71
- * Normalize the user-facing `baseName` option — a single name or an ordered
72
- * list of candidates — into a list, or `null` when nothing was provided.
73
- */
74
- declare function normalizeBaseNames(baseName: string | string[] | undefined | null): string[] | null;
75
- //#endregion
76
- //#region src/name.d.ts
77
- /**
78
- * Build a screenshot name from a test name and options.
79
- */
80
- declare function getScreenshotName(name: string, options?: {
81
- viewportWidth?: number;
82
- }): string;
83
- //#endregion
84
- //#region src/threshold.d.ts
85
- /**
86
- * Validates the threshold value.
87
- */
88
- declare function validateThreshold(threshold: number): void;
89
- //#endregion
90
- export { getMetadataPath as a, ScreenshotMetadata as i, getScreenshotName as n, normalizeBaseNames as r, validateThreshold as t };