@argos-ci/core 2.3.0 → 2.4.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/index.d.ts +9 -0
- package/dist/index.mjs +27 -1
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,12 @@ interface UploadParameters {
|
|
|
32
32
|
referenceBranch?: string;
|
|
33
33
|
/** Commit used as baseline for screenshot comparison */
|
|
34
34
|
referenceCommit?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Sensitivity threshold between 0 and 1.
|
|
37
|
+
* The higher the threshold, the less sensitive the diff will be.
|
|
38
|
+
* @default 0.5
|
|
39
|
+
*/
|
|
40
|
+
threshold?: number;
|
|
35
41
|
}
|
|
36
42
|
/**
|
|
37
43
|
* Upload screenshots to argos-ci.com.
|
|
@@ -45,6 +51,8 @@ declare function upload(params: UploadParameters): Promise<{
|
|
|
45
51
|
hash: string;
|
|
46
52
|
optimizedPath: string;
|
|
47
53
|
metadata: import("@argos-ci/util").ScreenshotMetadata | null;
|
|
54
|
+
threshold: number | null;
|
|
55
|
+
baseName: string | null;
|
|
48
56
|
pwTrace: {
|
|
49
57
|
path: string;
|
|
50
58
|
hash: string;
|
|
@@ -74,6 +82,7 @@ interface Config {
|
|
|
74
82
|
prHeadCommit: string | null;
|
|
75
83
|
mode: "ci" | "monitoring" | null;
|
|
76
84
|
ciProvider: string | null;
|
|
85
|
+
threshold: number | null;
|
|
77
86
|
}
|
|
78
87
|
declare function readConfig(options?: Partial<Config>): Promise<Config>;
|
|
79
88
|
export { UploadParameters, upload, Config, readConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -408,6 +408,17 @@ const mustBeArgosToken = (value)=>{
|
|
|
408
408
|
throw new Error("Invalid Argos repository token (must be 40 characters)");
|
|
409
409
|
}
|
|
410
410
|
};
|
|
411
|
+
convict.addFormat({
|
|
412
|
+
name: "float-percent",
|
|
413
|
+
validate: function(val) {
|
|
414
|
+
if (val !== 0 && (!val || val > 1 || val < 0)) {
|
|
415
|
+
throw new Error("Must be a float between 0 and 1, inclusive.");
|
|
416
|
+
}
|
|
417
|
+
},
|
|
418
|
+
coerce: function(val) {
|
|
419
|
+
return parseFloat(val);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
411
422
|
const schema = {
|
|
412
423
|
apiBaseUrl: {
|
|
413
424
|
env: "ARGOS_API_BASE_URL",
|
|
@@ -520,6 +531,12 @@ const schema = {
|
|
|
520
531
|
format: String,
|
|
521
532
|
default: null,
|
|
522
533
|
nullable: true
|
|
534
|
+
},
|
|
535
|
+
threshold: {
|
|
536
|
+
env: "ARGOS_THRESHOLD",
|
|
537
|
+
format: "float-percent",
|
|
538
|
+
default: null,
|
|
539
|
+
nullable: true
|
|
523
540
|
}
|
|
524
541
|
};
|
|
525
542
|
const createConfig = ()=>{
|
|
@@ -775,11 +792,18 @@ async function uploadFilesToS3(files) {
|
|
|
775
792
|
hashFile(optimizedPath),
|
|
776
793
|
pwTracePath ? hashFile(pwTracePath) : null
|
|
777
794
|
]);
|
|
795
|
+
const threshold = metadata?.transient?.threshold ?? null;
|
|
796
|
+
const baseName = metadata?.transient?.baseName ?? null;
|
|
797
|
+
if (metadata) {
|
|
798
|
+
delete metadata.transient;
|
|
799
|
+
}
|
|
778
800
|
return {
|
|
779
801
|
...screenshot,
|
|
780
802
|
hash,
|
|
781
803
|
optimizedPath,
|
|
782
804
|
metadata,
|
|
805
|
+
threshold,
|
|
806
|
+
baseName,
|
|
783
807
|
pwTrace: pwTracePath && pwTraceHash ? {
|
|
784
808
|
path: pwTracePath,
|
|
785
809
|
hash: pwTraceHash
|
|
@@ -855,7 +879,9 @@ async function uploadFilesToS3(files) {
|
|
|
855
879
|
key: screenshot.hash,
|
|
856
880
|
name: screenshot.name,
|
|
857
881
|
metadata: screenshot.metadata,
|
|
858
|
-
pwTraceKey: screenshot.pwTrace?.hash ?? null
|
|
882
|
+
pwTraceKey: screenshot.pwTrace?.hash ?? null,
|
|
883
|
+
threshold: screenshot.threshold ?? config?.threshold ?? null,
|
|
884
|
+
baseName: screenshot.baseName
|
|
859
885
|
})),
|
|
860
886
|
parallel: config.parallel,
|
|
861
887
|
parallelTotal: config.parallelTotal,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/core",
|
|
3
3
|
"description": "Visual testing solution to avoid visual regression. The core component of Argos SDK that handles build creation.",
|
|
4
|
-
"version": "2.
|
|
4
|
+
"version": "2.4.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"access": "public"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@argos-ci/util": "2.
|
|
43
|
+
"@argos-ci/util": "2.1.0",
|
|
44
44
|
"axios": "^1.6.8",
|
|
45
45
|
"convict": "^6.2.4",
|
|
46
46
|
"debug": "^4.3.4",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"build": "rollup -c",
|
|
60
60
|
"e2e": "node ./e2e/upload.cjs && node ./e2e/upload.mjs"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "aca82cf842a6d8310611a8594c581794df85cbd8"
|
|
63
63
|
}
|