vest 4.4.2-dev-ae93bf → 4.5.0-dev-9b46fb
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/cjs/classnames.development.js +13 -36
- package/dist/cjs/classnames.production.js +1 -1
- package/dist/cjs/enforce/compose.development.js +1 -1
- package/dist/cjs/enforce/compose.production.js +1 -1
- package/dist/cjs/enforce/compounds.development.js +1 -1
- package/dist/cjs/enforce/compounds.production.js +1 -1
- package/dist/cjs/enforce/schema.development.js +1 -1
- package/dist/cjs/enforce/schema.production.js +1 -1
- package/dist/cjs/parser.development.js +13 -36
- package/dist/cjs/parser.production.js +1 -1
- package/dist/cjs/vest.development.js +113 -118
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/classnames.development.js +14 -37
- package/dist/es/classnames.production.js +1 -1
- package/dist/es/enforce/compose.development.js +1 -1
- package/dist/es/enforce/compose.production.js +1 -1
- package/dist/es/enforce/compounds.development.js +1 -1
- package/dist/es/enforce/compounds.production.js +1 -1
- package/dist/es/enforce/schema.development.js +1 -1
- package/dist/es/enforce/schema.production.js +1 -1
- package/dist/es/parser.development.js +14 -37
- package/dist/es/parser.production.js +1 -1
- package/dist/es/vest.development.js +114 -120
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/classnames.development.js +16 -45
- package/dist/umd/classnames.production.js +1 -1
- package/dist/umd/enforce/compose.development.js +17 -0
- package/dist/umd/enforce/compounds.development.js +68 -51
- package/dist/umd/enforce/compounds.production.js +1 -1
- package/dist/umd/enforce/schema.development.js +17 -0
- package/dist/umd/parser.development.js +16 -45
- package/dist/umd/parser.production.js +1 -1
- package/dist/umd/vest.development.js +131 -119
- package/dist/umd/vest.production.js +1 -1
- package/package.json +4 -4
- package/testUtils/__tests__/partition.test.ts +21 -0
- package/testUtils/partition.ts +13 -0
- package/types/enforce/compose.d.ts +3 -2
- package/types/enforce/compounds.d.ts +3 -2
- package/types/enforce/schema.d.ts +3 -2
- package/types/parser.d.ts +8 -7
- package/types/promisify.d.ts +20 -35
- package/types/vest.d.ts +45 -60
|
@@ -1,58 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var vestUtils = require('vest-utils');
|
|
4
|
+
var vest = require('vest');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})(Severity || (Severity = {}));
|
|
10
|
-
var SeverityCount;
|
|
11
|
-
(function (SeverityCount) {
|
|
12
|
-
SeverityCount["ERROR_COUNT"] = "errorCount";
|
|
13
|
-
SeverityCount["WARN_COUNT"] = "warnCount";
|
|
14
|
-
})(SeverityCount || (SeverityCount = {}));
|
|
15
|
-
|
|
16
|
-
// eslint-disable-next-line max-lines-per-function
|
|
17
|
-
function parse(res) {
|
|
18
|
-
vestUtils.invariant(res && vestUtils.hasOwnProperty(res, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
6
|
+
// eslint-disable-next-line max-statements
|
|
7
|
+
function parse(summary) {
|
|
8
|
+
vestUtils.invariant(summary && vestUtils.hasOwnProperty(summary, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
9
|
+
var sel = vest.suiteSelectors(summary);
|
|
19
10
|
var testedStorage = {};
|
|
20
11
|
var selectors = {
|
|
21
|
-
invalid: hasErrors,
|
|
12
|
+
invalid: sel.hasErrors,
|
|
22
13
|
tested: isTested,
|
|
23
14
|
untested: isUntested,
|
|
24
|
-
valid: isValid,
|
|
25
|
-
warning: hasWarnings
|
|
15
|
+
valid: sel.isValid,
|
|
16
|
+
warning: sel.hasWarnings
|
|
26
17
|
};
|
|
27
18
|
return selectors;
|
|
19
|
+
// Booleans
|
|
28
20
|
function isTested(fieldName) {
|
|
29
21
|
if (!fieldName) {
|
|
30
|
-
return vestUtils.isPositive(
|
|
22
|
+
return vestUtils.isPositive(summary.testCount);
|
|
31
23
|
}
|
|
32
24
|
if (vestUtils.hasOwnProperty(testedStorage, fieldName))
|
|
33
25
|
return testedStorage[fieldName];
|
|
34
26
|
testedStorage[fieldName] =
|
|
35
|
-
vestUtils.hasOwnProperty(
|
|
36
|
-
vestUtils.isPositive(
|
|
27
|
+
vestUtils.hasOwnProperty(summary.tests, fieldName) &&
|
|
28
|
+
vestUtils.isPositive(summary.tests[fieldName].testCount);
|
|
37
29
|
return selectors.tested(fieldName);
|
|
38
30
|
}
|
|
39
31
|
function isUntested(fieldName) {
|
|
40
|
-
return
|
|
41
|
-
}
|
|
42
|
-
function isValid(fieldName) {
|
|
43
|
-
var _a;
|
|
44
|
-
return fieldName ? Boolean((_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.valid) : res.valid;
|
|
45
|
-
}
|
|
46
|
-
function hasWarnings(fieldName) {
|
|
47
|
-
return hasFailures(SeverityCount.WARN_COUNT, fieldName);
|
|
48
|
-
}
|
|
49
|
-
function hasErrors(fieldName) {
|
|
50
|
-
return hasFailures(SeverityCount.ERROR_COUNT, fieldName);
|
|
51
|
-
}
|
|
52
|
-
function hasFailures(countKey, fieldName) {
|
|
53
|
-
var _a;
|
|
54
|
-
var failureCount = vestUtils.defaultTo(fieldName ? (_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[countKey] : res[countKey], 0);
|
|
55
|
-
return vestUtils.isPositive(failureCount);
|
|
32
|
+
return !(vestUtils.isPositive(summary.testCount) && selectors.tested(fieldName));
|
|
56
33
|
}
|
|
57
34
|
}
|
|
58
35
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var t
|
|
1
|
+
"use strict";var t=require("vest-utils"),e=require("vest");module.exports=function(s,r){void 0===r&&(r={});var i=function(s){t.invariant(s&&t.hasOwnProperty(s,"valid"),"Vest parser: expected argument at position 0 to be Vest's result object.");var r=e.suiteSelectors(s),i={},n={invalid:r.hasErrors,tested:function(e){return e?t.hasOwnProperty(i,e)?i[e]:(i[e]=t.hasOwnProperty(s.tests,e)&&t.isPositive(s.tests[e].testCount),n.tested(e)):t.isPositive(s.testCount)},untested:function(e){return!(t.isPositive(s.testCount)&&n.tested(e))},valid:r.isValid,warning:r.hasWarnings};return n}(s);return function(e){var s,n=[];for(s in r){var o=s;t.isFunction(i[o])&&i[o](e)&&n.push(r[o])}return n.join(" ")}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var n=require("
|
|
1
|
+
"use strict";var n=require("vest-utils"),t=require("n4s");function r(n,t){return n={pass:n},t&&(n.message=t),n}function u(t){return n.defaultTo(t,r(!0))}function e(n,t){try{return n.run(t)}catch(n){return r(!1)}}module.exports=function(){function r(r){return t.ctx.run({value:r},(function(){return u(n.mapFirst(s,(function(n,t){t(!(n=e(n,r)).pass,n)})))}))}for(var s=[],i=0;i<arguments.length;i++)s[i]=arguments[i];return n.assign((function(t){t=r(t),n.invariant(t.pass,n.StringObject(t.message))}),{run:r,test:function(n){return r(n).pass}})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var n=require("
|
|
1
|
+
"use strict";var n=require("vest-utils"),r=require("n4s");function t(n,r){return n={pass:n},r&&(n.message=r),n}function e(){return t(!1)}function u(r){return n.defaultTo(r,e())}function f(r){return n.defaultTo(r,t(!0))}function o(n,r){try{return n.run(r)}catch(n){return e()}}function i(n,r){return n===r}n.bindNot(i);r.enforce.extend({allOf:function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return f(n.mapFirst(t,(function(n,t){t(!(n=o(n,r)).pass,n)})))},anyOf:function(r){for(var t=[],e=1;e<arguments.length;e++)t[e-1]=arguments[e];return u(n.mapFirst(t,(function(n,t){t((n=o(n,r)).pass,n)})))},noneOf:function(r){for(var t=[],u=1;u<arguments.length;u++)t[u-1]=arguments[u];return f(n.mapFirst(t,(function(n,t){t((n=o(n,r)).pass,e())})))},oneOf:function(r){for(var e=[],u=1;u<arguments.length;u++)e[u-1]=arguments[u];var f=0;return e.some((function(t){if(o(t,r).pass&&f++,n.greaterThan(f,1))return!1})),t(i(f,1))}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var r=require("vest-utils"),n=require("n4s");function e(r,n){return r={pass:r},n&&(r.message=n),r}function t(){return e(!1)}function u(){return e(!0)}function i(r,n){try{return r.run(n)}catch(r){return t()}}function o(r,e){var t,o=function(t){var u=r[t],o=e[t];if(!(t=n.ctx.run({value:u,set:!0,meta:{key:t}},(function(){return i(o,u)}))).pass)return{value:t}};for(t in e){var a=o(t);if("object"==typeof a)return a.value}return u()}n.enforce.extend({isArrayOf:function(e,t){return function(n){return r.defaultTo(n,u())}(r.mapFirst(e,(function(r,e,u){e(!(u=n.ctx.run({value:r,set:!0,meta:{index:u}},(function(){return i(t,r)}))).pass,u)})))},loose:o,optional:function(n,e){return r.isNullish(n)?u():i(e,n)},shape:function(n,e){var i=o(n,e);if(!i.pass)return i;for(var a in n)if(!r.hasOwnProperty(e,a))return t();return u()}}),exports.partial=function(r){var e,t={};for(e in r)t[e]=n.enforce.optional(r[e]);return t};
|
|
@@ -2,59 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var vest = require('vest');
|
|
5
6
|
var vestUtils = require('vest-utils');
|
|
6
7
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
})(Severity || (Severity = {}));
|
|
12
|
-
var SeverityCount;
|
|
13
|
-
(function (SeverityCount) {
|
|
14
|
-
SeverityCount["ERROR_COUNT"] = "errorCount";
|
|
15
|
-
SeverityCount["WARN_COUNT"] = "warnCount";
|
|
16
|
-
})(SeverityCount || (SeverityCount = {}));
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line max-lines-per-function
|
|
19
|
-
function parse(res) {
|
|
20
|
-
vestUtils.invariant(res && vestUtils.hasOwnProperty(res, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
8
|
+
// eslint-disable-next-line max-statements
|
|
9
|
+
function parse(summary) {
|
|
10
|
+
vestUtils.invariant(summary && vestUtils.hasOwnProperty(summary, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
11
|
+
var sel = vest.suiteSelectors(summary);
|
|
21
12
|
var testedStorage = {};
|
|
22
13
|
var selectors = {
|
|
23
|
-
invalid: hasErrors,
|
|
14
|
+
invalid: sel.hasErrors,
|
|
24
15
|
tested: isTested,
|
|
25
16
|
untested: isUntested,
|
|
26
|
-
valid: isValid,
|
|
27
|
-
warning: hasWarnings
|
|
17
|
+
valid: sel.isValid,
|
|
18
|
+
warning: sel.hasWarnings
|
|
28
19
|
};
|
|
29
20
|
return selectors;
|
|
21
|
+
// Booleans
|
|
30
22
|
function isTested(fieldName) {
|
|
31
23
|
if (!fieldName) {
|
|
32
|
-
return vestUtils.isPositive(
|
|
24
|
+
return vestUtils.isPositive(summary.testCount);
|
|
33
25
|
}
|
|
34
26
|
if (vestUtils.hasOwnProperty(testedStorage, fieldName))
|
|
35
27
|
return testedStorage[fieldName];
|
|
36
28
|
testedStorage[fieldName] =
|
|
37
|
-
vestUtils.hasOwnProperty(
|
|
38
|
-
vestUtils.isPositive(
|
|
29
|
+
vestUtils.hasOwnProperty(summary.tests, fieldName) &&
|
|
30
|
+
vestUtils.isPositive(summary.tests[fieldName].testCount);
|
|
39
31
|
return selectors.tested(fieldName);
|
|
40
32
|
}
|
|
41
33
|
function isUntested(fieldName) {
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
function isValid(fieldName) {
|
|
45
|
-
var _a;
|
|
46
|
-
return fieldName ? Boolean((_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.valid) : res.valid;
|
|
47
|
-
}
|
|
48
|
-
function hasWarnings(fieldName) {
|
|
49
|
-
return hasFailures(SeverityCount.WARN_COUNT, fieldName);
|
|
50
|
-
}
|
|
51
|
-
function hasErrors(fieldName) {
|
|
52
|
-
return hasFailures(SeverityCount.ERROR_COUNT, fieldName);
|
|
53
|
-
}
|
|
54
|
-
function hasFailures(countKey, fieldName) {
|
|
55
|
-
var _a;
|
|
56
|
-
var failureCount = vestUtils.defaultTo(fieldName ? (_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[countKey] : res[countKey], 0);
|
|
57
|
-
return vestUtils.isPositive(failureCount);
|
|
34
|
+
return !(vestUtils.isPositive(summary.testCount) && selectors.tested(fieldName));
|
|
58
35
|
}
|
|
59
36
|
}
|
|
60
37
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("vest"),e=require("vest-utils");exports.parse=function(s){e.invariant(s&&e.hasOwnProperty(s,"valid"),"Vest parser: expected argument at position 0 to be Vest's result object.");var r=t.suiteSelectors(s),i={},n={invalid:r.hasErrors,tested:function(t){return t?e.hasOwnProperty(i,t)?i[t]:(i[t]=e.hasOwnProperty(s.tests,t)&&e.isPositive(s.tests[t].testCount),n.tested(t)):e.isPositive(s.testCount)},untested:function(t){return!(e.isPositive(s.testCount)&&n.tested(t))},valid:r.isValid,warning:r.hasWarnings};return n};
|
|
@@ -65,7 +65,7 @@ function generateIsolate(type, path) {
|
|
|
65
65
|
var context = context$1.createContext(function (ctxRef, parentContext) {
|
|
66
66
|
return parentContext
|
|
67
67
|
? null
|
|
68
|
-
: vestUtils.assign({
|
|
68
|
+
: vestUtils.assign({
|
|
69
69
|
exclusion: {
|
|
70
70
|
tests: {},
|
|
71
71
|
groups: {}
|
|
@@ -156,7 +156,7 @@ var VestTest = /** @class */ (function () {
|
|
|
156
156
|
function VestTest(fieldName, testFn, _a) {
|
|
157
157
|
var _b = _a === void 0 ? {} : _a, message = _b.message, groupName = _b.groupName, key = _b.key;
|
|
158
158
|
this.key = null;
|
|
159
|
-
this.id = vestUtils.
|
|
159
|
+
this.id = vestUtils.seq();
|
|
160
160
|
this.severity = TestSeverity.Error;
|
|
161
161
|
this.status = STATUS_UNTESTED;
|
|
162
162
|
this.fieldName = fieldName;
|
|
@@ -374,6 +374,26 @@ function createStateRef(state, _a) {
|
|
|
374
374
|
};
|
|
375
375
|
}
|
|
376
376
|
|
|
377
|
+
/**
|
|
378
|
+
* @returns {Isolate} The current isolate layer
|
|
379
|
+
*/
|
|
380
|
+
function useIsolate() {
|
|
381
|
+
return context.useX().isolate;
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* @returns {number[]} The current cursor path of the isolate tree
|
|
385
|
+
*/
|
|
386
|
+
function useCurrentPath() {
|
|
387
|
+
var isolate = useIsolate();
|
|
388
|
+
return isolate.path.concat(isolate.cursor.current());
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* @returns {IsolateCursor} The cursor object for the current isolate
|
|
392
|
+
*/
|
|
393
|
+
function useCursor() {
|
|
394
|
+
return useIsolate().cursor;
|
|
395
|
+
}
|
|
396
|
+
|
|
377
397
|
function usePrevKeys() {
|
|
378
398
|
var prev = useTestObjects()[0].prev;
|
|
379
399
|
return vestUtils.asArray(vestUtils.nestedArray.getCurrent(prev, useCurrentPath())).reduce(function (prevKeys, testObject) {
|
|
@@ -416,31 +436,12 @@ function isolate(_a, callback) {
|
|
|
416
436
|
useCursor().next();
|
|
417
437
|
return output;
|
|
418
438
|
}
|
|
419
|
-
/**
|
|
420
|
-
* @returns {Isolate} The current isolate layer
|
|
421
|
-
*/
|
|
422
|
-
function useIsolate() {
|
|
423
|
-
return context.useX().isolate;
|
|
424
|
-
}
|
|
425
439
|
/**
|
|
426
440
|
* @returns {boolean} Whether or not the current isolate allows tests to be reordered
|
|
427
441
|
*/
|
|
428
442
|
function shouldAllowReorder() {
|
|
429
443
|
return useIsolate().type === IsolateTypes.EACH;
|
|
430
444
|
}
|
|
431
|
-
/**
|
|
432
|
-
* @returns {number[]} The current cursor path of the isolate tree
|
|
433
|
-
*/
|
|
434
|
-
function useCurrentPath() {
|
|
435
|
-
var isolate = useIsolate();
|
|
436
|
-
return isolate.path.concat(isolate.cursor.current());
|
|
437
|
-
}
|
|
438
|
-
/**
|
|
439
|
-
* @returns {IsolateCursor} The cursor object for the current isolate
|
|
440
|
-
*/
|
|
441
|
-
function useCursor() {
|
|
442
|
-
return useIsolate().cursor;
|
|
443
|
-
}
|
|
444
445
|
|
|
445
446
|
var Severity;
|
|
446
447
|
(function (Severity) {
|
|
@@ -600,11 +601,6 @@ function missingTestsLogic(testObject, fieldName) {
|
|
|
600
601
|
testObject.isOmitted());
|
|
601
602
|
}
|
|
602
603
|
|
|
603
|
-
function useSummary() {
|
|
604
|
-
var summary = context.useX().summary;
|
|
605
|
-
vestUtils.invariant(summary);
|
|
606
|
-
return summary;
|
|
607
|
-
}
|
|
608
604
|
/**
|
|
609
605
|
* Reads the testObjects list and gets full validation result from it.
|
|
610
606
|
*/
|
|
@@ -716,57 +712,85 @@ function collectAll(testGroup, severityKey) {
|
|
|
716
712
|
return output;
|
|
717
713
|
}
|
|
718
714
|
|
|
719
|
-
function
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
715
|
+
// eslint-disable-next-line max-lines-per-function, max-statements
|
|
716
|
+
function suiteSelectors(summary) {
|
|
717
|
+
var selectors = {
|
|
718
|
+
getErrors: getErrors,
|
|
719
|
+
getErrorsByGroup: getErrorsByGroup,
|
|
720
|
+
getWarnings: getWarnings,
|
|
721
|
+
getWarningsByGroup: getWarningsByGroup,
|
|
722
|
+
hasErrors: hasErrors,
|
|
723
|
+
hasErrorsByGroup: hasErrorsByGroup,
|
|
724
|
+
hasWarnings: hasWarnings,
|
|
725
|
+
hasWarningsByGroup: hasWarningsByGroup,
|
|
726
|
+
isValid: isValid,
|
|
727
|
+
isValidByGroup: isValidByGroup
|
|
728
|
+
};
|
|
729
|
+
return selectors;
|
|
730
|
+
// Booleans
|
|
731
|
+
function isValid(fieldName) {
|
|
732
|
+
var _a;
|
|
733
|
+
return fieldName ? Boolean((_a = summary.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.valid) : summary.valid;
|
|
734
|
+
}
|
|
735
|
+
function isValidByGroup(groupName, fieldName) {
|
|
736
|
+
var group = summary.groups[groupName];
|
|
737
|
+
if (!group) {
|
|
738
|
+
return false;
|
|
739
|
+
}
|
|
740
|
+
if (fieldName) {
|
|
741
|
+
return isFieldValid(group, fieldName);
|
|
742
|
+
}
|
|
743
|
+
for (var fieldName_1 in group) {
|
|
744
|
+
if (!isFieldValid(group, fieldName_1)) {
|
|
745
|
+
return false;
|
|
746
|
+
}
|
|
747
|
+
}
|
|
748
|
+
return true;
|
|
749
|
+
}
|
|
750
|
+
function hasWarnings(fieldName) {
|
|
751
|
+
return hasFailures(summary, SeverityCount.WARN_COUNT, fieldName);
|
|
752
|
+
}
|
|
753
|
+
function hasErrors(fieldName) {
|
|
754
|
+
return hasFailures(summary, SeverityCount.ERROR_COUNT, fieldName);
|
|
755
|
+
}
|
|
756
|
+
function hasWarningsByGroup(groupName, fieldName) {
|
|
757
|
+
return hasFailuresByGroup(summary, SeverityCount.WARN_COUNT, groupName, fieldName);
|
|
758
|
+
}
|
|
759
|
+
function hasErrorsByGroup(groupName, fieldName) {
|
|
760
|
+
return hasFailuresByGroup(summary, SeverityCount.ERROR_COUNT, groupName, fieldName);
|
|
761
|
+
}
|
|
762
|
+
function getWarnings(fieldName) {
|
|
763
|
+
return getFailures(summary, Severity.WARNINGS, fieldName);
|
|
764
|
+
}
|
|
765
|
+
function getErrors(fieldName) {
|
|
766
|
+
return getFailures(summary, Severity.ERRORS, fieldName);
|
|
767
|
+
}
|
|
768
|
+
function getErrorsByGroup(groupName, fieldName) {
|
|
769
|
+
return getFailuresByGroup(summary, Severity.ERRORS, groupName, fieldName);
|
|
770
|
+
}
|
|
771
|
+
function getWarningsByGroup(groupName, fieldName) {
|
|
772
|
+
return getFailuresByGroup(summary, Severity.WARNINGS, groupName, fieldName);
|
|
773
|
+
}
|
|
724
774
|
}
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
function getFailures(severityKey, fieldName) {
|
|
729
|
-
var summary = useSummary();
|
|
775
|
+
// Gathers all failures of a given severity
|
|
776
|
+
// With a fieldName, it will only gather failures for that field
|
|
777
|
+
function getFailures(summary, severityKey, fieldName) {
|
|
730
778
|
return gatherFailures(summary.tests, severityKey, fieldName);
|
|
731
779
|
}
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
}
|
|
736
|
-
function getWarningsByGroup(groupName, fieldName) {
|
|
737
|
-
return getFailuresByGroup(groupName, Severity.WARNINGS, fieldName);
|
|
738
|
-
}
|
|
739
|
-
function getFailuresByGroup(groupName, severityKey, fieldName) {
|
|
740
|
-
var summary = useSummary();
|
|
780
|
+
// Gathers all failures of a given severity within a group
|
|
781
|
+
// With a fieldName, it will only gather failures for that field
|
|
782
|
+
function getFailuresByGroup(summary, severityKey, groupName, fieldName) {
|
|
741
783
|
return gatherFailures(summary.groups[groupName], severityKey, fieldName);
|
|
742
784
|
}
|
|
743
|
-
|
|
744
|
-
function
|
|
745
|
-
return hasFailures(SeverityCount.ERROR_COUNT, fieldName);
|
|
746
|
-
}
|
|
747
|
-
function hasWarnings(fieldName) {
|
|
748
|
-
return hasFailures(SeverityCount.WARN_COUNT, fieldName);
|
|
749
|
-
}
|
|
750
|
-
function hasFailures(severityCount, fieldName) {
|
|
785
|
+
// Checks if a field is valid within a container object - can be within a group or top level
|
|
786
|
+
function isFieldValid(testContainer, fieldName) {
|
|
751
787
|
var _a;
|
|
752
|
-
|
|
753
|
-
if (fieldName) {
|
|
754
|
-
return vestUtils.isPositive((_a = summary.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[severityCount]);
|
|
755
|
-
}
|
|
756
|
-
return vestUtils.isPositive(summary[severityCount]);
|
|
757
|
-
}
|
|
758
|
-
|
|
759
|
-
function hasErrorsByGroup(groupName, fieldName) {
|
|
760
|
-
return hasFailuresByGroup(Severity.ERRORS, groupName, fieldName);
|
|
761
|
-
}
|
|
762
|
-
function hasWarningsByGroup(groupName, fieldName) {
|
|
763
|
-
return hasFailuresByGroup(Severity.WARNINGS, groupName, fieldName);
|
|
788
|
+
return !!((_a = testContainer[fieldName]) === null || _a === void 0 ? void 0 : _a.valid);
|
|
764
789
|
}
|
|
765
|
-
//
|
|
766
|
-
|
|
790
|
+
// Checks if a there are any failures of a given severity within a group
|
|
791
|
+
// If a fieldName is provided, it will only check for failures within that field
|
|
792
|
+
function hasFailuresByGroup(summary, severityCount, groupName, fieldName) {
|
|
767
793
|
var _a, _b;
|
|
768
|
-
var summary = useSummary();
|
|
769
|
-
var severityCount = countKeyBySeverity(severityKey);
|
|
770
794
|
var group = summary.groups[groupName];
|
|
771
795
|
if (!group) {
|
|
772
796
|
return false;
|
|
@@ -781,32 +805,14 @@ function hasFailuresByGroup(severityKey, groupName, fieldName) {
|
|
|
781
805
|
}
|
|
782
806
|
return false;
|
|
783
807
|
}
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
return fieldName
|
|
788
|
-
? Boolean(isFieldValid(summary.tests, fieldName))
|
|
789
|
-
: summary.valid;
|
|
790
|
-
}
|
|
791
|
-
function isValidByGroup(groupName, fieldName) {
|
|
792
|
-
var summary = useSummary();
|
|
793
|
-
var group = summary.groups[groupName];
|
|
794
|
-
if (!group) {
|
|
795
|
-
return false;
|
|
796
|
-
}
|
|
797
|
-
if (fieldName) {
|
|
798
|
-
return isFieldValid(group, fieldName);
|
|
799
|
-
}
|
|
800
|
-
for (var fieldName_1 in group) {
|
|
801
|
-
if (!isFieldValid(group, fieldName_1)) {
|
|
802
|
-
return false;
|
|
803
|
-
}
|
|
804
|
-
}
|
|
805
|
-
return true;
|
|
806
|
-
}
|
|
807
|
-
function isFieldValid(testContainer, fieldName) {
|
|
808
|
+
// Checks if there are any failures of a given severity
|
|
809
|
+
// If a fieldName is provided, it will only check for failures within that field
|
|
810
|
+
function hasFailures(summary, countKey, fieldName) {
|
|
808
811
|
var _a;
|
|
809
|
-
|
|
812
|
+
var failureCount = fieldName
|
|
813
|
+
? (_a = summary.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[countKey]
|
|
814
|
+
: summary[countKey] || 0;
|
|
815
|
+
return vestUtils.isPositive(failureCount);
|
|
810
816
|
}
|
|
811
817
|
|
|
812
818
|
var cache$1 = vestUtils.cache(1);
|
|
@@ -816,18 +822,7 @@ function produceSuiteResult() {
|
|
|
816
822
|
return cache$1([testObjects], context.bind(ctxRef, function () {
|
|
817
823
|
var summary = genTestsSummary();
|
|
818
824
|
var suiteName = useSuiteName();
|
|
819
|
-
|
|
820
|
-
return vestUtils.assign(summary, {
|
|
821
|
-
getErrors: context.bind(ref, getErrors),
|
|
822
|
-
getErrorsByGroup: context.bind(ref, getErrorsByGroup),
|
|
823
|
-
getWarnings: context.bind(ref, getWarnings),
|
|
824
|
-
getWarningsByGroup: context.bind(ref, getWarningsByGroup),
|
|
825
|
-
hasErrors: context.bind(ref, hasErrors),
|
|
826
|
-
hasErrorsByGroup: context.bind(ref, hasErrorsByGroup),
|
|
827
|
-
hasWarnings: context.bind(ref, hasWarnings),
|
|
828
|
-
hasWarningsByGroup: context.bind(ref, hasWarningsByGroup),
|
|
829
|
-
isValid: context.bind(ref, isValid),
|
|
830
|
-
isValidByGroup: context.bind(ref, isValidByGroup),
|
|
825
|
+
return vestUtils.assign(summary, suiteSelectors(summary), {
|
|
831
826
|
suiteName: suiteName
|
|
832
827
|
});
|
|
833
828
|
}));
|
|
@@ -846,7 +841,7 @@ function hasRemainingTests(fieldName) {
|
|
|
846
841
|
return matchingFieldName(testObject, fieldName);
|
|
847
842
|
});
|
|
848
843
|
}
|
|
849
|
-
return
|
|
844
|
+
return true;
|
|
850
845
|
}
|
|
851
846
|
|
|
852
847
|
var cache = vestUtils.cache(20);
|
|
@@ -863,10 +858,10 @@ function produceFullResult() {
|
|
|
863
858
|
* DONE is here and not in its own module to prevent circular dependency issues.
|
|
864
859
|
*/
|
|
865
860
|
function shouldSkipDoneRegistration(callback, fieldName, output) {
|
|
861
|
+
var _a;
|
|
866
862
|
// If we do not have any test runs for the current field
|
|
867
863
|
return !!(!vestUtils.isFunction(callback) ||
|
|
868
|
-
(fieldName &&
|
|
869
|
-
(!output.tests[fieldName] || vestUtils.isEmpty(output.tests[fieldName].testCount))));
|
|
864
|
+
(fieldName && vestUtils.numberEquals((_a = output.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.testCount, 0)));
|
|
870
865
|
}
|
|
871
866
|
function shouldRunDoneCallback(fieldName) {
|
|
872
867
|
// is suite finished || field name exists, and test is finished;
|
|
@@ -1041,7 +1036,7 @@ function create() {
|
|
|
1041
1036
|
// State initialization
|
|
1042
1037
|
var state = createState();
|
|
1043
1038
|
// State reference - this holds the actual state values
|
|
1044
|
-
var stateRef = createStateRef(state, { suiteId: vestUtils.
|
|
1039
|
+
var stateRef = createStateRef(state, { suiteId: vestUtils.seq(), suiteName: suiteName });
|
|
1045
1040
|
// Create base context reference. All hooks will derive their data from this
|
|
1046
1041
|
var ctxRef = { stateRef: stateRef, bus: bus };
|
|
1047
1042
|
var suite = vestUtils.assign(
|
|
@@ -1136,10 +1131,10 @@ function isExcludedIndividually() {
|
|
|
1136
1131
|
* only('username');
|
|
1137
1132
|
*/
|
|
1138
1133
|
function only(item) {
|
|
1139
|
-
return addTo(0 /* ONLY */, 'tests', item);
|
|
1134
|
+
return addTo(0 /* ExclusionGroup.ONLY */, 'tests', item);
|
|
1140
1135
|
}
|
|
1141
1136
|
only.group = function (item) {
|
|
1142
|
-
return addTo(0 /* ONLY */, 'groups', item);
|
|
1137
|
+
return addTo(0 /* ExclusionGroup.ONLY */, 'groups', item);
|
|
1143
1138
|
};
|
|
1144
1139
|
/**
|
|
1145
1140
|
* Adds a field or a list of fields into the exclusion list
|
|
@@ -1149,13 +1144,13 @@ only.group = function (item) {
|
|
|
1149
1144
|
* skip('username');
|
|
1150
1145
|
*/
|
|
1151
1146
|
function skip(item) {
|
|
1152
|
-
return addTo(1 /* SKIP */, 'tests', item);
|
|
1147
|
+
return addTo(1 /* ExclusionGroup.SKIP */, 'tests', item);
|
|
1153
1148
|
}
|
|
1154
1149
|
skip.group = function (item) {
|
|
1155
|
-
return addTo(1 /* SKIP */, 'groups', item);
|
|
1150
|
+
return addTo(1 /* ExclusionGroup.SKIP */, 'groups', item);
|
|
1156
1151
|
};
|
|
1157
1152
|
//Checks whether a certain test profile excluded by any of the exclusion groups.
|
|
1158
|
-
// eslint-disable-next-line complexity, max-statements
|
|
1153
|
+
// eslint-disable-next-line complexity, max-statements
|
|
1159
1154
|
function isExcluded(testObject) {
|
|
1160
1155
|
var fieldName = testObject.fieldName, groupName = testObject.groupName;
|
|
1161
1156
|
if (isExcludedIndividually())
|
|
@@ -1231,7 +1226,7 @@ function addTo(exclusionGroup, itemType, item) {
|
|
|
1231
1226
|
return;
|
|
1232
1227
|
}
|
|
1233
1228
|
context$1.exclusion[itemType][itemName] =
|
|
1234
|
-
exclusionGroup === 0 /* ONLY */;
|
|
1229
|
+
exclusionGroup === 0 /* ExclusionGroup.ONLY */;
|
|
1235
1230
|
});
|
|
1236
1231
|
}
|
|
1237
1232
|
/**
|
|
@@ -1617,7 +1612,6 @@ function registerTestObjectByTier(testObject) {
|
|
|
1617
1612
|
}
|
|
1618
1613
|
|
|
1619
1614
|
/* eslint-disable jest/valid-title */
|
|
1620
|
-
// eslint-disable-next-line max-lines-per-function
|
|
1621
1615
|
function bindTestMemo(test) {
|
|
1622
1616
|
var cache = vestUtils.cache(10); // arbitrary cache size
|
|
1623
1617
|
// eslint-disable-next-line max-statements
|
|
@@ -1688,7 +1682,7 @@ function warn() {
|
|
|
1688
1682
|
ctx.currentTest.warn();
|
|
1689
1683
|
}
|
|
1690
1684
|
|
|
1691
|
-
var VERSION = "4.
|
|
1685
|
+
var VERSION = "4.5.0-dev-9b46fb";
|
|
1692
1686
|
|
|
1693
1687
|
Object.defineProperty(exports, 'enforce', {
|
|
1694
1688
|
enumerable: true,
|
|
@@ -1708,5 +1702,6 @@ exports.only = only;
|
|
|
1708
1702
|
exports.optional = optional;
|
|
1709
1703
|
exports.skip = skip;
|
|
1710
1704
|
exports.skipWhen = skipWhen;
|
|
1705
|
+
exports.suiteSelectors = suiteSelectors;
|
|
1711
1706
|
exports.test = test;
|
|
1712
1707
|
exports.warn = warn;
|