vest 4.4.3-dev-c786f7 → 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 +88 -94
- 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 +89 -96
- 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 +106 -95
- package/dist/umd/vest.production.js +1 -1
- package/package.json +4 -4
- package/types/enforce/compose.d.ts +2 -1
- package/types/enforce/compounds.d.ts +2 -1
- package/types/enforce/schema.d.ts +2 -1
- package/types/parser.d.ts +8 -7
- package/types/promisify.d.ts +20 -35
- package/types/vest.d.ts +45 -60
|
@@ -1,56 +1,33 @@
|
|
|
1
|
-
import { invariant, hasOwnProperty, isPositive,
|
|
1
|
+
import { invariant, hasOwnProperty, isPositive, isFunction } from 'vest-utils';
|
|
2
|
+
import { suiteSelectors } from 'vest';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})(Severity || (Severity = {}));
|
|
8
|
-
var SeverityCount;
|
|
9
|
-
(function (SeverityCount) {
|
|
10
|
-
SeverityCount["ERROR_COUNT"] = "errorCount";
|
|
11
|
-
SeverityCount["WARN_COUNT"] = "warnCount";
|
|
12
|
-
})(SeverityCount || (SeverityCount = {}));
|
|
13
|
-
|
|
14
|
-
// eslint-disable-next-line max-lines-per-function
|
|
15
|
-
function parse(res) {
|
|
16
|
-
invariant(res && hasOwnProperty(res, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
4
|
+
// eslint-disable-next-line max-statements
|
|
5
|
+
function parse(summary) {
|
|
6
|
+
invariant(summary && hasOwnProperty(summary, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
7
|
+
var sel = suiteSelectors(summary);
|
|
17
8
|
var testedStorage = {};
|
|
18
9
|
var selectors = {
|
|
19
|
-
invalid: hasErrors,
|
|
10
|
+
invalid: sel.hasErrors,
|
|
20
11
|
tested: isTested,
|
|
21
12
|
untested: isUntested,
|
|
22
|
-
valid: isValid,
|
|
23
|
-
warning: hasWarnings
|
|
13
|
+
valid: sel.isValid,
|
|
14
|
+
warning: sel.hasWarnings
|
|
24
15
|
};
|
|
25
16
|
return selectors;
|
|
17
|
+
// Booleans
|
|
26
18
|
function isTested(fieldName) {
|
|
27
19
|
if (!fieldName) {
|
|
28
|
-
return isPositive(
|
|
20
|
+
return isPositive(summary.testCount);
|
|
29
21
|
}
|
|
30
22
|
if (hasOwnProperty(testedStorage, fieldName))
|
|
31
23
|
return testedStorage[fieldName];
|
|
32
24
|
testedStorage[fieldName] =
|
|
33
|
-
hasOwnProperty(
|
|
34
|
-
isPositive(
|
|
25
|
+
hasOwnProperty(summary.tests, fieldName) &&
|
|
26
|
+
isPositive(summary.tests[fieldName].testCount);
|
|
35
27
|
return selectors.tested(fieldName);
|
|
36
28
|
}
|
|
37
29
|
function isUntested(fieldName) {
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
function isValid(fieldName) {
|
|
41
|
-
var _a;
|
|
42
|
-
return fieldName ? Boolean((_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.valid) : res.valid;
|
|
43
|
-
}
|
|
44
|
-
function hasWarnings(fieldName) {
|
|
45
|
-
return hasFailures(SeverityCount.WARN_COUNT, fieldName);
|
|
46
|
-
}
|
|
47
|
-
function hasErrors(fieldName) {
|
|
48
|
-
return hasFailures(SeverityCount.ERROR_COUNT, fieldName);
|
|
49
|
-
}
|
|
50
|
-
function hasFailures(countKey, fieldName) {
|
|
51
|
-
var _a;
|
|
52
|
-
var failureCount = defaultTo(fieldName ? (_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[countKey] : res[countKey], 0);
|
|
53
|
-
return isPositive(failureCount);
|
|
30
|
+
return !(isPositive(summary.testCount) && selectors.tested(fieldName));
|
|
54
31
|
}
|
|
55
32
|
}
|
|
56
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{suiteSelectors as t}from"vest";import{invariant as e,hasOwnProperty as r,isPositive as n,isFunction as s}from"vest-utils";export default function(i,o){void 0===o&&(o={});var u=function(s){e(s&&r(s,"valid"),"Vest parser: expected argument at position 0 to be Vest's result object.");var i=t(s),o={},u={invalid:i.hasErrors,tested:function(t){return t?r(o,t)?o[t]:(o[t]=r(s.tests,t)&&n(s.tests[t].testCount),u.tested(t)):n(s.testCount)},untested:function(t){return!(n(s.testCount)&&u.tested(t))},valid:i.isValid,warning:i.hasWarnings};return u}(i);return function(t){var e,r=[];for(e in o){var n=e;s(u[n])&&u[n](t)&&r.push(o[n])}return r.join(" ")}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defaultTo as
|
|
1
|
+
import{ctx as n}from"n4s";import{defaultTo as t,assign as r,mapFirst as u,invariant as s,StringObject as e}from"vest-utils";function o(n,t){return n={pass:n},t&&(n.message=t),n}export default function(){function a(r){return n.run({value:r},(function(){return t(u(f,(function(n,t){try{var u=n.run(r)}catch(n){u=o(!1)}t(!u.pass,u)})),o(!0))}))}for(var f=[],i=0;i<arguments.length;i++)f[i]=arguments[i];return r((function(n){n=a(n),s(n.pass,e(n.message))}),{run:a,test:function(n){return a(n).pass}})}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{defaultTo as
|
|
1
|
+
import{enforce as n}from"n4s";import{defaultTo as r,mapFirst as t,bindNot as f,greaterThan as o}from"vest-utils";function u(n,r){return n={pass:n},r&&(n.message=r),n}function e(n,r){try{return n.run(r)}catch(n){return u(!1)}}f((function(n,r){return n===r})),n.extend({allOf:function(n){for(var f=[],o=1;o<arguments.length;o++)f[o-1]=arguments[o];return r(t(f,(function(r,t){t(!(r=e(r,n)).pass,r)})),u(!0))},anyOf:function(n){for(var f=[],o=1;o<arguments.length;o++)f[o-1]=arguments[o];return r(t(f,(function(r,t){t((r=e(r,n)).pass,r)})),u(!1))},noneOf:function(n){for(var f=[],o=1;o<arguments.length;o++)f[o-1]=arguments[o];return r(t(f,(function(r,t){t((r=e(r,n)).pass,u(!1))})),u(!0))},oneOf:function(n){for(var r=[],t=1;t<arguments.length;t++)r[t-1]=arguments[t];var f=0;return r.some((function(r){if(e(r,n).pass&&f++,o(f,1))return!1})),u(1===f)}});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{ctx as r,enforce as n}from"n4s";import{defaultTo as t,mapFirst as e,isNullish as u,hasOwnProperty as o}from"vest-utils";function i(r,n){return r={pass:r},n&&(r.message=n),r}function a(r,n){try{return r.run(n)}catch(r){return i(!1)}}function f(n,t){function e(e){var u=n[e],o=t[e];if(!(e=r.run({value:u,set:!0,meta:{key:e}},(function(){return a(o,u)}))).pass)return{value:e}}for(var u in t){var o=e(u);if("object"==typeof o)return o.value}return i(!0)}n.extend({isArrayOf:function(n,u){return t(e(n,(function(n,t,e){t(!(e=r.run({value:n,set:!0,meta:{index:e}},(function(){return a(u,n)}))).pass,e)})),i(!0))},loose:f,optional:function(r,n){return u(r)?i(!0):a(n,r)},shape:function(r,n){var t=f(r,n);if(!t.pass)return t;for(var e in r)if(!o(n,e))return i(!1);return i(!0)}});export function partial(r){var t,e={};for(t in r)e[t]=n.optional(r[t]);return e}
|
|
@@ -1,56 +1,33 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { suiteSelectors } from 'vest';
|
|
2
|
+
import { invariant, hasOwnProperty, isPositive } from 'vest-utils';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
})(Severity || (Severity = {}));
|
|
8
|
-
var SeverityCount;
|
|
9
|
-
(function (SeverityCount) {
|
|
10
|
-
SeverityCount["ERROR_COUNT"] = "errorCount";
|
|
11
|
-
SeverityCount["WARN_COUNT"] = "warnCount";
|
|
12
|
-
})(SeverityCount || (SeverityCount = {}));
|
|
13
|
-
|
|
14
|
-
// eslint-disable-next-line max-lines-per-function
|
|
15
|
-
function parse(res) {
|
|
16
|
-
invariant(res && hasOwnProperty(res, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
4
|
+
// eslint-disable-next-line max-statements
|
|
5
|
+
function parse(summary) {
|
|
6
|
+
invariant(summary && hasOwnProperty(summary, 'valid'), "Vest parser: expected argument at position 0 to be Vest's result object.");
|
|
7
|
+
var sel = suiteSelectors(summary);
|
|
17
8
|
var testedStorage = {};
|
|
18
9
|
var selectors = {
|
|
19
|
-
invalid: hasErrors,
|
|
10
|
+
invalid: sel.hasErrors,
|
|
20
11
|
tested: isTested,
|
|
21
12
|
untested: isUntested,
|
|
22
|
-
valid: isValid,
|
|
23
|
-
warning: hasWarnings
|
|
13
|
+
valid: sel.isValid,
|
|
14
|
+
warning: sel.hasWarnings
|
|
24
15
|
};
|
|
25
16
|
return selectors;
|
|
17
|
+
// Booleans
|
|
26
18
|
function isTested(fieldName) {
|
|
27
19
|
if (!fieldName) {
|
|
28
|
-
return isPositive(
|
|
20
|
+
return isPositive(summary.testCount);
|
|
29
21
|
}
|
|
30
22
|
if (hasOwnProperty(testedStorage, fieldName))
|
|
31
23
|
return testedStorage[fieldName];
|
|
32
24
|
testedStorage[fieldName] =
|
|
33
|
-
hasOwnProperty(
|
|
34
|
-
isPositive(
|
|
25
|
+
hasOwnProperty(summary.tests, fieldName) &&
|
|
26
|
+
isPositive(summary.tests[fieldName].testCount);
|
|
35
27
|
return selectors.tested(fieldName);
|
|
36
28
|
}
|
|
37
29
|
function isUntested(fieldName) {
|
|
38
|
-
return
|
|
39
|
-
}
|
|
40
|
-
function isValid(fieldName) {
|
|
41
|
-
var _a;
|
|
42
|
-
return fieldName ? Boolean((_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.valid) : res.valid;
|
|
43
|
-
}
|
|
44
|
-
function hasWarnings(fieldName) {
|
|
45
|
-
return hasFailures(SeverityCount.WARN_COUNT, fieldName);
|
|
46
|
-
}
|
|
47
|
-
function hasErrors(fieldName) {
|
|
48
|
-
return hasFailures(SeverityCount.ERROR_COUNT, fieldName);
|
|
49
|
-
}
|
|
50
|
-
function hasFailures(countKey, fieldName) {
|
|
51
|
-
var _a;
|
|
52
|
-
var failureCount = defaultTo(fieldName ? (_a = res.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[countKey] : res[countKey], 0);
|
|
53
|
-
return isPositive(failureCount);
|
|
30
|
+
return !(isPositive(summary.testCount) && selectors.tested(fieldName));
|
|
54
31
|
}
|
|
55
32
|
}
|
|
56
33
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{invariant as t,hasOwnProperty as e,isPositive as
|
|
1
|
+
import{invariant as t,hasOwnProperty as e,isPositive as s}from"vest-utils";import{suiteSelectors as r}from"vest";export function parse(n){t(n&&e(n,"valid"),"Vest parser: expected argument at position 0 to be Vest's result object.");var i=r(n),o={},a={invalid:i.hasErrors,tested:function(t){return t?e(o,t)?o[t]:(o[t]=e(n.tests,t)&&s(n.tests[t].testCount),a.tested(t)):s(n.testCount)},untested:function(t){return!(s(n.testCount)&&a.tested(t))},valid:i.isValid,warning:i.hasWarnings};return a}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { enforce } from 'n4s';
|
|
2
|
-
import { isUndefined, isStringValue, assign, cache as cache$2, optionalFunctionValue, nestedArray, asArray,
|
|
2
|
+
import { isUndefined, isStringValue, assign, cache as cache$2, optionalFunctionValue, nestedArray, asArray, seq, isFunction, isNullish, deferThrow, invariant, bindNot, either, isEmpty, isNotEmpty, isPositive, numberEquals, hasOwnProperty, isArray, callEach, bus, defaultTo, isPromise, isNull } from 'vest-utils';
|
|
3
3
|
import { createContext } from 'context';
|
|
4
4
|
|
|
5
5
|
function shouldUseErrorAsMessage(message, error) {
|
|
@@ -61,7 +61,7 @@ function generateIsolate(type, path) {
|
|
|
61
61
|
var context = createContext(function (ctxRef, parentContext) {
|
|
62
62
|
return parentContext
|
|
63
63
|
? null
|
|
64
|
-
: assign({
|
|
64
|
+
: assign({
|
|
65
65
|
exclusion: {
|
|
66
66
|
tests: {},
|
|
67
67
|
groups: {}
|
|
@@ -152,7 +152,7 @@ var VestTest = /** @class */ (function () {
|
|
|
152
152
|
function VestTest(fieldName, testFn, _a) {
|
|
153
153
|
var _b = _a === void 0 ? {} : _a, message = _b.message, groupName = _b.groupName, key = _b.key;
|
|
154
154
|
this.key = null;
|
|
155
|
-
this.id =
|
|
155
|
+
this.id = seq();
|
|
156
156
|
this.severity = TestSeverity.Error;
|
|
157
157
|
this.status = STATUS_UNTESTED;
|
|
158
158
|
this.fieldName = fieldName;
|
|
@@ -597,11 +597,6 @@ function missingTestsLogic(testObject, fieldName) {
|
|
|
597
597
|
testObject.isOmitted());
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
function useSummary() {
|
|
601
|
-
var summary = context.useX().summary;
|
|
602
|
-
invariant(summary);
|
|
603
|
-
return summary;
|
|
604
|
-
}
|
|
605
600
|
/**
|
|
606
601
|
* Reads the testObjects list and gets full validation result from it.
|
|
607
602
|
*/
|
|
@@ -713,57 +708,85 @@ function collectAll(testGroup, severityKey) {
|
|
|
713
708
|
return output;
|
|
714
709
|
}
|
|
715
710
|
|
|
716
|
-
function
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
711
|
+
// eslint-disable-next-line max-lines-per-function, max-statements
|
|
712
|
+
function suiteSelectors(summary) {
|
|
713
|
+
var selectors = {
|
|
714
|
+
getErrors: getErrors,
|
|
715
|
+
getErrorsByGroup: getErrorsByGroup,
|
|
716
|
+
getWarnings: getWarnings,
|
|
717
|
+
getWarningsByGroup: getWarningsByGroup,
|
|
718
|
+
hasErrors: hasErrors,
|
|
719
|
+
hasErrorsByGroup: hasErrorsByGroup,
|
|
720
|
+
hasWarnings: hasWarnings,
|
|
721
|
+
hasWarningsByGroup: hasWarningsByGroup,
|
|
722
|
+
isValid: isValid,
|
|
723
|
+
isValidByGroup: isValidByGroup
|
|
724
|
+
};
|
|
725
|
+
return selectors;
|
|
726
|
+
// Booleans
|
|
727
|
+
function isValid(fieldName) {
|
|
728
|
+
var _a;
|
|
729
|
+
return fieldName ? Boolean((_a = summary.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.valid) : summary.valid;
|
|
730
|
+
}
|
|
731
|
+
function isValidByGroup(groupName, fieldName) {
|
|
732
|
+
var group = summary.groups[groupName];
|
|
733
|
+
if (!group) {
|
|
734
|
+
return false;
|
|
735
|
+
}
|
|
736
|
+
if (fieldName) {
|
|
737
|
+
return isFieldValid(group, fieldName);
|
|
738
|
+
}
|
|
739
|
+
for (var fieldName_1 in group) {
|
|
740
|
+
if (!isFieldValid(group, fieldName_1)) {
|
|
741
|
+
return false;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return true;
|
|
745
|
+
}
|
|
746
|
+
function hasWarnings(fieldName) {
|
|
747
|
+
return hasFailures(summary, SeverityCount.WARN_COUNT, fieldName);
|
|
748
|
+
}
|
|
749
|
+
function hasErrors(fieldName) {
|
|
750
|
+
return hasFailures(summary, SeverityCount.ERROR_COUNT, fieldName);
|
|
751
|
+
}
|
|
752
|
+
function hasWarningsByGroup(groupName, fieldName) {
|
|
753
|
+
return hasFailuresByGroup(summary, SeverityCount.WARN_COUNT, groupName, fieldName);
|
|
754
|
+
}
|
|
755
|
+
function hasErrorsByGroup(groupName, fieldName) {
|
|
756
|
+
return hasFailuresByGroup(summary, SeverityCount.ERROR_COUNT, groupName, fieldName);
|
|
757
|
+
}
|
|
758
|
+
function getWarnings(fieldName) {
|
|
759
|
+
return getFailures(summary, Severity.WARNINGS, fieldName);
|
|
760
|
+
}
|
|
761
|
+
function getErrors(fieldName) {
|
|
762
|
+
return getFailures(summary, Severity.ERRORS, fieldName);
|
|
763
|
+
}
|
|
764
|
+
function getErrorsByGroup(groupName, fieldName) {
|
|
765
|
+
return getFailuresByGroup(summary, Severity.ERRORS, groupName, fieldName);
|
|
766
|
+
}
|
|
767
|
+
function getWarningsByGroup(groupName, fieldName) {
|
|
768
|
+
return getFailuresByGroup(summary, Severity.WARNINGS, groupName, fieldName);
|
|
769
|
+
}
|
|
721
770
|
}
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
function getFailures(severityKey, fieldName) {
|
|
726
|
-
var summary = useSummary();
|
|
771
|
+
// Gathers all failures of a given severity
|
|
772
|
+
// With a fieldName, it will only gather failures for that field
|
|
773
|
+
function getFailures(summary, severityKey, fieldName) {
|
|
727
774
|
return gatherFailures(summary.tests, severityKey, fieldName);
|
|
728
775
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
}
|
|
733
|
-
function getWarningsByGroup(groupName, fieldName) {
|
|
734
|
-
return getFailuresByGroup(groupName, Severity.WARNINGS, fieldName);
|
|
735
|
-
}
|
|
736
|
-
function getFailuresByGroup(groupName, severityKey, fieldName) {
|
|
737
|
-
var summary = useSummary();
|
|
776
|
+
// Gathers all failures of a given severity within a group
|
|
777
|
+
// With a fieldName, it will only gather failures for that field
|
|
778
|
+
function getFailuresByGroup(summary, severityKey, groupName, fieldName) {
|
|
738
779
|
return gatherFailures(summary.groups[groupName], severityKey, fieldName);
|
|
739
780
|
}
|
|
740
|
-
|
|
741
|
-
function
|
|
742
|
-
return hasFailures(SeverityCount.ERROR_COUNT, fieldName);
|
|
743
|
-
}
|
|
744
|
-
function hasWarnings(fieldName) {
|
|
745
|
-
return hasFailures(SeverityCount.WARN_COUNT, fieldName);
|
|
746
|
-
}
|
|
747
|
-
function hasFailures(severityCount, fieldName) {
|
|
781
|
+
// Checks if a field is valid within a container object - can be within a group or top level
|
|
782
|
+
function isFieldValid(testContainer, fieldName) {
|
|
748
783
|
var _a;
|
|
749
|
-
|
|
750
|
-
if (fieldName) {
|
|
751
|
-
return isPositive((_a = summary.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[severityCount]);
|
|
752
|
-
}
|
|
753
|
-
return isPositive(summary[severityCount]);
|
|
754
|
-
}
|
|
755
|
-
|
|
756
|
-
function hasErrorsByGroup(groupName, fieldName) {
|
|
757
|
-
return hasFailuresByGroup(Severity.ERRORS, groupName, fieldName);
|
|
758
|
-
}
|
|
759
|
-
function hasWarningsByGroup(groupName, fieldName) {
|
|
760
|
-
return hasFailuresByGroup(Severity.WARNINGS, groupName, fieldName);
|
|
784
|
+
return !!((_a = testContainer[fieldName]) === null || _a === void 0 ? void 0 : _a.valid);
|
|
761
785
|
}
|
|
762
|
-
//
|
|
763
|
-
|
|
786
|
+
// Checks if a there are any failures of a given severity within a group
|
|
787
|
+
// If a fieldName is provided, it will only check for failures within that field
|
|
788
|
+
function hasFailuresByGroup(summary, severityCount, groupName, fieldName) {
|
|
764
789
|
var _a, _b;
|
|
765
|
-
var summary = useSummary();
|
|
766
|
-
var severityCount = countKeyBySeverity(severityKey);
|
|
767
790
|
var group = summary.groups[groupName];
|
|
768
791
|
if (!group) {
|
|
769
792
|
return false;
|
|
@@ -778,32 +801,14 @@ function hasFailuresByGroup(severityKey, groupName, fieldName) {
|
|
|
778
801
|
}
|
|
779
802
|
return false;
|
|
780
803
|
}
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
return fieldName
|
|
785
|
-
? Boolean(isFieldValid(summary.tests, fieldName))
|
|
786
|
-
: summary.valid;
|
|
787
|
-
}
|
|
788
|
-
function isValidByGroup(groupName, fieldName) {
|
|
789
|
-
var summary = useSummary();
|
|
790
|
-
var group = summary.groups[groupName];
|
|
791
|
-
if (!group) {
|
|
792
|
-
return false;
|
|
793
|
-
}
|
|
794
|
-
if (fieldName) {
|
|
795
|
-
return isFieldValid(group, fieldName);
|
|
796
|
-
}
|
|
797
|
-
for (var fieldName_1 in group) {
|
|
798
|
-
if (!isFieldValid(group, fieldName_1)) {
|
|
799
|
-
return false;
|
|
800
|
-
}
|
|
801
|
-
}
|
|
802
|
-
return true;
|
|
803
|
-
}
|
|
804
|
-
function isFieldValid(testContainer, fieldName) {
|
|
804
|
+
// Checks if there are any failures of a given severity
|
|
805
|
+
// If a fieldName is provided, it will only check for failures within that field
|
|
806
|
+
function hasFailures(summary, countKey, fieldName) {
|
|
805
807
|
var _a;
|
|
806
|
-
|
|
808
|
+
var failureCount = fieldName
|
|
809
|
+
? (_a = summary.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[countKey]
|
|
810
|
+
: summary[countKey] || 0;
|
|
811
|
+
return isPositive(failureCount);
|
|
807
812
|
}
|
|
808
813
|
|
|
809
814
|
var cache$1 = cache$2(1);
|
|
@@ -813,18 +818,7 @@ function produceSuiteResult() {
|
|
|
813
818
|
return cache$1([testObjects], context.bind(ctxRef, function () {
|
|
814
819
|
var summary = genTestsSummary();
|
|
815
820
|
var suiteName = useSuiteName();
|
|
816
|
-
|
|
817
|
-
return assign(summary, {
|
|
818
|
-
getErrors: context.bind(ref, getErrors),
|
|
819
|
-
getErrorsByGroup: context.bind(ref, getErrorsByGroup),
|
|
820
|
-
getWarnings: context.bind(ref, getWarnings),
|
|
821
|
-
getWarningsByGroup: context.bind(ref, getWarningsByGroup),
|
|
822
|
-
hasErrors: context.bind(ref, hasErrors),
|
|
823
|
-
hasErrorsByGroup: context.bind(ref, hasErrorsByGroup),
|
|
824
|
-
hasWarnings: context.bind(ref, hasWarnings),
|
|
825
|
-
hasWarningsByGroup: context.bind(ref, hasWarningsByGroup),
|
|
826
|
-
isValid: context.bind(ref, isValid),
|
|
827
|
-
isValidByGroup: context.bind(ref, isValidByGroup),
|
|
821
|
+
return assign(summary, suiteSelectors(summary), {
|
|
828
822
|
suiteName: suiteName
|
|
829
823
|
});
|
|
830
824
|
}));
|
|
@@ -843,7 +837,7 @@ function hasRemainingTests(fieldName) {
|
|
|
843
837
|
return matchingFieldName(testObject, fieldName);
|
|
844
838
|
});
|
|
845
839
|
}
|
|
846
|
-
return
|
|
840
|
+
return true;
|
|
847
841
|
}
|
|
848
842
|
|
|
849
843
|
var cache = cache$2(20);
|
|
@@ -860,10 +854,10 @@ function produceFullResult() {
|
|
|
860
854
|
* DONE is here and not in its own module to prevent circular dependency issues.
|
|
861
855
|
*/
|
|
862
856
|
function shouldSkipDoneRegistration(callback, fieldName, output) {
|
|
857
|
+
var _a;
|
|
863
858
|
// If we do not have any test runs for the current field
|
|
864
859
|
return !!(!isFunction(callback) ||
|
|
865
|
-
(fieldName &&
|
|
866
|
-
(!output.tests[fieldName] || isEmpty(output.tests[fieldName].testCount))));
|
|
860
|
+
(fieldName && numberEquals((_a = output.tests[fieldName]) === null || _a === void 0 ? void 0 : _a.testCount, 0)));
|
|
867
861
|
}
|
|
868
862
|
function shouldRunDoneCallback(fieldName) {
|
|
869
863
|
// is suite finished || field name exists, and test is finished;
|
|
@@ -1038,7 +1032,7 @@ function create() {
|
|
|
1038
1032
|
// State initialization
|
|
1039
1033
|
var state = createState();
|
|
1040
1034
|
// State reference - this holds the actual state values
|
|
1041
|
-
var stateRef = createStateRef(state, { suiteId:
|
|
1035
|
+
var stateRef = createStateRef(state, { suiteId: seq(), suiteName: suiteName });
|
|
1042
1036
|
// Create base context reference. All hooks will derive their data from this
|
|
1043
1037
|
var ctxRef = { stateRef: stateRef, bus: bus };
|
|
1044
1038
|
var suite = assign(
|
|
@@ -1152,7 +1146,7 @@ skip.group = function (item) {
|
|
|
1152
1146
|
return addTo(1 /* ExclusionGroup.SKIP */, 'groups', item);
|
|
1153
1147
|
};
|
|
1154
1148
|
//Checks whether a certain test profile excluded by any of the exclusion groups.
|
|
1155
|
-
// eslint-disable-next-line complexity, max-statements
|
|
1149
|
+
// eslint-disable-next-line complexity, max-statements
|
|
1156
1150
|
function isExcluded(testObject) {
|
|
1157
1151
|
var fieldName = testObject.fieldName, groupName = testObject.groupName;
|
|
1158
1152
|
if (isExcludedIndividually())
|
|
@@ -1614,7 +1608,6 @@ function registerTestObjectByTier(testObject) {
|
|
|
1614
1608
|
}
|
|
1615
1609
|
|
|
1616
1610
|
/* eslint-disable jest/valid-title */
|
|
1617
|
-
// eslint-disable-next-line max-lines-per-function
|
|
1618
1611
|
function bindTestMemo(test) {
|
|
1619
1612
|
var cache = cache$2(10); // arbitrary cache size
|
|
1620
1613
|
// eslint-disable-next-line max-statements
|
|
@@ -1685,6 +1678,6 @@ function warn() {
|
|
|
1685
1678
|
ctx.currentTest.warn();
|
|
1686
1679
|
}
|
|
1687
1680
|
|
|
1688
|
-
var VERSION = "4.
|
|
1681
|
+
var VERSION = "4.5.0-dev-9b46fb";
|
|
1689
1682
|
|
|
1690
|
-
export { VERSION, context, create, each, eager, group, include, omitWhen, only, optional, skip, skipWhen, test, warn };
|
|
1683
|
+
export { VERSION, context, create, each, eager, group, include, omitWhen, only, optional, skip, skipWhen, suiteSelectors, test, warn };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createContext as t}from"context";import{isUndefined as n,isStringValue as e,assign as r,cache as i,optionalFunctionValue as u,nestedArray as o,asArray as s,genId as a,isFunction as c,isNullish as f,deferThrow as l,invariant as d,bindNot as p,either as v,isEmpty as E,isNotEmpty as N,isPositive as m,hasOwnProperty as h,isArray as g,callEach as y,bus as R,defaultTo as S,isPromise as C,isNull as T}from"vest-utils";export{enforce}from"n4s";var b,_=b||(b={});_[_.DEFAULT=0]="DEFAULT",_[_.SUITE=1]="SUITE",_[_.EACH=2]="EACH",_[_.SKIP_WHEN=3]="SKIP_WHEN",_[_.OMIT_WHEN=4]="OMIT_WHEN",_[_.GROUP=5]="GROUP";var I,O=I||(I={});function A(){var t=0;return{current:function(){return t},next:function(){t++}}}function k(t,n){return void 0===n&&(n=[]),{cursor:A(),keys:{current:{},prev:{}},path:n,type:t}}O[O.ALL=0]="ALL",O[O.EAGER=1]="EAGER";var L=t((function(t,n){return n?null:r({},{exclusion:{tests:{},groups:{}},inclusion:{},isolate:k(b.DEFAULT),mode:[I.ALL]},t)}));function F(){return L.useX().stateRef}function U(t){return F().optionalFields()[0][t]}function G(t,n){(0,F().optionalFields()[1])((function(e){var i;return r(e,((i={})[t]=u(n,e[t]),i))}))}function W(t){var n;return null===(n=U(t))||void 0===n?void 0:n[0]}function P(){D((function(t){return t}))}function D(t){(0,F().testObjects()[1])((function(n){return{prev:n.prev,current:s(t(n.current))}}))}function x(){return X().filter((function(t){return t.isPending()}))}var w=i();function X(){var t=F().testObjects()[0].current;return w([t],(function(){return o.flatten(t)}))}var H,K=H||(H={});K.Error="error",K.Warning="warning";var M=function(){function t(t,n,e){var r=void 0===e?{}:e;e=r.message;var i=r.groupName;r=r.key,this.key=null,this.id=a(),this.severity=H.Error,this.status=q,this.fieldName=t,this.testFn=n,i&&(this.groupName=i),e&&(this.message=e),r&&(this.key=r)}return t.prototype.run=function(){try{var t=this.testFn()}catch(r){t=r,n(this.message)&&e(t)&&(this.message=r),t=!1}return!1===t&&this.fail(),t},t.prototype.setStatus=function(t){this.isFinalStatus()&&t!==Q||(this.status=t)},t.prototype.warns=function(){return this.severity===H.Warning},t.prototype.setPending=function(){this.setStatus(J)},t.prototype.fail=function(){this.setStatus(this.warns()?j:V)},t.prototype.done=function(){this.isFinalStatus()||this.setStatus(Y)},t.prototype.warn=function(){this.severity=H.Warning},t.prototype.isFinalStatus=function(){return this.hasFailures()||this.isCanceled()||this.isPassing()},t.prototype.skip=function(t){this.isPending()&&!t||this.setStatus(B)},t.prototype.cancel=function(){this.setStatus(z),P()},t.prototype.reset=function(){this.status=q,P()},t.prototype.omit=function(){this.setStatus(Q)},t.prototype.valueOf=function(){return!this.isFailing()},t.prototype.hasFailures=function(){return this.isFailing()||this.isWarning()},t.prototype.isNonActionable=function(){return this.isSkipped()||this.isOmitted()||this.isCanceled()},t.prototype.isPending=function(){return this.statusEquals(J)},t.prototype.isTested=function(){return this.hasFailures()||this.isPassing()},t.prototype.isOmitted=function(){return this.statusEquals(Q)},t.prototype.isUntested=function(){return this.statusEquals(q)},t.prototype.isFailing=function(){return this.statusEquals(V)},t.prototype.isCanceled=function(){return this.statusEquals(z)},t.prototype.isSkipped=function(){return this.statusEquals(B)},t.prototype.isPassing=function(){return this.statusEquals(Y)},t.prototype.isWarning=function(){return this.statusEquals(j)},t.prototype.statusEquals=function(t){return this.status===t},t}(),q="UNTESTED",B="SKIPPED",V="FAILED",j="WARNING",Y="PASSING",J="PENDING",z="CANCELED",Q="OMITTED";function Z(t){function n(t,n,i){return r.references.push(),e(t,u(n,i)),function(){return[r.references[t],function(n){return e(t,u(n,r.references[t]))}]}}function e(n,e){var u=r.references[n];r.references[n]=e,n=i[n][1],c(n)&&n(e,u),c(t)&&t()}var r={references:[]},i=[];return{registerStateKey:function(t,e){var r=i.length;return i.push([t,e]),n(r,t)},reset:function(){var t=r.references;r.references=[],i.forEach((function(e,r){return n(r,e[0],t[r])}))}}}function $(t,n){var e=n.suiteId;return n=n.suiteName,{optionalFields:t.registerStateKey((function(){return{}})),suiteId:t.registerStateKey(e),suiteName:t.registerStateKey(n),testCallbacks:t.registerStateKey((function(){return{fieldCallbacks:{},doneCallbacks:[]}})),testObjects:t.registerStateKey((function(t){return{prev:t?t.current:[],current:[]}}))}}function tt(){return L.useX().isolate}function nt(){var t=tt();return t.path.concat(t.cursor.current())}function et(t,n){t=void 0===(t=t.type)?b.DEFAULT:t,d(c(n));var e=k(t,nt());return t=L.run({isolate:e},(function(){return e.keys.prev=function(){var t=F().testObjects()[0].prev;return s(o.getCurrent(t,nt())).reduce((function(t,n){return n instanceof M&&!f(n.key)?(t[n.key]=n,t):t}),{})}(),D((function(t){return o.setValueAtPath(t,e.path,[])})),n()})),tt().cursor.next(),t}var rt,it=rt||(rt={});it.WARNINGS="warnings",it.ERRORS="errors";var ut,ot=ut||(ut={});function st(t){return t===rt.ERRORS?ut.ERROR_COUNT:ut.WARN_COUNT}function at(t,n){return!(!n||t.fieldName!==n)}ot.ERROR_COUNT="errorCount",ot.WARN_COUNT="warnCount";var ct=p((function(t,n){return t.groupName===n}));function ft(t,n){return X().some((function(e){return lt(e,t,n)}))}function lt(t,n,e){return!(!t.hasFailures()||e&&!at(t,e)||v(n===rt.WARNINGS,t.warns()))}function dt(t){if(pt(t))return!0;if(ft(rt.ERRORS,t))return!1;var n=X();return!E(n)&&!function(t){return N(x().filter((function(n){return vt(n,t)})))}(t)&&function(t){return X().every((function(n){return!(!t||at(n,t))||Et(n,t)}))}(t)}function pt(t){return!!t&&!0===(null===(n=U(t))||void 0===n?void 0:n[1]);var n}function vt(t,n){return!(n&&!at(t,n))&&!0!==W(t.fieldName)}function Et(t,n){return!(!n||at(t,n))||(!0===W(t.fieldName)||t.isTested()||t.isOmitted())}function Nt(){var t=L.useX().summary;return d(t),t}function mt(){var t=X(),n=r({errorCount:0,warnCount:0,testCount:0},{groups:{},tests:{},valid:!1});return t.reduce((function(t,n){var e=t.tests;e[n.fieldName]=ht(e,n),e[n.fieldName].valid=!1!==e[n.fieldName].valid&&dt(n.fieldName);var r=t.groups,i=n.groupName;return i&&(r[i]=r[i]||{},r[i][n.fieldName]=ht(r[i],n),e=r[i][n.fieldName],!1===r[i][n.fieldName].valid?n=!1:n=!!pt(n=n.fieldName)||!function(t,n,e){return X().some((function(r){return!ct(r,n)&<(r,t,e)}))}(rt.ERRORS,i,n)&&!function(t,n){return N(x().filter((function(e){return!ct(e,t)&&vt(e,n)})))}(i,n)&&function(t,n){return X().every((function(e){return!!ct(e,t)||Et(e,n)}))}(i,n),e.valid=n),t}),n),n.valid=dt(),function(t){for(var n in t.tests)t.errorCount+=t.tests[n].errorCount,t.warnCount+=t.tests[n].warnCount,t.testCount+=t.tests[n].testCount;return t}(n)}function ht(t,n){function e(t){var n=st(t);o[n]++,u&&(o[t]=(o[t]||[]).concat(u))}var i=n.fieldName,u=n.message;t[i]=t[i]||r({errorCount:0,warnCount:0,testCount:0},{errors:[],warnings:[]});var o=t[i];return n.isNonActionable()||(t[i].testCount++,n.isFailing()?e(rt.ERRORS):n.isWarning()&&e(rt.WARNINGS)),o}function gt(t,n,e){var r;return(null===(r=null==t?void 0:t[e])||void 0===r?void 0:r[n])||[]}function yt(t,n){var e,r={},i=st(n);for(e in t)m(t[e][i])&&(r[e]=t[e][n]||[]);return r}function Rt(t){return Ct(rt.ERRORS,t)}function St(t){return Ct(rt.WARNINGS,t)}function Ct(t,n){var e=Nt().tests;return n?gt(e,t,n):yt(e,t)}function Tt(t,n){return _t(t,rt.ERRORS,n)}function bt(t,n){return _t(t,rt.WARNINGS,n)}function _t(t,n,e){return t=Nt().groups[t],e?gt(t,n,e):yt(t,n)}function It(t){return At(ut.ERROR_COUNT,t)}function Ot(t){return At(ut.WARN_COUNT,t)}function At(t,n){var e,r=Nt();return m(n?null===(e=r.tests[n])||void 0===e?void 0:e[t]:r[t])}function kt(t,n){return Ft(rt.ERRORS,t,n)}function Lt(t,n){return Ft(rt.WARNINGS,t,n)}function Ft(t,n,e){var r,i,u=Nt();if(t=st(t),!(n=u.groups[n]))return!1;if(e)return m(null===(r=n[e])||void 0===r?void 0:r[t]);for(var o in n)if(m(null===(i=n[o])||void 0===i?void 0:i[t]))return!0;return!1}function Ut(t){var n=Nt();return t?!!Wt(n.tests,t):n.valid}function Gt(t,n){if(!(t=Nt().groups[t]))return!1;if(n)return Wt(t,n);for(var e in t)if(!Wt(t,e))return!1;return!0}function Wt(t,n){var e;return!(null===(e=t[n])||void 0===e||!e.valid)}var Pt=i(1);function Dt(){var t=X(),n={stateRef:F()};return Pt([t],L.bind(n,(function(){var t=mt(),n=F().suiteName()[0],e={summary:t};return r(t,{getErrors:L.bind(e,Rt),getErrorsByGroup:L.bind(e,Tt),getWarnings:L.bind(e,St),getWarningsByGroup:L.bind(e,bt),hasErrors:L.bind(e,It),hasErrorsByGroup:L.bind(e,kt),hasWarnings:L.bind(e,Ot),hasWarningsByGroup:L.bind(e,Lt),isValid:L.bind(e,Ut),isValidByGroup:L.bind(e,Gt),suiteName:n})})))}function xt(t){var n=x();return!E(n)&&(t?n.some((function(n){return at(n,t)})):N(n))}var wt=i(20);function Xt(){var t=X(),n={stateRef:F()};return wt([t],L.bind(n,(function(){return r({},Dt(),{done:L.bind(n,Mt)})})))}function Ht(t,n,e){return!(c(t)&&(!n||e.tests[n]&&!E(e.tests[n].testCount)))}function Kt(t){return!(xt()&&(!t||xt(t)))}function Mt(){function t(){return r(Dt())}for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var r=(n=n.reverse())[0];return n=n[1],e=Xt(),Ht(r,n,e)?e:Kt(n)?(t(),e):(qt(t,n),e)}function qt(t,n){(0,F().testCallbacks()[1])((function(e){return n?e.fieldCallbacks[n]=(e.fieldCallbacks[n]||[]).concat(t):e.doneCallbacks.push(t),e}))}function Bt(){var t=R.createBus();return t.on(jt.TEST_COMPLETED,(function(n){if(!n.isCanceled()){n.done(),n=n.fieldName;var e=F().testCallbacks()[0].fieldCallbacks;n&&!xt(n)&&g(e[n])&&y(e[n]),xt()||t.emit(jt.ALL_RUNNING_TESTS_FINISHED)}})),t.on(jt.SUITE_CALLBACK_DONE_RUNNING,(function(){!function(){function t(t){e[t.fieldName]&&(t.omit(),G(t.fieldName,(function(t){return[t[0],!0]})))}var n=F().optionalFields()[0];if(!E(n)){var e={};D((function(n){return o.transform(n,(function(n){if(h(e,n.fieldName))t(n);else{var r=W(n.fieldName);c(r)&&(e[n.fieldName]=r(),t(n))}return n}))}))}}()})),t.on(jt.ALL_RUNNING_TESTS_FINISHED,(function(){var t=F().testCallbacks()[0].doneCallbacks;y(t)})),t.on(jt.REMOVE_FIELD,(function(t){X().forEach((function(n){at(n,t)&&(n.cancel(),function(t){D((function(n){return o.transform(n,(function(n){return t!==n?n:null}))}))}(n))}))})),t.on(jt.RESET_FIELD,(function(t){X().forEach((function(n){at(n,t)&&n.reset()}))})),t}function Vt(){var t=L.useX();return d(t.bus),t.bus}var jt,Yt=jt||(jt={});function Jt(t){return Qt(0,"tests",t)}function zt(t){return Qt(1,"tests",t)}function Qt(t,n,r){var i=L.useX("hook called outside of a running suite.");r&&s(r).forEach((function(r){e(r)&&(i.exclusion[n][r]=0===t)}))}function Zt(t){for(var n in t)if(!0===t[n])return!0;return!1}function $t(){var t,n=L.useX().exclusion;for(t in n.groups)if(n.groups[t])return!0;return!1}function tn(t){return"Wrong arguments passed to group. Group ".concat(t,".")}function nn(t,n,e){if(e||2===arguments.length)for(var r,i=0,u=n.length;i<u;i++)!r&&i in n||(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return t.concat(r||Array.prototype.slice.call(n))}function en(t){var n=t.asyncTest,r=t.message;if(C(n)){var i=Vt().emit,u=F(),o=L.bind({stateRef:u},(function(){P(),i(jt.TEST_COMPLETED,t)}));u=L.bind({stateRef:u},(function(n){t.isCanceled()||(t.message=e(n)?n:r,t.fail(),o())}));try{n.then(o,u)}catch(t){u()}}}function rn(t){var n=F().testObjects()[0].prev;if(E(n))return un(t),t;var e=nt();if(n=o.valueAtPath(n,e),!f(t.key)){n=t.key,(e=tt().keys.prev[n])&&(t=e),e=t;var r=tt().keys.current;return f(r[n])?r[n]=e:l('Encountered the same test key "'.concat(n,"\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted.")),un(t),t}return!N(e=n)||e.fieldName===t.fieldName&&e.groupName===t.groupName||(tt().type===b.EACH||l("Vest Critical Error: Tests called in different order than previous run.\n expected: ".concat(n.fieldName,"\n received: ").concat(t.fieldName,'\n This can happen on one of two reasons:\n 1. You\'re using if/else statements to conditionally select tests. Instead, use "skipWhen".\n 2. You are iterating over a list of tests, and their order changed. Use "each" and a custom key prop so that Vest retains their state.')),function(){var t=tt().cursor.current();D((function(n){return n.splice(t),n}))}(),n=null),un(t=S(n,t)),t}function un(t){var n=nt();D((function(e){return o.setValueAtPath(e,n,t)}))}function on(t){var n=tt().cursor,e=I.EAGER;if(L.useX().mode[0]===e&&ft(rt.ERRORS,t.fieldName))return t.skip(),rn(t),n.next(),t;if(e=rn(t),L.useX().omitted)return e.omit(),n.next(),e;if(function(t){var n=t.fieldName;if(t=t.groupName,L.useX().skipped)return!0;var e=L.useX(),r=e.exclusion;e=e.inclusion;var i=r.tests,o=i[n];if(!1===o)return!0;if(o=!0===o,t){var s=L.useX().exclusion.groups;if(s=h(s,t)?!1===s[t]:$t())return!0;if(!0===r.groups[t])return!(o||!Zt(i)&&!1!==i[n])}return!!(t=!!$t()&&!t)||!o&&!!Zt(i)&&!u(e[n])}(t))return e.skip(!!L.useX().skipped),n.next(),e;if(t!==e&&e.fieldName===t.fieldName&&e.groupName===t.groupName&&e.isPending()&&e.cancel(),un(t),t.isUntested()){e=Vt();var r=function(t){return L.run({currentTest:t},(function(){return t.run()}))}(t);try{C(r)?(t.asyncTest=r,t.setPending(),en(t)):e.emit(jt.TEST_COMPLETED,t)}catch(n){throw Error("Unexpected error encountered during test registration.\n Test Object: ".concat(JSON.stringify(t),".\n Error: ").concat(n,"."))}}else C(t.asyncTest)&&(t.setPending(),en(t));return n.next(),t}function sn(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=c(n[1])?n:nn([void 0],n,!0);n=i[0],r=i[1],i=i[2],d(e(t),ln("fieldName","string")),d(c(r),ln("Test callback","function"));var u=L.useX();return on(n=new M(t,r,{message:n,groupName:u.groupName,key:i}))}Yt.TEST_COMPLETED="test_completed",Yt.ALL_RUNNING_TESTS_FINISHED="all_running_tests_finished",Yt.REMOVE_FIELD="remove_field",Yt.RESET_FIELD="reset_field",Yt.SUITE_CALLBACK_DONE_RUNNING="suite_callback_done_running",Jt.group=function(t){return Qt(0,"groups",t)},zt.group=function(t){return Qt(1,"groups",t)},p(e);var an,cn,fn=r(sn,{memo:(an=sn,cn=i(10),function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];e=tt().cursor.current();var r=(n=n.reverse())[0],i=n[1],u=n[2];return e=[F().suiteId()[0],t,e].concat(r),n=cn.get(e),T(n)?cn(e,(function(){return an(t,u,i)})):n[1].isCanceled()?(cn.invalidate(e),cn(e,(function(){return an(t,u,i)}))):on(n[1])})});function ln(t,n){return"Incompatible params passed to test function. ".concat(t," must be a ").concat(n)}var dn="4.4.3-dev-c786f7";function pn(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=(t=t.reverse())[0];t=t[1],d(c(e),"vest.create: Expected callback to be a function.");var i=Bt(),u=Z();return t={stateRef:$(u,{suiteId:a(),suiteName:t}),bus:i},r(L.bind(t,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return u.reset(),et({type:b.SUITE},(function(){e.apply(void 0,t)})),i.emit(jt.SUITE_CALLBACK_DONE_RUNNING),Xt()})),{get:L.bind(t,Dt),remove:L.bind(t,(function(t){i.emit(jt.REMOVE_FIELD,t)})),reset:u.reset,resetField:L.bind(t,(function(t){i.emit(jt.RESET_FIELD,t)}))})}function vn(t,n){d(c(n),"each callback must be a function"),et({type:b.EACH},(function(){t.forEach((function(t,e){n(t,e)}))}))}function En(){var t=I.EAGER;L.useX().mode[0]=t}function Nn(t,n){d(e(t),tn("name must be a string")),d(c(n),tn("callback must be a function")),et({type:b.GROUP},(function(){L.run({groupName:t},n)}))}function mn(t){var n=L.useX(),r=n.inclusion;return n=n.exclusion,d(e(t)),r[t]=S(n.tests[t],!0),{when:function(n){var r=L.useX(),i=r.exclusion;r.inclusion[t]=function(){return h(i.tests,t)?S(i.tests[t],!0):e(n)?!!i.tests[n]:u(n,u(Dt))}}}}function hn(t,n){et({type:b.OMIT_WHEN},(function(){L.run({omitted:!!L.useX().omitted||u(t,u(Dt))},(function(){return n()}))}))}function gn(t){if(g(t)||e(t))s(t).forEach((function(t){G(t,[!0,!1])}));else for(var n in t)G(n,[t[n],!1])}function yn(t,n){et({type:b.SKIP_WHEN},(function(){L.run({skipped:!!L.useX().skipped||u(t,u(Dt))},(function(){return n()}))}))}function Rn(){var t=L.useX("warn hook called outside of a running suite.");d(t.currentTest,"warn called outside of a test."),t.currentTest.warn()}export{dn as VERSION,L as context,pn as create,vn as each,En as eager,Nn as group,mn as include,hn as omitWhen,Jt as only,gn as optional,zt as skip,yn as skipWhen,fn as test,Rn as warn};
|
|
1
|
+
import{createContext as t}from"context";import{isUndefined as n,isStringValue as e,assign as r,cache as i,optionalFunctionValue as u,nestedArray as o,asArray as s,seq as a,isFunction as c,isNullish as f,deferThrow as l,invariant as d,bindNot as p,either as v,isEmpty as E,isNotEmpty as N,isPositive as h,numberEquals as g,hasOwnProperty as m,isArray as y,callEach as R,bus as S,defaultTo as C,isPromise as T,isNull as _}from"vest-utils";export{enforce}from"n4s";var O,I=O||(O={});I[I.DEFAULT=0]="DEFAULT",I[I.SUITE=1]="SUITE",I[I.EACH=2]="EACH",I[I.SKIP_WHEN=3]="SKIP_WHEN",I[I.OMIT_WHEN=4]="OMIT_WHEN",I[I.GROUP=5]="GROUP";var b,A=b||(b={});function k(){var t=0;return{current:function(){return t},next:function(){t++}}}function L(t,n){return void 0===n&&(n=[]),{cursor:k(),keys:{current:{},prev:{}},path:n,type:t}}A[A.ALL=0]="ALL",A[A.EAGER=1]="EAGER";var U=t((function(t,n){return n?null:r({exclusion:{tests:{},groups:{}},inclusion:{},isolate:L(O.DEFAULT),mode:[b.ALL]},t)}));function F(){return U.useX().stateRef}function W(t){return F().optionalFields()[0][t]}function G(t,n){(0,F().optionalFields()[1])((function(e){var i;return r(e,((i={})[t]=u(n,e[t]),i))}))}function P(t){var n;return null===(n=W(t))||void 0===n?void 0:n[0]}function D(){x((function(t){return t}))}function x(t){(0,F().testObjects()[1])((function(n){return{prev:n.prev,current:s(t(n.current))}}))}function w(){return H().filter((function(t){return t.isPending()}))}var X=i();function H(){var t=F().testObjects()[0].current;return X([t],(function(){return o.flatten(t)}))}var K,M=K||(K={});M.Error="error",M.Warning="warning";var q=function(){function t(t,n,e){var r=void 0===e?{}:e;e=r.message;var i=r.groupName;r=r.key,this.key=null,this.id=a(),this.severity=K.Error,this.status=B,this.fieldName=t,this.testFn=n,i&&(this.groupName=i),e&&(this.message=e),r&&(this.key=r)}return t.prototype.run=function(){try{var t=this.testFn()}catch(r){t=r,n(this.message)&&e(t)&&(this.message=r),t=!1}return!1===t&&this.fail(),t},t.prototype.setStatus=function(t){this.isFinalStatus()&&t!==Z||(this.status=t)},t.prototype.warns=function(){return this.severity===K.Warning},t.prototype.setPending=function(){this.setStatus(z)},t.prototype.fail=function(){this.setStatus(this.warns()?Y:j)},t.prototype.done=function(){this.isFinalStatus()||this.setStatus(J)},t.prototype.warn=function(){this.severity=K.Warning},t.prototype.isFinalStatus=function(){return this.hasFailures()||this.isCanceled()||this.isPassing()},t.prototype.skip=function(t){this.isPending()&&!t||this.setStatus(V)},t.prototype.cancel=function(){this.setStatus(Q),D()},t.prototype.reset=function(){this.status=B,D()},t.prototype.omit=function(){this.setStatus(Z)},t.prototype.valueOf=function(){return!this.isFailing()},t.prototype.hasFailures=function(){return this.isFailing()||this.isWarning()},t.prototype.isNonActionable=function(){return this.isSkipped()||this.isOmitted()||this.isCanceled()},t.prototype.isPending=function(){return this.statusEquals(z)},t.prototype.isTested=function(){return this.hasFailures()||this.isPassing()},t.prototype.isOmitted=function(){return this.statusEquals(Z)},t.prototype.isUntested=function(){return this.statusEquals(B)},t.prototype.isFailing=function(){return this.statusEquals(j)},t.prototype.isCanceled=function(){return this.statusEquals(Q)},t.prototype.isSkipped=function(){return this.statusEquals(V)},t.prototype.isPassing=function(){return this.statusEquals(J)},t.prototype.isWarning=function(){return this.statusEquals(Y)},t.prototype.statusEquals=function(t){return this.status===t},t}(),B="UNTESTED",V="SKIPPED",j="FAILED",Y="WARNING",J="PASSING",z="PENDING",Q="CANCELED",Z="OMITTED";function $(t){function n(t,n,i){return r.references.push(),e(t,u(n,i)),function(){return[r.references[t],function(n){return e(t,u(n,r.references[t]))}]}}function e(n,e){var u=r.references[n];r.references[n]=e,n=i[n][1],c(n)&&n(e,u),c(t)&&t()}var r={references:[]},i=[];return{registerStateKey:function(t,e){var r=i.length;return i.push([t,e]),n(r,t)},reset:function(){var t=r.references;r.references=[],i.forEach((function(e,r){return n(r,e[0],t[r])}))}}}function tt(t,n){var e=n.suiteId;return n=n.suiteName,{optionalFields:t.registerStateKey((function(){return{}})),suiteId:t.registerStateKey(e),suiteName:t.registerStateKey(n),testCallbacks:t.registerStateKey((function(){return{fieldCallbacks:{},doneCallbacks:[]}})),testObjects:t.registerStateKey((function(t){return{prev:t?t.current:[],current:[]}}))}}function nt(){return U.useX().isolate}function et(){var t=nt();return t.path.concat(t.cursor.current())}function rt(t,n){t=void 0===(t=t.type)?O.DEFAULT:t,d(c(n));var e=L(t,et());return t=U.run({isolate:e},(function(){return e.keys.prev=function(){var t=F().testObjects()[0].prev;return s(o.getCurrent(t,et())).reduce((function(t,n){return n instanceof q&&!f(n.key)?(t[n.key]=n,t):t}),{})}(),x((function(t){return o.setValueAtPath(t,e.path,[])})),n()})),nt().cursor.next(),t}var it,ut=it||(it={});ut.WARNINGS="warnings",ut.ERRORS="errors";var ot,st=ot||(ot={});function at(t,n){return!(!n||t.fieldName!==n)}st.ERROR_COUNT="errorCount",st.WARN_COUNT="warnCount";var ct=p((function(t,n){return t.groupName===n}));function ft(t,n){return H().some((function(e){return lt(e,t,n)}))}function lt(t,n,e){return!(!t.hasFailures()||e&&!at(t,e)||v(n===it.WARNINGS,t.warns()))}function dt(t){if(pt(t))return!0;if(ft(it.ERRORS,t))return!1;var n=H();return!E(n)&&!function(t){return N(w().filter((function(n){return vt(n,t)})))}(t)&&function(t){return H().every((function(n){return!(!t||at(n,t))||Et(n,t)}))}(t)}function pt(t){return!!t&&!0===(null===(n=W(t))||void 0===n?void 0:n[1]);var n}function vt(t,n){return!(n&&!at(t,n))&&!0!==P(t.fieldName)}function Et(t,n){return!(!n||at(t,n))||(!0===P(t.fieldName)||t.isTested()||t.isOmitted())}function Nt(){var t=H(),n=r({errorCount:0,warnCount:0,testCount:0},{groups:{},tests:{},valid:!1});return t.reduce((function(t,n){var e=t.tests;e[n.fieldName]=ht(e,n),e[n.fieldName].valid=!1!==e[n.fieldName].valid&&dt(n.fieldName);var r=t.groups,i=n.groupName;return i&&(r[i]=r[i]||{},r[i][n.fieldName]=ht(r[i],n),e=r[i][n.fieldName],!1===r[i][n.fieldName].valid?n=!1:n=!!pt(n=n.fieldName)||!function(t,n,e){return H().some((function(r){return!ct(r,n)&<(r,t,e)}))}(it.ERRORS,i,n)&&!function(t,n){return N(w().filter((function(e){return!ct(e,t)&&vt(e,n)})))}(i,n)&&function(t,n){return H().every((function(e){return!!ct(e,t)||Et(e,n)}))}(i,n),e.valid=n),t}),n),n.valid=dt(),function(t){for(var n in t.tests)t.errorCount+=t.tests[n].errorCount,t.warnCount+=t.tests[n].warnCount,t.testCount+=t.tests[n].testCount;return t}(n)}function ht(t,n){function e(t){o[t===it.ERRORS?ot.ERROR_COUNT:ot.WARN_COUNT]++,u&&(o[t]=(o[t]||[]).concat(u))}var i=n.fieldName,u=n.message;t[i]=t[i]||r({errorCount:0,warnCount:0,testCount:0},{errors:[],warnings:[]});var o=t[i];return n.isNonActionable()||(t[i].testCount++,n.isFailing()?e(it.ERRORS):n.isWarning()&&e(it.WARNINGS)),o}function gt(t,n,e){if(e){var r;t=(null===(r=null==t?void 0:t[e])||void 0===r?void 0:r[n])||[]}else{for(var i in r={},e=n===it.ERRORS?ot.ERROR_COUNT:ot.WARN_COUNT,t)h(t[i][e])&&(r[i]=t[i][n]||[]);t=r}return t}function mt(t){return{getErrors:function(n){return gt(t.tests,it.ERRORS,n)},getErrorsByGroup:function(n,e){return gt(t.groups[n],it.ERRORS,e)},getWarnings:function(n){return gt(t.tests,it.WARNINGS,n)},getWarningsByGroup:function(n,e){return gt(t.groups[n],it.WARNINGS,e)},hasErrors:function(n){return St(t,ot.ERROR_COUNT,n)},hasErrorsByGroup:function(n,e){return Rt(t,ot.ERROR_COUNT,n,e)},hasWarnings:function(n){return St(t,ot.WARN_COUNT,n)},hasWarningsByGroup:function(n,e){return Rt(t,ot.WARN_COUNT,n,e)},isValid:function(n){var e;return n?!(null===(e=t.tests[n])||void 0===e||!e.valid):t.valid},isValidByGroup:function(n,e){if(!(n=t.groups[n]))return!1;if(e)return yt(n,e);for(var r in n)if(!yt(n,r))return!1;return!0}}}function yt(t,n){var e;return!(null===(e=t[n])||void 0===e||!e.valid)}function Rt(t,n,e,r){var i,u;if(!(t=t.groups[e]))return!1;if(r)return h(null===(i=t[r])||void 0===i?void 0:i[n]);for(var o in t)if(h(null===(u=t[o])||void 0===u?void 0:u[n]))return!0;return!1}function St(t,n,e){var r;return t=e?null===(r=t.tests[e])||void 0===r?void 0:r[n]:t[n]||0,h(t)}var Ct=i(1);function Tt(){var t=H(),n={stateRef:F()};return Ct([t],U.bind(n,(function(){var t=Nt(),n=F().suiteName()[0];return r(t,mt(t),{suiteName:n})})))}function _t(t){var n=w();return!E(n)&&(!t||n.some((function(n){return at(n,t)})))}var Ot=i(20);function It(){var t=H(),n={stateRef:F()};return Ot([t],U.bind(n,(function(){return r({},Tt(),{done:U.bind(n,kt)})})))}function bt(t,n,e){var r;return!!(!c(t)||n&&g(null===(r=e.tests[n])||void 0===r?void 0:r.testCount,0))}function At(t){return!(_t()&&(!t||_t(t)))}function kt(){function t(){return r(Tt())}for(var n=[],e=0;e<arguments.length;e++)n[e]=arguments[e];var r=(n=n.reverse())[0];return n=n[1],e=It(),bt(r,n,e)?e:At(n)?(t(),e):(Lt(t,n),e)}function Lt(t,n){(0,F().testCallbacks()[1])((function(e){return n?e.fieldCallbacks[n]=(e.fieldCallbacks[n]||[]).concat(t):e.doneCallbacks.push(t),e}))}function Ut(){var t=S.createBus();return t.on(Wt.TEST_COMPLETED,(function(n){if(!n.isCanceled()){n.done(),n=n.fieldName;var e=F().testCallbacks()[0].fieldCallbacks;n&&!_t(n)&&y(e[n])&&R(e[n]),_t()||t.emit(Wt.ALL_RUNNING_TESTS_FINISHED)}})),t.on(Wt.SUITE_CALLBACK_DONE_RUNNING,(function(){!function(){function t(t){e[t.fieldName]&&(t.omit(),G(t.fieldName,(function(t){return[t[0],!0]})))}var n=F().optionalFields()[0];if(!E(n)){var e={};x((function(n){return o.transform(n,(function(n){if(m(e,n.fieldName))t(n);else{var r=P(n.fieldName);c(r)&&(e[n.fieldName]=r(),t(n))}return n}))}))}}()})),t.on(Wt.ALL_RUNNING_TESTS_FINISHED,(function(){var t=F().testCallbacks()[0].doneCallbacks;R(t)})),t.on(Wt.REMOVE_FIELD,(function(t){H().forEach((function(n){at(n,t)&&(n.cancel(),function(t){x((function(n){return o.transform(n,(function(n){return t!==n?n:null}))}))}(n))}))})),t.on(Wt.RESET_FIELD,(function(t){H().forEach((function(n){at(n,t)&&n.reset()}))})),t}function Ft(){var t=U.useX();return d(t.bus),t.bus}var Wt,Gt=Wt||(Wt={});function Pt(t){return xt(0,"tests",t)}function Dt(t){return xt(1,"tests",t)}function xt(t,n,r){var i=U.useX("hook called outside of a running suite.");r&&s(r).forEach((function(r){e(r)&&(i.exclusion[n][r]=0===t)}))}function wt(t){for(var n in t)if(!0===t[n])return!0;return!1}function Xt(){var t,n=U.useX().exclusion;for(t in n.groups)if(n.groups[t])return!0;return!1}function Ht(t){return"Wrong arguments passed to group. Group ".concat(t,".")}function Kt(t,n,e){if(e||2===arguments.length)for(var r,i=0,u=n.length;i<u;i++)!r&&i in n||(r||(r=Array.prototype.slice.call(n,0,i)),r[i]=n[i]);return t.concat(r||Array.prototype.slice.call(n))}function Mt(t){var n=t.asyncTest,r=t.message;if(T(n)){var i=Ft().emit,u=F(),o=U.bind({stateRef:u},(function(){D(),i(Wt.TEST_COMPLETED,t)}));u=U.bind({stateRef:u},(function(n){t.isCanceled()||(t.message=e(n)?n:r,t.fail(),o())}));try{n.then(o,u)}catch(t){u()}}}function qt(t){var n=F().testObjects()[0].prev;if(E(n))return Bt(t),t;var e=et();if(n=o.valueAtPath(n,e),!f(t.key)){n=t.key,(e=nt().keys.prev[n])&&(t=e),e=t;var r=nt().keys.current;return f(r[n])?r[n]=e:l('Encountered the same test key "'.concat(n,"\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted.")),Bt(t),t}return!N(e=n)||e.fieldName===t.fieldName&&e.groupName===t.groupName||(nt().type===O.EACH||l("Vest Critical Error: Tests called in different order than previous run.\n expected: ".concat(n.fieldName,"\n received: ").concat(t.fieldName,'\n This can happen on one of two reasons:\n 1. You\'re using if/else statements to conditionally select tests. Instead, use "skipWhen".\n 2. You are iterating over a list of tests, and their order changed. Use "each" and a custom key prop so that Vest retains their state.')),function(){var t=nt().cursor.current();x((function(n){return n.splice(t),n}))}(),n=null),Bt(t=C(n,t)),t}function Bt(t){var n=et();x((function(e){return o.setValueAtPath(e,n,t)}))}function Vt(t){var n=nt().cursor,e=b.EAGER;if(U.useX().mode[0]===e&&ft(it.ERRORS,t.fieldName))return t.skip(),qt(t),n.next(),t;if(e=qt(t),U.useX().omitted)return e.omit(),n.next(),e;if(function(t){var n=t.fieldName;if(t=t.groupName,U.useX().skipped)return!0;var e=U.useX(),r=e.exclusion;e=e.inclusion;var i=r.tests,o=i[n];if(!1===o)return!0;if(o=!0===o,t){var s=U.useX().exclusion.groups;if(s=m(s,t)?!1===s[t]:Xt())return!0;if(!0===r.groups[t])return!(o||!wt(i)&&!1!==i[n])}return!!(t=!!Xt()&&!t)||!o&&!!wt(i)&&!u(e[n])}(t))return e.skip(!!U.useX().skipped),n.next(),e;if(t!==e&&e.fieldName===t.fieldName&&e.groupName===t.groupName&&e.isPending()&&e.cancel(),Bt(t),t.isUntested()){e=Ft();var r=function(t){return U.run({currentTest:t},(function(){return t.run()}))}(t);try{T(r)?(t.asyncTest=r,t.setPending(),Mt(t)):e.emit(Wt.TEST_COMPLETED,t)}catch(n){throw Error("Unexpected error encountered during test registration.\n Test Object: ".concat(JSON.stringify(t),".\n Error: ").concat(n,"."))}}else T(t.asyncTest)&&(t.setPending(),Mt(t));return n.next(),t}function jt(t){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];var i=c(n[1])?n:Kt([void 0],n,!0);n=i[0],r=i[1],i=i[2],d(e(t),Qt("fieldName","string")),d(c(r),Qt("Test callback","function"));var u=U.useX();return Vt(n=new q(t,r,{message:n,groupName:u.groupName,key:i}))}Gt.TEST_COMPLETED="test_completed",Gt.ALL_RUNNING_TESTS_FINISHED="all_running_tests_finished",Gt.REMOVE_FIELD="remove_field",Gt.RESET_FIELD="reset_field",Gt.SUITE_CALLBACK_DONE_RUNNING="suite_callback_done_running",Pt.group=function(t){return xt(0,"groups",t)},Dt.group=function(t){return xt(1,"groups",t)},p(e);var Yt,Jt,zt=r(jt,{memo:(Yt=jt,Jt=i(10),function(t){for(var n=[],e=1;e<arguments.length;e++)n[e-1]=arguments[e];e=nt().cursor.current();var r=(n=n.reverse())[0],i=n[1],u=n[2];return e=[F().suiteId()[0],t,e].concat(r),n=Jt.get(e),_(n)?Jt(e,(function(){return Yt(t,u,i)})):n[1].isCanceled()?(Jt.invalidate(e),Jt(e,(function(){return Yt(t,u,i)}))):Vt(n[1])})});function Qt(t,n){return"Incompatible params passed to test function. ".concat(t," must be a ").concat(n)}var Zt="4.5.0-dev-9b46fb";function $t(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var e=(t=t.reverse())[0];t=t[1],d(c(e),"vest.create: Expected callback to be a function.");var i=Ut(),u=$();return t={stateRef:tt(u,{suiteId:a(),suiteName:t}),bus:i},r(U.bind(t,(function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return u.reset(),rt({type:O.SUITE},(function(){e.apply(void 0,t)})),i.emit(Wt.SUITE_CALLBACK_DONE_RUNNING),It()})),{get:U.bind(t,Tt),remove:U.bind(t,(function(t){i.emit(Wt.REMOVE_FIELD,t)})),reset:u.reset,resetField:U.bind(t,(function(t){i.emit(Wt.RESET_FIELD,t)}))})}function tn(t,n){d(c(n),"each callback must be a function"),rt({type:O.EACH},(function(){t.forEach((function(t,e){n(t,e)}))}))}function nn(){var t=b.EAGER;U.useX().mode[0]=t}function en(t,n){d(e(t),Ht("name must be a string")),d(c(n),Ht("callback must be a function")),rt({type:O.GROUP},(function(){U.run({groupName:t},n)}))}function rn(t){var n=U.useX(),r=n.inclusion;return n=n.exclusion,d(e(t)),r[t]=C(n.tests[t],!0),{when:function(n){var r=U.useX(),i=r.exclusion;r.inclusion[t]=function(){return m(i.tests,t)?C(i.tests[t],!0):e(n)?!!i.tests[n]:u(n,u(Tt))}}}}function un(t,n){rt({type:O.OMIT_WHEN},(function(){U.run({omitted:!!U.useX().omitted||u(t,u(Tt))},(function(){return n()}))}))}function on(t){if(y(t)||e(t))s(t).forEach((function(t){G(t,[!0,!1])}));else for(var n in t)G(n,[t[n],!1])}function sn(t,n){rt({type:O.SKIP_WHEN},(function(){U.run({skipped:!!U.useX().skipped||u(t,u(Tt))},(function(){return n()}))}))}function an(){var t=U.useX("warn hook called outside of a running suite.");d(t.currentTest,"warn called outside of a test."),t.currentTest.warn()}export{Zt as VERSION,U as context,$t as create,tn as each,nn as eager,en as group,rn as include,un as omitWhen,Pt as only,on as optional,Dt as skip,sn as skipWhen,mt as suiteSelectors,zt as test,an as warn};
|