@argos-ci/core 4.1.1 → 4.1.2
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.js +31 -13
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -587,25 +587,43 @@ var mustBeArgosToken = (value) => {
|
|
|
587
587
|
throw new Error("Invalid Argos repository token (must be 40 characters)");
|
|
588
588
|
}
|
|
589
589
|
};
|
|
590
|
-
var
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
throw new Error("must be a number");
|
|
590
|
+
var minInteger = (min) => (value) => {
|
|
591
|
+
if (!Number.isInteger(value)) {
|
|
592
|
+
throw new Error("must be an integer");
|
|
594
593
|
}
|
|
595
|
-
if (
|
|
594
|
+
if (value < min) {
|
|
596
595
|
throw new Error(`must be at least ${min}`);
|
|
597
596
|
}
|
|
598
597
|
};
|
|
598
|
+
var toInt = (value) => {
|
|
599
|
+
if (value === "") {
|
|
600
|
+
return null;
|
|
601
|
+
}
|
|
602
|
+
const num = Number(value);
|
|
603
|
+
if (!Number.isInteger(num) || Number.isNaN(num)) {
|
|
604
|
+
return num;
|
|
605
|
+
}
|
|
606
|
+
return num;
|
|
607
|
+
};
|
|
608
|
+
var toFloat = (value) => parseFloat(value);
|
|
609
|
+
convict.addFormat({
|
|
610
|
+
name: "parallel-total",
|
|
611
|
+
validate: minInteger(-1),
|
|
612
|
+
coerce: toInt
|
|
613
|
+
});
|
|
614
|
+
convict.addFormat({
|
|
615
|
+
name: "parallel-index",
|
|
616
|
+
validate: minInteger(1),
|
|
617
|
+
coerce: toInt
|
|
618
|
+
});
|
|
599
619
|
convict.addFormat({
|
|
600
620
|
name: "float-percent",
|
|
601
|
-
validate:
|
|
621
|
+
validate: (val) => {
|
|
602
622
|
if (val !== 0 && (!val || val > 1 || val < 0)) {
|
|
603
623
|
throw new Error("Must be a float between 0 and 1, inclusive.");
|
|
604
624
|
}
|
|
605
625
|
},
|
|
606
|
-
coerce:
|
|
607
|
-
return parseFloat(val);
|
|
608
|
-
}
|
|
626
|
+
coerce: toFloat
|
|
609
627
|
});
|
|
610
628
|
var schema = {
|
|
611
629
|
apiBaseUrl: {
|
|
@@ -671,15 +689,15 @@ var schema = {
|
|
|
671
689
|
},
|
|
672
690
|
parallelIndex: {
|
|
673
691
|
env: "ARGOS_PARALLEL_INDEX",
|
|
692
|
+
format: "parallel-index",
|
|
674
693
|
default: null,
|
|
675
|
-
nullable: true
|
|
676
|
-
format: (value) => minNumber(value, 1)
|
|
694
|
+
nullable: true
|
|
677
695
|
},
|
|
678
696
|
parallelTotal: {
|
|
679
697
|
env: "ARGOS_PARALLEL_TOTAL",
|
|
698
|
+
format: "parallel-total",
|
|
680
699
|
default: null,
|
|
681
|
-
nullable: true
|
|
682
|
-
format: (value) => minNumber(value, -1)
|
|
700
|
+
nullable: true
|
|
683
701
|
},
|
|
684
702
|
referenceBranch: {
|
|
685
703
|
env: "ARGOS_REFERENCE_BRANCH",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@argos-ci/core",
|
|
3
3
|
"description": "Node.js SDK for visual testing with Argos.",
|
|
4
|
-
"version": "4.1.
|
|
4
|
+
"version": "4.1.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"exports": {
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"lint": "eslint .",
|
|
65
65
|
"test": "vitest"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "c705285fa19c31ef0c071bc7bf5182f7a366e2c4"
|
|
68
68
|
}
|