vest 4.4.0-dev-08ec91 → 4.4.2-dev-afe5de

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.
Files changed (49) hide show
  1. package/dist/cjs/classnames.development.js +9 -60
  2. package/dist/cjs/classnames.production.js +1 -1
  3. package/dist/cjs/enforce/compose.development.js +6 -53
  4. package/dist/cjs/enforce/compose.production.js +1 -1
  5. package/dist/cjs/enforce/compounds.development.js +16 -71
  6. package/dist/cjs/enforce/compounds.production.js +1 -1
  7. package/dist/cjs/enforce/schema.development.js +6 -58
  8. package/dist/cjs/enforce/schema.production.js +1 -1
  9. package/dist/cjs/parser.development.js +8 -59
  10. package/dist/cjs/parser.production.js +1 -1
  11. package/dist/cjs/promisify.development.js +2 -26
  12. package/dist/cjs/promisify.production.js +1 -1
  13. package/dist/cjs/vest.development.js +176 -390
  14. package/dist/cjs/vest.production.js +1 -1
  15. package/dist/es/classnames.development.js +1 -52
  16. package/dist/es/classnames.production.js +1 -1
  17. package/dist/es/enforce/compose.development.js +4 -51
  18. package/dist/es/enforce/compose.production.js +1 -1
  19. package/dist/es/enforce/compounds.development.js +11 -66
  20. package/dist/es/enforce/compounds.production.js +1 -1
  21. package/dist/es/enforce/schema.development.js +2 -54
  22. package/dist/es/enforce/schema.production.js +1 -1
  23. package/dist/es/parser.development.js +1 -52
  24. package/dist/es/parser.production.js +1 -1
  25. package/dist/es/promisify.development.js +1 -25
  26. package/dist/es/promisify.production.js +1 -1
  27. package/dist/es/vest.development.js +101 -315
  28. package/dist/es/vest.production.js +1 -1
  29. package/dist/umd/classnames.development.js +13 -13
  30. package/dist/umd/classnames.production.js +1 -1
  31. package/dist/umd/enforce/compose.development.js +122 -122
  32. package/dist/umd/enforce/compose.production.js +1 -1
  33. package/dist/umd/enforce/compounds.development.js +181 -185
  34. package/dist/umd/enforce/compounds.production.js +1 -1
  35. package/dist/umd/enforce/schema.development.js +133 -133
  36. package/dist/umd/enforce/schema.production.js +1 -1
  37. package/dist/umd/parser.development.js +13 -13
  38. package/dist/umd/parser.production.js +1 -1
  39. package/dist/umd/vest.development.js +361 -376
  40. package/dist/umd/vest.production.js +1 -1
  41. package/package.json +4 -3
  42. package/testUtils/mockThrowError.ts +2 -1
  43. package/testUtils/suiteDummy.ts +1 -1
  44. package/testUtils/testObjects.ts +2 -17
  45. package/types/enforce/compose.d.ts +14 -30
  46. package/types/enforce/compounds.d.ts +14 -30
  47. package/types/enforce/schema.d.ts +14 -30
  48. package/types/vest.d.ts +14 -15
  49. package/testUtils/itWithContext.ts +0 -23
@@ -3,44 +3,14 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var n4s = require('n4s');
6
+ var vestUtils = require('vest-utils');
6
7
  var context$1 = require('context');
7
8
 
8
- /**
9
- * @returns a unique numeric id.
10
- */
11
- var genId = (function (n) { return function () {
12
- return "".concat(n++);
13
- }; })(0);
14
-
15
- function isStringValue(v) {
16
- return String(v) === v;
17
- }
18
-
19
- function bindNot(fn) {
20
- return function () {
21
- var args = [];
22
- for (var _i = 0; _i < arguments.length; _i++) {
23
- args[_i] = arguments[_i];
24
- }
25
- return !fn.apply(void 0, args);
26
- };
27
- }
28
-
29
- function isUndefined(value) {
30
- return value === undefined;
31
- }
32
-
33
9
  function shouldUseErrorAsMessage(message, error) {
34
10
  // kind of cheating with this safe guard, but it does the job
35
- return isUndefined(message) && isStringValue(error);
11
+ return vestUtils.isUndefined(message) && vestUtils.isStringValue(error);
36
12
  }
37
13
 
38
- function asArray(possibleArg) {
39
- return [].concat(possibleArg);
40
- }
41
-
42
- var assign = Object.assign;
43
-
44
14
  function isNumeric(value) {
45
15
  var str = String(value);
46
16
  var num = Number(value);
@@ -101,119 +71,6 @@ function createCache(maxSize) {
101
71
  }
102
72
  }
103
73
 
104
- // The module is named "isArrayValue" since it
105
- // is conflicting with a nested npm dependency.
106
- // We may need to revisit this in the future.
107
- function isArray(value) {
108
- return Boolean(Array.isArray(value));
109
- }
110
-
111
- function isNull(value) {
112
- return value === null;
113
- }
114
- var isNotNull = bindNot(isNull);
115
-
116
- function isFunction(value) {
117
- return typeof value === 'function';
118
- }
119
-
120
- function optionalFunctionValue(value) {
121
- var args = [];
122
- for (var _i = 1; _i < arguments.length; _i++) {
123
- args[_i - 1] = arguments[_i];
124
- }
125
- return isFunction(value) ? value.apply(void 0, args) : value;
126
- }
127
-
128
- function defaultTo(callback, defaultValue) {
129
- var _a;
130
- return (_a = optionalFunctionValue(callback)) !== null && _a !== void 0 ? _a : defaultValue;
131
- }
132
-
133
- function last(values) {
134
- var valuesArray = asArray(values);
135
- return valuesArray[valuesArray.length - 1];
136
- }
137
-
138
- // This is kind of a map/filter in one function.
139
- // Normally, behaves like a nested-array map,
140
- // but returning `null` will drop the element from the array
141
- function transform(array, cb) {
142
- var res = [];
143
- for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
144
- var v = array_1[_i];
145
- if (isArray(v)) {
146
- res.push(transform(v, cb));
147
- }
148
- else {
149
- var output = cb(v);
150
- if (isNotNull(output)) {
151
- res.push(output);
152
- }
153
- }
154
- }
155
- return res;
156
- }
157
- function valueAtPath(array, path) {
158
- return getCurrent(array, path)[last(path)];
159
- }
160
- function setValueAtPath(array, path, value) {
161
- var current = getCurrent(array, path);
162
- current[last(path)] = value;
163
- return array;
164
- }
165
- function flatten(values) {
166
- return asArray(values).reduce(function (acc, value) {
167
- if (isArray(value)) {
168
- return acc.concat(flatten(value));
169
- }
170
- return asArray(acc).concat(value);
171
- }, []);
172
- }
173
- function getCurrent(array, path) {
174
- var current = array;
175
- for (var _i = 0, _a = path.slice(0, -1); _i < _a.length; _i++) {
176
- var p = _a[_i];
177
- current[p] = defaultTo(current[p], []);
178
- current = current[p];
179
- }
180
- return current;
181
- }
182
-
183
- function createCursor() {
184
- var storage = {
185
- cursor: []
186
- };
187
- function addLevel() {
188
- storage.cursor.push(0);
189
- }
190
- function removeLevel() {
191
- storage.cursor.pop();
192
- }
193
- function cursorAt() {
194
- return last(storage.cursor);
195
- }
196
- function getCursor() {
197
- return asArray(storage.cursor);
198
- }
199
- function next() {
200
- storage.cursor[storage.cursor.length - 1]++;
201
- return last(storage.cursor);
202
- }
203
- function reset() {
204
- storage.cursor = [0];
205
- }
206
- reset();
207
- return {
208
- addLevel: addLevel,
209
- cursorAt: cursorAt,
210
- getCursor: getCursor,
211
- next: next,
212
- removeLevel: removeLevel,
213
- reset: reset
214
- };
215
- }
216
-
217
74
  var IsolateTypes;
218
75
  (function (IsolateTypes) {
219
76
  IsolateTypes[IsolateTypes["DEFAULT"] = 0] = "DEFAULT";
@@ -230,24 +87,52 @@ var Modes;
230
87
  Modes[Modes["EAGER"] = 1] = "EAGER";
231
88
  })(Modes || (Modes = {}));
232
89
 
90
+ function createIsolateCursor() {
91
+ var cursor = {
92
+ value: 0
93
+ };
94
+ return {
95
+ current: current,
96
+ next: next
97
+ };
98
+ /**
99
+ * @returns {number} The current value of the cursor
100
+ */
101
+ function current() {
102
+ return cursor.value;
103
+ }
104
+ /**
105
+ * Moves the isolate cursor forward by 1
106
+ */
107
+ function next() {
108
+ cursor.value++;
109
+ }
110
+ }
111
+
112
+ function generateIsolate(type, path) {
113
+ if (path === void 0) { path = []; }
114
+ return {
115
+ cursor: createIsolateCursor(),
116
+ keys: {
117
+ current: {},
118
+ prev: {}
119
+ },
120
+ path: path,
121
+ type: type
122
+ };
123
+ }
124
+
233
125
  var context = context$1.createContext(function (ctxRef, parentContext) {
234
126
  return parentContext
235
127
  ? null
236
- : assign({}, {
128
+ : vestUtils.assign({}, {
237
129
  exclusion: {
238
130
  tests: {},
239
131
  groups: {}
240
132
  },
241
133
  inclusion: {},
242
- isolate: {
243
- type: IsolateTypes.DEFAULT,
244
- keys: {
245
- current: {},
246
- prev: {}
247
- }
248
- },
249
- mode: [Modes.ALL],
250
- testCursor: createCursor()
134
+ isolate: generateIsolate(IsolateTypes.DEFAULT),
135
+ mode: [Modes.ALL]
251
136
  }, ctxRef);
252
137
  });
253
138
 
@@ -278,8 +163,8 @@ function useSetOptionalField(fieldName, setter) {
278
163
  var _a = useOptionalFields(), setOptionalFields = _a[1];
279
164
  setOptionalFields(function (optionalFields) {
280
165
  var _a;
281
- return assign(optionalFields, (_a = {},
282
- _a[fieldName] = optionalFunctionValue(setter, optionalFields[fieldName]),
166
+ return vestUtils.assign(optionalFields, (_a = {},
167
+ _a[fieldName] = vestUtils.optionalFunctionValue(setter, optionalFields[fieldName]),
283
168
  _a));
284
169
  });
285
170
  }
@@ -304,7 +189,7 @@ function useSetTests(handler) {
304
189
  var current = _a.current, prev = _a.prev;
305
190
  return ({
306
191
  prev: prev,
307
- current: asArray(handler(current))
192
+ current: vestUtils.asArray(handler(current))
308
193
  });
309
194
  });
310
195
  }
@@ -315,7 +200,7 @@ function useAllIncomplete() {
315
200
  var flatCache = createCache();
316
201
  function useTestsFlat() {
317
202
  var current = useTestObjects()[0].current;
318
- return flatCache([current], function () { return flatten(current); });
203
+ return flatCache([current], function () { return vestUtils.nestedArray.flatten(current); });
319
204
  }
320
205
  function useEachTestObject(handler) {
321
206
  var testObjects = useTestsFlat();
@@ -331,7 +216,7 @@ var VestTest = /** @class */ (function () {
331
216
  function VestTest(fieldName, testFn, _a) {
332
217
  var _b = _a === void 0 ? {} : _a, message = _b.message, groupName = _b.groupName, key = _b.key;
333
218
  this.key = null;
334
- this.id = genId();
219
+ this.id = vestUtils.genId();
335
220
  this.severity = TestSeverity.Error;
336
221
  this.status = STATUS_UNTESTED;
337
222
  this.fieldName = fieldName;
@@ -466,20 +351,6 @@ var STATUS_PENDING = 'PENDING';
466
351
  var STATUS_CANCELED = 'CANCELED';
467
352
  var STATUS_OMITTED = 'OMITTED';
468
353
 
469
- function invariant(condition,
470
- // eslint-disable-next-line @typescript-eslint/ban-types
471
- message) {
472
- if (condition) {
473
- return;
474
- }
475
- // If message is a string object (rather than string literal)
476
- // Throw the value directly as a string
477
- // Alternatively, throw an error with the message
478
- throw message instanceof String
479
- ? message.valueOf()
480
- : new Error(message ? optionalFunctionValue(message) : message);
481
- }
482
-
483
354
  // eslint-disable-next-line max-lines-per-function
484
355
  function createState(onStateChange) {
485
356
  var state = {
@@ -518,12 +389,12 @@ function createState(onStateChange) {
518
389
  }
519
390
  function initKey(key, initialState, prevState) {
520
391
  current().push();
521
- set(key, optionalFunctionValue(initialState, prevState));
392
+ set(key, vestUtils.optionalFunctionValue(initialState, prevState));
522
393
  return function useStateKey() {
523
394
  return [
524
395
  current()[key],
525
396
  function (nextState) {
526
- return set(key, optionalFunctionValue(nextState, current()[key]));
397
+ return set(key, vestUtils.optionalFunctionValue(nextState, current()[key]));
527
398
  },
528
399
  ];
529
400
  };
@@ -535,10 +406,10 @@ function createState(onStateChange) {
535
406
  var prevValue = state.references[index];
536
407
  state.references[index] = value;
537
408
  var _a = registrations[index], onUpdate = _a[1];
538
- if (isFunction(onUpdate)) {
409
+ if (vestUtils.isFunction(onUpdate)) {
539
410
  onUpdate(value, prevValue);
540
411
  }
541
- if (isFunction(onStateChange)) {
412
+ if (vestUtils.isFunction(onStateChange)) {
542
413
  onStateChange();
543
414
  }
544
415
  }
@@ -563,44 +434,13 @@ function createStateRef(state, _a) {
563
434
  };
564
435
  }
565
436
 
566
- function isNullish(value) {
567
- return isNull(value) || isUndefined(value);
568
- }
569
-
570
- function deferThrow(message) {
571
- setTimeout(function () {
572
- throw new Error(message);
573
- }, 0);
574
- }
575
-
576
- function usePath() {
577
- var context$1 = context.useX();
578
- return context$1.testCursor.getCursor();
579
- }
580
- function useCursorAt() {
581
- var context$1 = context.useX();
582
- return context$1.testCursor.cursorAt();
583
- }
584
- function moveForward() {
585
- var context$1 = context.useX();
586
- return context$1.testCursor.next();
587
- }
588
- function addLevel() {
589
- var context$1 = context.useX();
590
- context$1.testCursor.addLevel();
591
- }
592
- function removeLevel() {
593
- var context$1 = context.useX();
594
- context$1.testCursor.removeLevel();
595
- }
596
-
597
437
  function usePrevKeys() {
598
438
  var prev = useTestObjects()[0].prev;
599
- return asArray(getCurrent(prev, usePath())).reduce(function (prevKeys, testObject) {
439
+ return vestUtils.asArray(vestUtils.nestedArray.getCurrent(prev, useCurrentPath())).reduce(function (prevKeys, testObject) {
600
440
  if (!(testObject instanceof VestTest)) {
601
441
  return prevKeys;
602
442
  }
603
- if (isNullish(testObject.key)) {
443
+ if (vestUtils.isNullish(testObject.key)) {
604
444
  return prevKeys;
605
445
  }
606
446
  prevKeys[testObject.key] = testObject;
@@ -608,40 +448,58 @@ function usePrevKeys() {
608
448
  }, {});
609
449
  }
610
450
  function usePrevTestByKey(key) {
611
- var prev = context.useX().isolate.keys.prev;
451
+ var prev = useIsolate().keys.prev;
612
452
  return prev[key];
613
453
  }
614
454
  function useRetainTestKey(key, testObject) {
615
- var context$1 = context.useX();
616
- var current = context$1.isolate.keys.current;
617
- if (isNullish(current[key])) {
455
+ var current = useIsolate().keys.current;
456
+ if (vestUtils.isNullish(current[key])) {
618
457
  current[key] = testObject;
619
458
  }
620
459
  else {
621
- deferThrow("Encountered the same test key \"".concat(key, "\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted."));
460
+ vestUtils.deferThrow("Encountered the same test key \"".concat(key, "\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted."));
622
461
  }
623
462
  }
624
463
 
625
464
  function isolate(_a, callback) {
626
465
  var _b = _a.type, type = _b === void 0 ? IsolateTypes.DEFAULT : _b;
627
- invariant(isFunction(callback));
628
- var keys = {
629
- current: {},
630
- prev: {}
631
- };
632
- var path = usePath();
633
- return context.run({ isolate: { type: type, keys: keys } }, function () {
634
- addLevel();
635
- keys.prev = usePrevKeys();
636
- useSetTests(function (tests) { return setValueAtPath(tests, path, []); });
466
+ vestUtils.invariant(vestUtils.isFunction(callback));
467
+ // Generate a new Isolate layer, with its own cursor
468
+ var isolate = generateIsolate(type, useCurrentPath());
469
+ var output = context.run({ isolate: isolate }, function () {
470
+ isolate.keys.prev = usePrevKeys();
471
+ useSetTests(function (tests) { return vestUtils.nestedArray.setValueAtPath(tests, isolate.path, []); });
637
472
  var res = callback();
638
- removeLevel();
639
- moveForward();
640
473
  return res;
641
474
  });
475
+ // Move the parent cursor forward once we're done
476
+ useCursor().next();
477
+ return output;
478
+ }
479
+ /**
480
+ * @returns {Isolate} The current isolate layer
481
+ */
482
+ function useIsolate() {
483
+ return context.useX().isolate;
642
484
  }
485
+ /**
486
+ * @returns {boolean} Whether or not the current isolate allows tests to be reordered
487
+ */
643
488
  function shouldAllowReorder() {
644
- return context.useX().isolate.type === IsolateTypes.EACH;
489
+ return useIsolate().type === IsolateTypes.EACH;
490
+ }
491
+ /**
492
+ * @returns {number[]} The current cursor path of the isolate tree
493
+ */
494
+ function useCurrentPath() {
495
+ var isolate = useIsolate();
496
+ return isolate.path.concat(isolate.cursor.current());
497
+ }
498
+ /**
499
+ * @returns {IsolateCursor} The cursor object for the current isolate
500
+ */
501
+ function useCursor() {
502
+ return useIsolate().cursor;
645
503
  }
646
504
 
647
505
  var Severity;
@@ -660,34 +518,6 @@ function countKeyBySeverity(severity) {
660
518
  : SeverityCount.WARN_COUNT;
661
519
  }
662
520
 
663
- /**
664
- * A safe hasOwnProperty access
665
- */
666
- function hasOwnProperty(obj, key) {
667
- return Object.prototype.hasOwnProperty.call(obj, key);
668
- }
669
-
670
- function isNumber(value) {
671
- return Boolean(typeof value === 'number');
672
- }
673
-
674
- function isEmpty(value) {
675
- if (!value) {
676
- return true;
677
- }
678
- else if (isNumber(value)) {
679
- return value === 0;
680
- }
681
- else if (hasOwnProperty(value, 'length')) {
682
- return lengthEquals(value, 0);
683
- }
684
- else if (typeof value === 'object') {
685
- return lengthEquals(Object.keys(value), 0);
686
- }
687
- return false;
688
- }
689
- var isNotEmpty = bindNot(isEmpty);
690
-
691
521
  function nonMatchingFieldName(testObject, fieldName) {
692
522
  return !!fieldName && !matchingFieldName(testObject, fieldName);
693
523
  }
@@ -695,20 +525,16 @@ function matchingFieldName(testObject, fieldName) {
695
525
  return !!(fieldName && testObject.fieldName === fieldName);
696
526
  }
697
527
 
698
- var nonMatchingGroupName = bindNot(matchingGroupName);
528
+ var nonMatchingGroupName = vestUtils.bindNot(matchingGroupName);
699
529
  function matchingGroupName(testObject, groupName) {
700
530
  return testObject.groupName === groupName;
701
531
  }
702
532
 
703
- function either(a, b) {
704
- return !!a !== !!b;
705
- }
706
-
707
533
  /**
708
534
  * Checks that a given test object matches the currently specified severity level
709
535
  */
710
536
  function nonMatchingSeverityProfile(severity, testObject) {
711
- return either(severity === Severity.WARNINGS, testObject.warns());
537
+ return vestUtils.either(severity === Severity.WARNINGS, testObject.warns());
712
538
  }
713
539
 
714
540
  /**
@@ -758,7 +584,7 @@ function shouldAddValidProperty(fieldName) {
758
584
  return false;
759
585
  }
760
586
  var testObjects = useTestsFlat();
761
- if (isEmpty(testObjects)) {
587
+ if (vestUtils.isEmpty(testObjects)) {
762
588
  return false;
763
589
  }
764
590
  // Does the given field have any pending tests that are not optional?
@@ -788,13 +614,13 @@ function fieldIsOmitted(fieldName) {
788
614
  }
789
615
  // Does the given field have any pending tests that are not optional?
790
616
  function hasNonOptionalIncomplete(fieldName) {
791
- return isNotEmpty(useAllIncomplete().filter(function (testObject) {
617
+ return vestUtils.isNotEmpty(useAllIncomplete().filter(function (testObject) {
792
618
  return isOptionalFieldIncomplete(testObject, fieldName);
793
619
  }));
794
620
  }
795
621
  // Do the given group/field have any pending tests that are not optional?
796
622
  function hasNonOptionalIncompleteByGroup(groupName, fieldName) {
797
- return isNotEmpty(useAllIncomplete().filter(function (testObject) {
623
+ return vestUtils.isNotEmpty(useAllIncomplete().filter(function (testObject) {
798
624
  if (nonMatchingGroupName(testObject, groupName)) {
799
625
  return false;
800
626
  }
@@ -836,7 +662,7 @@ function missingTestsLogic(testObject, fieldName) {
836
662
 
837
663
  function useSummary() {
838
664
  var summary = context.useX().summary;
839
- invariant(summary);
665
+ vestUtils.invariant(summary);
840
666
  return summary;
841
667
  }
842
668
  /**
@@ -844,7 +670,7 @@ function useSummary() {
844
670
  */
845
671
  function genTestsSummary() {
846
672
  var testObjects = useTestsFlat();
847
- var summary = assign(baseStats(), {
673
+ var summary = vestUtils.assign(baseStats(), {
848
674
  groups: {},
849
675
  tests: {},
850
676
  valid: false
@@ -921,16 +747,12 @@ function baseStats() {
921
747
  };
922
748
  }
923
749
  function baseTestStats() {
924
- return assign(baseStats(), {
750
+ return vestUtils.assign(baseStats(), {
925
751
  errors: [],
926
752
  warnings: []
927
753
  });
928
754
  }
929
755
 
930
- function isPositive(value) {
931
- return greaterThan(value, 0);
932
- }
933
-
934
756
  // calls collectAll or getByFieldName depending on whether fieldName is provided
935
757
  function gatherFailures(testGroup, severityKey, fieldName) {
936
758
  return fieldName
@@ -945,7 +767,7 @@ function collectAll(testGroup, severityKey) {
945
767
  var output = {};
946
768
  var countKey = countKeyBySeverity(severityKey);
947
769
  for (var field in testGroup) {
948
- if (isPositive(testGroup[field][countKey])) {
770
+ if (vestUtils.isPositive(testGroup[field][countKey])) {
949
771
  // We will probably never get to the fallback array
950
772
  // leaving it just in case the implementation changes
951
773
  output[field] = testGroup[field][severityKey] || [];
@@ -989,9 +811,9 @@ function hasFailures(severityCount, fieldName) {
989
811
  var _a;
990
812
  var summary = useSummary();
991
813
  if (fieldName) {
992
- return isPositive((_a = summary.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[severityCount]);
814
+ return vestUtils.isPositive((_a = summary.tests[fieldName]) === null || _a === void 0 ? void 0 : _a[severityCount]);
993
815
  }
994
- return isPositive(summary[severityCount]);
816
+ return vestUtils.isPositive(summary[severityCount]);
995
817
  }
996
818
 
997
819
  function hasErrorsByGroup(groupName, fieldName) {
@@ -1010,10 +832,10 @@ function hasFailuresByGroup(severityKey, groupName, fieldName) {
1010
832
  return false;
1011
833
  }
1012
834
  if (fieldName) {
1013
- return isPositive((_a = group[fieldName]) === null || _a === void 0 ? void 0 : _a[severityCount]);
835
+ return vestUtils.isPositive((_a = group[fieldName]) === null || _a === void 0 ? void 0 : _a[severityCount]);
1014
836
  }
1015
837
  for (var field in group) {
1016
- if (isPositive((_b = group[field]) === null || _b === void 0 ? void 0 : _b[severityCount])) {
838
+ if (vestUtils.isPositive((_b = group[field]) === null || _b === void 0 ? void 0 : _b[severityCount])) {
1017
839
  return true;
1018
840
  }
1019
841
  }
@@ -1055,7 +877,7 @@ function produceSuiteResult() {
1055
877
  var summary = genTestsSummary();
1056
878
  var suiteName = useSuiteName();
1057
879
  var ref = { summary: summary };
1058
- return assign(summary, {
880
+ return vestUtils.assign(summary, {
1059
881
  getErrors: context.bind(ref, getErrors),
1060
882
  getErrorsByGroup: context.bind(ref, getErrorsByGroup),
1061
883
  getWarnings: context.bind(ref, getWarnings),
@@ -1076,7 +898,7 @@ function produceSuiteResult() {
1076
898
  */
1077
899
  function hasRemainingTests(fieldName) {
1078
900
  var allIncomplete = useAllIncomplete();
1079
- if (isEmpty(allIncomplete)) {
901
+ if (vestUtils.isEmpty(allIncomplete)) {
1080
902
  return false;
1081
903
  }
1082
904
  if (fieldName) {
@@ -1084,7 +906,7 @@ function hasRemainingTests(fieldName) {
1084
906
  return matchingFieldName(testObject, fieldName);
1085
907
  });
1086
908
  }
1087
- return isNotEmpty(allIncomplete);
909
+ return vestUtils.isNotEmpty(allIncomplete);
1088
910
  }
1089
911
 
1090
912
  var cache = createCache(20);
@@ -1092,7 +914,7 @@ function produceFullResult() {
1092
914
  var testObjects = useTestsFlat();
1093
915
  var ctxRef = { stateRef: useStateRef() };
1094
916
  return cache([testObjects], context.bind(ctxRef, function () {
1095
- return assign({}, produceSuiteResult(), {
917
+ return vestUtils.assign({}, produceSuiteResult(), {
1096
918
  done: context.bind(ctxRef, done)
1097
919
  });
1098
920
  }));
@@ -1102,9 +924,9 @@ function produceFullResult() {
1102
924
  */
1103
925
  function shouldSkipDoneRegistration(callback, fieldName, output) {
1104
926
  // If we do not have any test runs for the current field
1105
- return !!(!isFunction(callback) ||
927
+ return !!(!vestUtils.isFunction(callback) ||
1106
928
  (fieldName &&
1107
- (!output.tests[fieldName] || isEmpty(output.tests[fieldName].testCount))));
929
+ (!output.tests[fieldName] || vestUtils.isEmpty(output.tests[fieldName].testCount))));
1108
930
  }
1109
931
  function shouldRunDoneCallback(fieldName) {
1110
932
  // is suite finished || field name exists, and test is finished;
@@ -1146,38 +968,16 @@ function deferDoneCallback(doneCallback, fieldName) {
1146
968
  });
1147
969
  }
1148
970
 
1149
- function createBus() {
1150
- var listeners = {};
1151
- return {
1152
- emit: function (event, data) {
1153
- listener(event).forEach(function (handler) {
1154
- handler(data);
1155
- });
1156
- },
1157
- on: function (event, handler) {
1158
- listeners[event] = listener(event).concat(handler);
1159
- return {
1160
- off: function () {
1161
- listeners[event] = listener(event).filter(function (h) { return h !== handler; });
1162
- }
1163
- };
1164
- }
1165
- };
1166
- function listener(event) {
1167
- return listeners[event] || [];
1168
- }
1169
- }
1170
-
1171
971
  function omitOptionalFields() {
1172
972
  var optionalFields = useOptionalFields()[0];
1173
- if (isEmpty(optionalFields)) {
973
+ if (vestUtils.isEmpty(optionalFields)) {
1174
974
  return;
1175
975
  }
1176
976
  var shouldOmit = {};
1177
977
  useSetTests(function (tests) {
1178
- return transform(tests, function (testObject) {
978
+ return vestUtils.nestedArray.transform(tests, function (testObject) {
1179
979
  var fieldName = testObject.fieldName;
1180
- if (hasOwnProperty(shouldOmit, fieldName)) {
980
+ if (vestUtils.hasOwnProperty(shouldOmit, fieldName)) {
1181
981
  verifyAndOmit(testObject);
1182
982
  }
1183
983
  else {
@@ -1194,7 +994,7 @@ function omitOptionalFields() {
1194
994
  }
1195
995
  function runOptionalConfig(testObject) {
1196
996
  var optionalConfig = useOptionalFieldConfig(testObject.fieldName);
1197
- if (isFunction(optionalConfig)) {
997
+ if (vestUtils.isFunction(optionalConfig)) {
1198
998
  shouldOmit[testObject.fieldName] = optionalConfig();
1199
999
  verifyAndOmit(testObject);
1200
1000
  }
@@ -1206,14 +1006,10 @@ function omitOptionalFields() {
1206
1006
  */
1207
1007
  function removeTestFromState (testObject) {
1208
1008
  useSetTests(function (tests) {
1209
- return transform(tests, function (test) { return (testObject !== test ? test : null); });
1009
+ return vestUtils.nestedArray.transform(tests, function (test) { return (testObject !== test ? test : null); });
1210
1010
  });
1211
1011
  }
1212
1012
 
1213
- function callEach(arr) {
1214
- return arr.forEach(function (fn) { return fn(); });
1215
- }
1216
-
1217
1013
  /**
1218
1014
  * Runs done callback per field when async tests are finished running.
1219
1015
  */
@@ -1221,8 +1017,8 @@ function runFieldCallbacks(fieldName) {
1221
1017
  var fieldCallbacks = useTestCallbacks()[0].fieldCallbacks;
1222
1018
  if (fieldName &&
1223
1019
  !hasRemainingTests(fieldName) &&
1224
- isArray(fieldCallbacks[fieldName])) {
1225
- callEach(fieldCallbacks[fieldName]);
1020
+ vestUtils.isArray(fieldCallbacks[fieldName])) {
1021
+ vestUtils.callEach(fieldCallbacks[fieldName]);
1226
1022
  }
1227
1023
  }
1228
1024
  /**
@@ -1230,15 +1026,15 @@ function runFieldCallbacks(fieldName) {
1230
1026
  */
1231
1027
  function runDoneCallbacks() {
1232
1028
  var doneCallbacks = useTestCallbacks()[0].doneCallbacks;
1233
- callEach(doneCallbacks);
1029
+ vestUtils.callEach(doneCallbacks);
1234
1030
  }
1235
1031
 
1236
1032
  // eslint-disable-next-line max-lines-per-function
1237
1033
  function initBus() {
1238
- var bus = createBus();
1034
+ var vestBus = vestUtils.bus.createBus();
1239
1035
  // Report a the completion of a test. There may be other tests with the same
1240
1036
  // name that are still running, or not yet started.
1241
- bus.on(Events.TEST_COMPLETED, function (testObject) {
1037
+ vestBus.on(Events.TEST_COMPLETED, function (testObject) {
1242
1038
  if (testObject.isCanceled()) {
1243
1039
  return;
1244
1040
  }
@@ -1246,21 +1042,21 @@ function initBus() {
1246
1042
  runFieldCallbacks(testObject.fieldName);
1247
1043
  if (!hasRemainingTests()) {
1248
1044
  // When no more tests are running, emit the done event
1249
- bus.emit(Events.ALL_RUNNING_TESTS_FINISHED);
1045
+ vestBus.emit(Events.ALL_RUNNING_TESTS_FINISHED);
1250
1046
  }
1251
1047
  });
1252
1048
  // Report that the suite completed its synchronous test run.
1253
1049
  // Async operations may still be running.
1254
- bus.on(Events.SUITE_CALLBACK_DONE_RUNNING, function () {
1050
+ vestBus.on(Events.SUITE_CALLBACK_DONE_RUNNING, function () {
1255
1051
  // Remove tests that are optional and need to be omitted
1256
1052
  omitOptionalFields();
1257
1053
  });
1258
1054
  // Called when all the tests, including async, are done running
1259
- bus.on(Events.ALL_RUNNING_TESTS_FINISHED, function () {
1055
+ vestBus.on(Events.ALL_RUNNING_TESTS_FINISHED, function () {
1260
1056
  runDoneCallbacks();
1261
1057
  });
1262
1058
  // Removes a certain field from the state.
1263
- bus.on(Events.REMOVE_FIELD, function (fieldName) {
1059
+ vestBus.on(Events.REMOVE_FIELD, function (fieldName) {
1264
1060
  useEachTestObject(function (testObject) {
1265
1061
  if (matchingFieldName(testObject, fieldName)) {
1266
1062
  testObject.cancel();
@@ -1269,18 +1065,18 @@ function initBus() {
1269
1065
  });
1270
1066
  });
1271
1067
  // Resets a certain field in the state.
1272
- bus.on(Events.RESET_FIELD, function (fieldName) {
1068
+ vestBus.on(Events.RESET_FIELD, function (fieldName) {
1273
1069
  useEachTestObject(function (testObject) {
1274
1070
  if (matchingFieldName(testObject, fieldName)) {
1275
1071
  testObject.reset();
1276
1072
  }
1277
1073
  });
1278
1074
  });
1279
- return bus;
1075
+ return vestBus;
1280
1076
  }
1281
1077
  function useBus() {
1282
1078
  var context$1 = context.useX();
1283
- invariant(context$1.bus);
1079
+ vestUtils.invariant(context$1.bus);
1284
1080
  return context$1.bus;
1285
1081
  }
1286
1082
  var Events;
@@ -1299,16 +1095,16 @@ function create() {
1299
1095
  args[_i] = arguments[_i];
1300
1096
  }
1301
1097
  var _a = args.reverse(), suiteCallback = _a[0], suiteName = _a[1];
1302
- invariant(isFunction(suiteCallback), 'vest.create: Expected callback to be a function.');
1098
+ vestUtils.invariant(vestUtils.isFunction(suiteCallback), 'vest.create: Expected callback to be a function.');
1303
1099
  // Event bus initialization
1304
1100
  var bus = initBus();
1305
1101
  // State initialization
1306
1102
  var state = createState();
1307
1103
  // State reference - this holds the actual state values
1308
- var stateRef = createStateRef(state, { suiteId: genId(), suiteName: suiteName });
1104
+ var stateRef = createStateRef(state, { suiteId: vestUtils.genId(), suiteName: suiteName });
1309
1105
  // Create base context reference. All hooks will derive their data from this
1310
1106
  var ctxRef = { stateRef: stateRef, bus: bus };
1311
- var suite = assign(
1107
+ var suite = vestUtils.assign(
1312
1108
  // Bind the suite body to the context
1313
1109
  context.bind(ctxRef, function () {
1314
1110
  var args = [];
@@ -1354,7 +1150,7 @@ function create() {
1354
1150
  * })
1355
1151
  */
1356
1152
  function each(list, callback) {
1357
- invariant(isFunction(callback), 'each callback must be a function');
1153
+ vestUtils.invariant(vestUtils.isFunction(callback), 'each callback must be a function');
1358
1154
  isolate({ type: IsolateTypes.EACH }, function () {
1359
1155
  list.forEach(function (arg, index) {
1360
1156
  callback(arg, index);
@@ -1384,7 +1180,7 @@ function skipWhen(conditional, callback) {
1384
1180
  // we should skip the test if the parent conditional is true.
1385
1181
  isExcludedIndividually() ||
1386
1182
  // Otherwise, we should skip the test if the conditional is true.
1387
- optionalFunctionValue(conditional, optionalFunctionValue(produceSuiteResult))
1183
+ vestUtils.optionalFunctionValue(conditional, vestUtils.optionalFunctionValue(produceSuiteResult))
1388
1184
  }, function () { return callback(); });
1389
1185
  });
1390
1186
  }
@@ -1460,7 +1256,7 @@ function isExcluded(testObject) {
1460
1256
  // Check if inclusion rules for this field (`include` hook)
1461
1257
  // TODO: Check if this may need to be moved outside of the condition.
1462
1258
  // What if there are no included tests? This shouldn't run then?
1463
- return !optionalFunctionValue(inclusion[fieldName]);
1259
+ return !vestUtils.optionalFunctionValue(inclusion[fieldName]);
1464
1260
  }
1465
1261
  // We're done here. This field is not excluded
1466
1262
  return false;
@@ -1472,7 +1268,7 @@ function isGroupExcluded(groupName) {
1472
1268
  var context$1 = context.useX();
1473
1269
  var exclusion = context$1.exclusion;
1474
1270
  var keyGroups = exclusion.groups;
1475
- var groupPresent = hasOwnProperty(keyGroups, groupName);
1271
+ var groupPresent = vestUtils.hasOwnProperty(keyGroups, groupName);
1476
1272
  // When group is either only'ed or skipped
1477
1273
  if (groupPresent) {
1478
1274
  // Return true if group is skipped and false if only'ed
@@ -1490,8 +1286,8 @@ function addTo(exclusionGroup, itemType, item) {
1490
1286
  if (!item) {
1491
1287
  return;
1492
1288
  }
1493
- asArray(item).forEach(function (itemName) {
1494
- if (!isStringValue(itemName)) {
1289
+ vestUtils.asArray(item).forEach(function (itemName) {
1290
+ if (!vestUtils.isStringValue(itemName)) {
1495
1291
  return;
1496
1292
  }
1497
1293
  context$1.exclusion[itemType][itemName] =
@@ -1538,8 +1334,8 @@ function hasIncludedGroups() {
1538
1334
  * });
1539
1335
  */
1540
1336
  function group(groupName, tests) {
1541
- invariant(isStringValue(groupName), groupErrorMsg('name must be a string'));
1542
- invariant(isFunction(tests), groupErrorMsg('callback must be a function'));
1337
+ vestUtils.invariant(vestUtils.isStringValue(groupName), groupErrorMsg('name must be a string'));
1338
+ vestUtils.invariant(vestUtils.isFunction(tests), groupErrorMsg('callback must be a function'));
1543
1339
  // Running with the context applied
1544
1340
  isolate({ type: IsolateTypes.GROUP }, function () {
1545
1341
  context.run({ groupName: groupName }, tests);
@@ -1552,24 +1348,24 @@ function groupErrorMsg(error) {
1552
1348
  function include(fieldName) {
1553
1349
  var context$1 = context.useX();
1554
1350
  var inclusion = context$1.inclusion, exclusion = context$1.exclusion;
1555
- invariant(isStringValue(fieldName));
1556
- inclusion[fieldName] = defaultTo(exclusion.tests[fieldName], true);
1351
+ vestUtils.invariant(vestUtils.isStringValue(fieldName));
1352
+ inclusion[fieldName] = vestUtils.defaultTo(exclusion.tests[fieldName], true);
1557
1353
  return { when: when };
1558
1354
  function when(condition) {
1559
1355
  var context$1 = context.useX();
1560
1356
  var inclusion = context$1.inclusion, exclusion = context$1.exclusion;
1561
1357
  // This callback will run as part of the "isExcluded" series of checks
1562
1358
  inclusion[fieldName] = function () {
1563
- if (hasOwnProperty(exclusion.tests, fieldName)) {
1359
+ if (vestUtils.hasOwnProperty(exclusion.tests, fieldName)) {
1564
1360
  // I suspect this code is technically unreachable because
1565
1361
  // if there are any skip/only rules applied to the current
1566
1362
  // field, the "isExcluded" function will have already bailed
1567
- return defaultTo(exclusion.tests[fieldName], true);
1363
+ return vestUtils.defaultTo(exclusion.tests[fieldName], true);
1568
1364
  }
1569
- if (isStringValue(condition)) {
1365
+ if (vestUtils.isStringValue(condition)) {
1570
1366
  return Boolean(exclusion.tests[condition]);
1571
1367
  }
1572
- return optionalFunctionValue(condition, optionalFunctionValue(produceSuiteResult));
1368
+ return vestUtils.optionalFunctionValue(condition, vestUtils.optionalFunctionValue(produceSuiteResult));
1573
1369
  };
1574
1370
  }
1575
1371
  }
@@ -1597,9 +1393,7 @@ function eager() {
1597
1393
  setMode(Modes.EAGER);
1598
1394
  }
1599
1395
  function shouldSkipBasedOnMode(testObject) {
1600
- if (isEager() && hasErrorsByTestObjects(testObject.fieldName))
1601
- return true;
1602
- return false;
1396
+ return isEager() && hasErrorsByTestObjects(testObject.fieldName);
1603
1397
  }
1604
1398
  function isEager() {
1605
1399
  return isMode(Modes.EAGER);
@@ -1626,7 +1420,7 @@ function omitWhen(conditional, callback) {
1626
1420
  isolate({ type: IsolateTypes.OMIT_WHEN }, function () {
1627
1421
  context.run({
1628
1422
  omitted: isOmitted() ||
1629
- optionalFunctionValue(conditional, optionalFunctionValue(produceSuiteResult))
1423
+ vestUtils.optionalFunctionValue(conditional, vestUtils.optionalFunctionValue(produceSuiteResult))
1630
1424
  }, function () { return callback(); });
1631
1425
  });
1632
1426
  }
@@ -1648,8 +1442,8 @@ function isOmitted() {
1648
1442
  function optional(optionals) {
1649
1443
  // When the optional is given as a string or a list of strings
1650
1444
  // we just add them to the list of optional fields.
1651
- if (isArray(optionals) || isStringValue(optionals)) {
1652
- asArray(optionals).forEach(function (optionalField) {
1445
+ if (vestUtils.isArray(optionals) || vestUtils.isStringValue(optionals)) {
1446
+ vestUtils.asArray(optionals).forEach(function (optionalField) {
1653
1447
  useSetOptionalField(optionalField, [true, false]);
1654
1448
  });
1655
1449
  }
@@ -1663,7 +1457,7 @@ function optional(optionals) {
1663
1457
  }
1664
1458
  }
1665
1459
 
1666
- /*! *****************************************************************************
1460
+ /******************************************************************************
1667
1461
  Copyright (c) Microsoft Corporation.
1668
1462
 
1669
1463
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1688,9 +1482,7 @@ function __spreadArray(to, from, pack) {
1688
1482
  return to.concat(ar || Array.prototype.slice.call(from));
1689
1483
  }
1690
1484
 
1691
- function isPromise(value) {
1692
- return value && isFunction(value.then);
1693
- }
1485
+ vestUtils.bindNot(vestUtils.isStringValue);
1694
1486
 
1695
1487
  function isSameProfileTest(testObject1, testObject2) {
1696
1488
  return (testObject1.fieldName === testObject2.fieldName &&
@@ -1710,7 +1502,7 @@ function cancelOverriddenPendingTest(prevRunTestObject, currentRunTestObject) {
1710
1502
  */
1711
1503
  function runAsyncTest(testObject) {
1712
1504
  var asyncTest = testObject.asyncTest, message = testObject.message;
1713
- if (!isPromise(asyncTest))
1505
+ if (!vestUtils.isPromise(asyncTest))
1714
1506
  return;
1715
1507
  var emit = useBus().emit;
1716
1508
  var stateRef = useStateRef();
@@ -1723,7 +1515,7 @@ function runAsyncTest(testObject) {
1723
1515
  if (testObject.isCanceled()) {
1724
1516
  return;
1725
1517
  }
1726
- testObject.message = isStringValue(rejectionMessage)
1518
+ testObject.message = vestUtils.isStringValue(rejectionMessage)
1727
1519
  ? rejectionMessage
1728
1520
  : message;
1729
1521
  testObject.fail();
@@ -1758,7 +1550,7 @@ function registerTest(testObject) {
1758
1550
  try {
1759
1551
  // try catch for safe property access
1760
1552
  // in case object is an enforce chain
1761
- if (isPromise(result)) {
1553
+ if (vestUtils.isPromise(result)) {
1762
1554
  testObject.asyncTest = result;
1763
1555
  testObject.setPending();
1764
1556
  runAsyncTest(testObject);
@@ -1785,12 +1577,12 @@ function registerTest(testObject) {
1785
1577
  function useTestAtCursor(newTestObject) {
1786
1578
  var testObjects = useTestObjects()[0];
1787
1579
  var prevTests = testObjects.prev;
1788
- if (isEmpty(prevTests)) {
1580
+ if (vestUtils.isEmpty(prevTests)) {
1789
1581
  useSetTestAtCursor(newTestObject);
1790
1582
  return newTestObject;
1791
1583
  }
1792
1584
  var prevTest = useGetTestAtCursor(prevTests);
1793
- if (!isNullish(newTestObject.key)) {
1585
+ if (!vestUtils.isNullish(newTestObject.key)) {
1794
1586
  var nextTest_1 = handleKeyTest(newTestObject.key, newTestObject);
1795
1587
  useSetTestAtCursor(nextTest_1);
1796
1588
  return nextTest_1;
@@ -1801,45 +1593,38 @@ function useTestAtCursor(newTestObject) {
1801
1593
  // Need to see if this has any effect at all.
1802
1594
  prevTest = null;
1803
1595
  }
1804
- var nextTest = defaultTo(prevTest, newTestObject);
1596
+ var nextTest = vestUtils.defaultTo(prevTest, newTestObject);
1805
1597
  useSetTestAtCursor(nextTest);
1806
1598
  return nextTest;
1807
1599
  }
1808
1600
  function removeAllNextTestsInIsolate() {
1809
- var _a = useTestObjects(), testObjects = _a[0], setTestObjects = _a[1];
1810
- var prevTests = testObjects.prev;
1811
- var current = getCurrent(prevTests, usePath());
1812
- var cursorAt = useCursorAt();
1813
- current.splice(cursorAt);
1601
+ var cursorAt = useCursor().current();
1814
1602
  // We actually don't mind mutating the state directly (as can be seen above). There is no harm in it
1815
1603
  // since we're only touching the "prev" state. The reason we still use the setter function is
1816
1604
  // to prevent future headaches if we ever do need to rely on prev-state immutability.
1817
- setTestObjects(function (_a) {
1818
- var current = _a.current;
1819
- return ({
1820
- prev: prevTests,
1821
- current: current
1822
- });
1605
+ useSetTests(function (current) {
1606
+ current.splice(cursorAt);
1607
+ return current;
1823
1608
  });
1824
1609
  }
1825
1610
  function useSetTestAtCursor(testObject) {
1826
- var cursorPath = usePath();
1611
+ var cursorPath = useCurrentPath();
1827
1612
  useSetTests(function (tests) {
1828
- return setValueAtPath(tests, cursorPath, testObject);
1613
+ return vestUtils.nestedArray.setValueAtPath(tests, cursorPath, testObject);
1829
1614
  });
1830
1615
  }
1831
1616
  function useGetTestAtCursor(tests) {
1832
- var cursorPath = usePath();
1833
- return valueAtPath(tests, cursorPath);
1617
+ var cursorPath = useCurrentPath();
1618
+ return vestUtils.nestedArray.valueAtPath(tests, cursorPath);
1834
1619
  }
1835
1620
  function testReorderDetected(prevTest, newTest) {
1836
- return isNotEmpty(prevTest) && !isSameProfileTest(prevTest, newTest);
1621
+ return vestUtils.isNotEmpty(prevTest) && !isSameProfileTest(prevTest, newTest);
1837
1622
  }
1838
1623
  function throwTestOrderError(prevTest, newTestObject) {
1839
1624
  if (shouldAllowReorder()) {
1840
1625
  return;
1841
1626
  }
1842
- deferThrow("Vest Critical Error: Tests called in different order than previous run.\n expected: ".concat(prevTest.fieldName, "\n received: ").concat(newTestObject.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."));
1627
+ vestUtils.deferThrow("Vest Critical Error: Tests called in different order than previous run.\n expected: ".concat(prevTest.fieldName, "\n received: ").concat(newTestObject.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."));
1843
1628
  }
1844
1629
  function handleKeyTest(key, newTestObject) {
1845
1630
  var prevTestByKey = usePrevTestByKey(key);
@@ -1853,16 +1638,17 @@ function handleKeyTest(key, newTestObject) {
1853
1638
 
1854
1639
  // eslint-disable-next-line max-statements
1855
1640
  function registerPrevRunTest(testObject) {
1641
+ var cursor = useCursor();
1856
1642
  if (shouldSkipBasedOnMode(testObject)) {
1857
1643
  testObject.skip();
1858
1644
  useTestAtCursor(testObject);
1859
- moveForward();
1645
+ cursor.next();
1860
1646
  return testObject;
1861
1647
  }
1862
1648
  var prevRunTest = useTestAtCursor(testObject);
1863
1649
  if (isOmitted()) {
1864
1650
  prevRunTest.omit();
1865
- moveForward();
1651
+ cursor.next();
1866
1652
  return prevRunTest;
1867
1653
  }
1868
1654
  if (isExcluded(testObject)) {
@@ -1871,20 +1657,20 @@ function registerPrevRunTest(testObject) {
1871
1657
  // This mostly means that we're probably giving
1872
1658
  // up on this async test intentionally.
1873
1659
  prevRunTest.skip(isExcludedIndividually());
1874
- moveForward();
1660
+ cursor.next();
1875
1661
  return prevRunTest;
1876
1662
  }
1877
1663
  cancelOverriddenPendingTest(prevRunTest, testObject);
1878
1664
  useSetTestAtCursor(testObject);
1879
- moveForward();
1880
1665
  registerTestObjectByTier(testObject);
1666
+ cursor.next();
1881
1667
  return testObject;
1882
1668
  }
1883
1669
  function registerTestObjectByTier(testObject) {
1884
1670
  if (testObject.isUntested()) {
1885
1671
  registerTest(testObject);
1886
1672
  }
1887
- else if (isPromise(testObject.asyncTest)) {
1673
+ else if (vestUtils.isPromise(testObject.asyncTest)) {
1888
1674
  testObject.setPending();
1889
1675
  runAsyncTest(testObject);
1890
1676
  }
@@ -1900,12 +1686,12 @@ function bindTestMemo(test) {
1900
1686
  for (var _i = 1; _i < arguments.length; _i++) {
1901
1687
  args[_i - 1] = arguments[_i];
1902
1688
  }
1903
- var cursorAt = useCursorAt();
1689
+ var cursorAt = useCursor().current();
1904
1690
  var _a = args.reverse(), deps = _a[0], testFn = _a[1], msg = _a[2];
1905
1691
  // Implicit dependency for more specificity
1906
1692
  var dependencies = [useSuiteId(), fieldName, cursorAt].concat(deps);
1907
1693
  var cached = cache.get(dependencies);
1908
- if (isNull(cached)) {
1694
+ if (vestUtils.isNull(cached)) {
1909
1695
  // cache miss
1910
1696
  return cache(dependencies, function () { return test(fieldName, msg, testFn); });
1911
1697
  }
@@ -1924,9 +1710,9 @@ function testBase(fieldName) {
1924
1710
  for (var _i = 1; _i < arguments.length; _i++) {
1925
1711
  args[_i - 1] = arguments[_i];
1926
1712
  }
1927
- var _a = (isFunction(args[1]) ? args : __spreadArray([undefined], args, true)), message = _a[0], testFn = _a[1], key = _a[2];
1928
- invariant(isStringValue(fieldName), incompatibleParamsError('fieldName', 'string'));
1929
- invariant(isFunction(testFn), incompatibleParamsError('Test callback', 'function'));
1713
+ var _a = (vestUtils.isFunction(args[1]) ? args : __spreadArray([undefined], args, true)), message = _a[0], testFn = _a[1], key = _a[2];
1714
+ vestUtils.invariant(vestUtils.isStringValue(fieldName), incompatibleParamsError('fieldName', 'string'));
1715
+ vestUtils.invariant(vestUtils.isFunction(testFn), incompatibleParamsError('Test callback', 'function'));
1930
1716
  var context$1 = context.useX();
1931
1717
  var testObject = new VestTest(fieldName, testFn, {
1932
1718
  message: message,
@@ -1944,7 +1730,7 @@ function testBase(fieldName) {
1944
1730
  * enforce(data.username).isNotBlank();
1945
1731
  * });
1946
1732
  */
1947
- var test = assign(testBase, {
1733
+ var test = vestUtils.assign(testBase, {
1948
1734
  memo: bindTestMemo(testBase)
1949
1735
  });
1950
1736
  function incompatibleParamsError(name, expected) {
@@ -1958,11 +1744,11 @@ var ERROR_OUTSIDE_OF_TEST = "warn hook called outside of a test callback. It won
1958
1744
  */
1959
1745
  function warn() {
1960
1746
  var ctx = context.useX('warn ' + ERROR_HOOK_CALLED_OUTSIDE);
1961
- invariant(ctx.currentTest, ERROR_OUTSIDE_OF_TEST);
1747
+ vestUtils.invariant(ctx.currentTest, ERROR_OUTSIDE_OF_TEST);
1962
1748
  ctx.currentTest.warn();
1963
1749
  }
1964
1750
 
1965
- var VERSION = "4.4.0-dev-08ec91";
1751
+ var VERSION = "4.4.2-dev-afe5de";
1966
1752
 
1967
1753
  Object.defineProperty(exports, 'enforce', {
1968
1754
  enumerable: true,