vest 4.1.0 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -509,7 +509,7 @@
509
509
  return ruleReturn(result);
510
510
  }
511
511
  else {
512
- return ruleReturn(result.pass, optionalFunctionValue.apply(void 0, __spreadArray([result.message, ruleName, value], args)));
512
+ return ruleReturn(result.pass, optionalFunctionValue.apply(void 0, __spreadArray([result.message, ruleName, value], args, false)));
513
513
  }
514
514
  }
515
515
  function validateResult(result) {
@@ -543,12 +543,12 @@
543
543
  for (var _i = 0; _i < arguments.length; _i++) {
544
544
  args[_i] = arguments[_i];
545
545
  }
546
- var transformedResult = transformResult.apply(void 0, __spreadArray([ctx.run({ value: value }, function () { return rule.apply(void 0, __spreadArray([value], args)); }),
546
+ var transformedResult = transformResult.apply(void 0, __spreadArray([ctx.run({ value: value }, function () { return rule.apply(void 0, __spreadArray([value], args, false)); }),
547
547
  ruleName,
548
- value], args));
548
+ value], args, false));
549
549
  if (!transformedResult.pass) {
550
550
  if (isEmpty(transformedResult.message)) {
551
- throwError("enforce/" + ruleName + " failed with " + JSON.stringify(value));
551
+ throwError("enforce/".concat(ruleName, " failed with ").concat(JSON.stringify(value)));
552
552
  }
553
553
  else {
554
554
  // Explicitly throw a string so that vest.test can pick it up as the validation error message
@@ -590,7 +590,7 @@
590
590
  }
591
591
  var rule = getRule(ruleName);
592
592
  registeredRules.push(function (value) {
593
- return transformResult.apply(void 0, __spreadArray([rule.apply(void 0, __spreadArray([value], args)), ruleName, value], args));
593
+ return transformResult.apply(void 0, __spreadArray([rule.apply(void 0, __spreadArray([value], args, false)), ruleName, value], args, false));
594
594
  });
595
595
  var proxy = {
596
596
  run: function (value) {
@@ -690,7 +690,7 @@
690
690
  * @returns a unique numeric id.
691
691
  */
692
692
  var genId = (function (n) { return function () {
693
- return "" + n++;
693
+ return "".concat(n++);
694
694
  }; })(0);
695
695
 
696
696
  // eslint-disable-next-line max-lines-per-function
@@ -829,6 +829,12 @@
829
829
  };
830
830
  }
831
831
 
832
+ var Modes;
833
+ (function (Modes) {
834
+ Modes[Modes["ALL"] = 0] = "ALL";
835
+ Modes[Modes["EAGER"] = 1] = "EAGER";
836
+ })(Modes || (Modes = {}));
837
+
832
838
  var context = createContext(function (ctxRef, parentContext) {
833
839
  return parentContext
834
840
  ? null
@@ -845,13 +851,14 @@
845
851
  prev: {}
846
852
  }
847
853
  },
854
+ mode: [Modes.ALL],
848
855
  testCursor: createCursor()
849
856
  }, ctxRef);
850
857
  });
851
858
 
852
- // This is sort of a map/filter in one function.
853
- // Normally, behaves like a nested-array map
854
- // Returning `null` will drop the element from the array
859
+ // This is kind of a map/filter in one function.
860
+ // Normally, behaves like a nested-array map,
861
+ // but returning `null` will drop the element from the array
855
862
  function transform(array, cb) {
856
863
  var res = [];
857
864
  for (var _i = 0, array_1 = array; _i < array_1.length; _i++) {
@@ -918,23 +925,22 @@
918
925
  };
919
926
  // invalidate an item in the cache by its dependencies
920
927
  cache.invalidate = function (deps) {
921
- var index = cacheStorage.findIndex(function (_a) {
922
- var cachedDeps = _a[0];
923
- return lengthEquals(deps, cachedDeps.length) &&
924
- deps.every(function (dep, i) { return dep === cachedDeps[i]; });
925
- });
928
+ var index = findIndex(deps);
926
929
  if (index > -1)
927
930
  cacheStorage.splice(index, 1);
928
931
  };
929
932
  // Retrieves an item from the cache.
930
933
  cache.get = function (deps) {
931
- return cacheStorage[cacheStorage.findIndex(function (_a) {
934
+ return cacheStorage[findIndex(deps)] || null;
935
+ };
936
+ return cache;
937
+ function findIndex(deps) {
938
+ return cacheStorage.findIndex(function (_a) {
932
939
  var cachedDeps = _a[0];
933
940
  return lengthEquals(deps, cachedDeps.length) &&
934
941
  deps.every(function (dep, i) { return dep === cachedDeps[i]; });
935
- })] || null;
936
- };
937
- return cache;
942
+ });
943
+ }
938
944
  }
939
945
 
940
946
  // STATE REF
@@ -1112,31 +1118,34 @@
1112
1118
  return this.isSkipped() || this.isOmitted() || this.isCanceled();
1113
1119
  };
1114
1120
  VestTest.prototype.isPending = function () {
1115
- return this.status === STATUS_PENDING;
1121
+ return this.statusEquals(STATUS_PENDING);
1116
1122
  };
1117
1123
  VestTest.prototype.isTested = function () {
1118
1124
  return this.hasFailures() || this.isPassing();
1119
1125
  };
1120
1126
  VestTest.prototype.isOmitted = function () {
1121
- return this.status === STATUS_OMITTED;
1127
+ return this.statusEquals(STATUS_OMITTED);
1122
1128
  };
1123
1129
  VestTest.prototype.isUntested = function () {
1124
- return this.status === STATUS_UNTESTED;
1130
+ return this.statusEquals(STATUS_UNTESTED);
1125
1131
  };
1126
1132
  VestTest.prototype.isFailing = function () {
1127
- return this.status === STATUS_FAILED;
1133
+ return this.statusEquals(STATUS_FAILED);
1128
1134
  };
1129
1135
  VestTest.prototype.isCanceled = function () {
1130
- return this.status === STATUS_CANCELED;
1136
+ return this.statusEquals(STATUS_CANCELED);
1131
1137
  };
1132
1138
  VestTest.prototype.isSkipped = function () {
1133
- return this.status === STATUS_SKIPPED;
1139
+ return this.statusEquals(STATUS_SKIPPED);
1134
1140
  };
1135
1141
  VestTest.prototype.isPassing = function () {
1136
- return this.status === STATUS_PASSING;
1142
+ return this.statusEquals(STATUS_PASSING);
1137
1143
  };
1138
1144
  VestTest.prototype.isWarning = function () {
1139
- return this.status === STATUS_WARNING;
1145
+ return this.statusEquals(STATUS_WARNING);
1146
+ };
1147
+ VestTest.prototype.statusEquals = function (status) {
1148
+ return this.status === status;
1140
1149
  };
1141
1150
  return VestTest;
1142
1151
  }());
@@ -1194,7 +1203,7 @@
1194
1203
  current[key] = testObject;
1195
1204
  }
1196
1205
  else {
1197
- throwErrorDeferred("Encountered the same test key \"" + key + "\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted.");
1206
+ throwErrorDeferred("Encountered the same test key \"".concat(key, "\" twice. This may lead to tests overriding each other's results, or to tests being unexpectedly omitted."));
1198
1207
  }
1199
1208
  }
1200
1209
 
@@ -1245,18 +1254,21 @@
1245
1254
  return isNotEmpty(allIncomplete);
1246
1255
  }
1247
1256
 
1257
+ var Severity;
1258
+ (function (Severity) {
1259
+ Severity["WARNINGS"] = "warnings";
1260
+ Severity["ERRORS"] = "errors";
1261
+ })(Severity || (Severity = {}));
1262
+
1248
1263
  /**
1249
1264
  * Reads the testObjects list and gets full validation result from it.
1250
1265
  */
1251
1266
  function genTestsSummary() {
1252
1267
  var testObjects = useTestsFlat();
1253
- var summary = {
1254
- errorCount: 0,
1268
+ var summary = assign(baseStats(), {
1255
1269
  groups: {},
1256
- testCount: 0,
1257
- tests: {},
1258
- warnCount: 0
1259
- };
1270
+ tests: {}
1271
+ });
1260
1272
  appendSummary(testObjects);
1261
1273
  return countFailures(summary);
1262
1274
  function appendSummary(testObjects) {
@@ -1284,30 +1296,34 @@
1284
1296
  // eslint-disable-next-line max-statements
1285
1297
  function genTestObject(summaryKey, testObject) {
1286
1298
  var fieldName = testObject.fieldName, message = testObject.message;
1287
- summaryKey[fieldName] = summaryKey[fieldName] || {
1288
- errorCount: 0,
1289
- warnCount: 0,
1290
- testCount: 0
1291
- };
1299
+ summaryKey[fieldName] = summaryKey[fieldName] || baseStats();
1292
1300
  var testKey = summaryKey[fieldName];
1293
1301
  if (testObject.isNonActionable())
1294
1302
  return testKey;
1295
1303
  summaryKey[fieldName].testCount++;
1296
1304
  // Adds to severity group
1297
- function addTo(countKey, group) {
1305
+ function addTo(severity) {
1306
+ var countKey = severity === Severity.ERRORS ? 'errorCount' : 'warnCount';
1298
1307
  testKey[countKey]++;
1299
1308
  if (message) {
1300
- testKey[group] = (testKey[group] || []).concat(message);
1309
+ testKey[severity] = (testKey[severity] || []).concat(message);
1301
1310
  }
1302
1311
  }
1303
1312
  if (testObject.isFailing()) {
1304
- addTo('errorCount', 'errors');
1313
+ addTo(Severity.ERRORS);
1305
1314
  }
1306
1315
  else if (testObject.isWarning()) {
1307
- addTo('warnCount', 'warnings');
1316
+ addTo(Severity.WARNINGS);
1308
1317
  }
1309
1318
  return testKey;
1310
1319
  }
1320
+ function baseStats() {
1321
+ return {
1322
+ errorCount: 0,
1323
+ warnCount: 0,
1324
+ testCount: 0
1325
+ };
1326
+ }
1311
1327
 
1312
1328
  function either(a, b) {
1313
1329
  return !!a !== !!b;
@@ -1317,7 +1333,7 @@
1317
1333
  * Checks that a given test object matches the currently specified severity level
1318
1334
  */
1319
1335
  function nonMatchingSeverityProfile(severity, testObject) {
1320
- return either(severity === 'warnings', testObject.warns());
1336
+ return either(severity === Severity.WARNINGS, testObject.warns());
1321
1337
  }
1322
1338
 
1323
1339
  function collectFailureMessages(severity, testObjects, options) {
@@ -1359,10 +1375,10 @@
1359
1375
  }
1360
1376
 
1361
1377
  function getErrors(fieldName) {
1362
- return getFailures('errors', fieldName);
1378
+ return getFailures(Severity.ERRORS, fieldName);
1363
1379
  }
1364
1380
  function getWarnings(fieldName) {
1365
- return getFailures('warnings', fieldName);
1381
+ return getFailures(Severity.WARNINGS, fieldName);
1366
1382
  }
1367
1383
  /**
1368
1384
  * @returns suite or field's errors or warnings.
@@ -1376,11 +1392,11 @@
1376
1392
  }
1377
1393
 
1378
1394
  function getErrorsByGroup(groupName, fieldName) {
1379
- var errors = getByGroup('errors', groupName, fieldName);
1395
+ var errors = getByGroup(Severity.ERRORS, groupName, fieldName);
1380
1396
  return getFailuresArrayOrObject(errors, fieldName);
1381
1397
  }
1382
1398
  function getWarningsByGroup(groupName, fieldName) {
1383
- var warnings = getByGroup('warnings', groupName, fieldName);
1399
+ var warnings = getByGroup(Severity.WARNINGS, groupName, fieldName);
1384
1400
  return getFailuresArrayOrObject(warnings, fieldName);
1385
1401
  }
1386
1402
  /**
@@ -1388,7 +1404,7 @@
1388
1404
  */
1389
1405
  function getByGroup(severityKey, group, fieldName) {
1390
1406
  if (!group) {
1391
- throwError("get" + severityKey[0].toUpperCase() + severityKey.slice(1) + "ByGroup requires a group name. Received `" + group + "` instead.");
1407
+ throwError("get".concat(severityKey[0].toUpperCase()).concat(severityKey.slice(1), "ByGroup requires a group name. Received `").concat(group, "` instead."));
1392
1408
  }
1393
1409
  var testObjects = useTestsFlat();
1394
1410
  return collectFailureMessages(severityKey, testObjects, {
@@ -1414,10 +1430,10 @@
1414
1430
  }
1415
1431
 
1416
1432
  function hasErrors(fieldName) {
1417
- return has('errors', fieldName);
1433
+ return has(Severity.ERRORS, fieldName);
1418
1434
  }
1419
1435
  function hasWarnings(fieldName) {
1420
- return has('warnings', fieldName);
1436
+ return has(Severity.WARNINGS, fieldName);
1421
1437
  }
1422
1438
  function has(severityKey, fieldName) {
1423
1439
  var testObjects = useTestsFlat();
@@ -1427,10 +1443,10 @@
1427
1443
  }
1428
1444
 
1429
1445
  function hasErrorsByGroup(groupName, fieldName) {
1430
- return hasByGroup('errors', groupName, fieldName);
1446
+ return hasByGroup(Severity.ERRORS, groupName, fieldName);
1431
1447
  }
1432
1448
  function hasWarningsByGroup(groupName, fieldName) {
1433
- return hasByGroup('warnings', groupName, fieldName);
1449
+ return hasByGroup(Severity.WARNINGS, groupName, fieldName);
1434
1450
  }
1435
1451
  /**
1436
1452
  * Checks whether there are failures in a given group.
@@ -1583,18 +1599,12 @@
1583
1599
  var listeners = {};
1584
1600
  return {
1585
1601
  emit: function (event, data) {
1586
- if (!listeners[event]) {
1587
- return;
1588
- }
1589
- listeners[event].forEach(function (listener) {
1590
- listener(data);
1602
+ (listeners[event] || []).forEach(function (handler) {
1603
+ handler(data);
1591
1604
  });
1592
1605
  },
1593
1606
  on: function (event, handler) {
1594
- if (!listeners[event]) {
1595
- listeners[event] = [];
1596
- }
1597
- listeners[event].push(handler);
1607
+ listeners[event] = (listeners[event] || []).concat(handler);
1598
1608
  return {
1599
1609
  off: function () {
1600
1610
  listeners[event] = listeners[event].filter(function (h) { return h !== handler; });
@@ -1662,9 +1672,7 @@
1662
1672
  */
1663
1673
  function runDoneCallbacks() {
1664
1674
  var doneCallbacks = useTestCallbacks()[0].doneCallbacks;
1665
- if (!hasRemainingTests()) {
1666
- callEach(doneCallbacks);
1667
- }
1675
+ callEach(doneCallbacks);
1668
1676
  }
1669
1677
 
1670
1678
  // eslint-disable-next-line max-lines-per-function
@@ -1678,14 +1686,21 @@
1678
1686
  }
1679
1687
  testObject.done();
1680
1688
  runFieldCallbacks(testObject.fieldName);
1681
- runDoneCallbacks();
1689
+ if (!hasRemainingTests()) {
1690
+ // When no more tests are running, emit the done event
1691
+ bus.emit(Events.ALL_RUNNING_TESTS_FINISHED);
1692
+ }
1682
1693
  });
1683
1694
  // Report that the suite completed its synchronous test run.
1684
1695
  // Async operations may still be running.
1685
- bus.on(Events.SUITE_COMPLETED, function () {
1696
+ bus.on(Events.SUITE_CALLBACK_DONE_RUNNING, function () {
1686
1697
  // Remove tests that are optional and need to be omitted
1687
1698
  omitOptionalTests();
1688
1699
  });
1700
+ // Called when all the tests, including async, are done running
1701
+ bus.on(Events.ALL_RUNNING_TESTS_FINISHED, function () {
1702
+ runDoneCallbacks();
1703
+ });
1689
1704
  // Removes a certain field from the state.
1690
1705
  bus.on(Events.REMOVE_FIELD, function (fieldName) {
1691
1706
  useEachTestObject(function (testObject) {
@@ -1715,9 +1730,10 @@
1715
1730
  var Events;
1716
1731
  (function (Events) {
1717
1732
  Events["TEST_COMPLETED"] = "test_completed";
1733
+ Events["ALL_RUNNING_TESTS_FINISHED"] = "all_running_tests_finished";
1718
1734
  Events["REMOVE_FIELD"] = "remove_field";
1719
1735
  Events["RESET_FIELD"] = "reset_field";
1720
- Events["SUITE_COMPLETED"] = "suite_completed";
1736
+ Events["SUITE_CALLBACK_DONE_RUNNING"] = "suite_callback_done_running";
1721
1737
  })(Events || (Events = {}));
1722
1738
 
1723
1739
  // eslint-disable-next-line max-lines-per-function
@@ -1754,7 +1770,7 @@
1754
1770
  });
1755
1771
  // Report the suite is done registering tests
1756
1772
  // Async tests may still be running
1757
- bus.emit(Events.SUITE_COMPLETED);
1773
+ bus.emit(Events.SUITE_CALLBACK_DONE_RUNNING);
1758
1774
  // Return the result
1759
1775
  return produceFullResult();
1760
1776
  }), {
@@ -1785,7 +1801,7 @@
1785
1801
  */
1786
1802
  function each(list, callback) {
1787
1803
  if (!isFunction(callback)) {
1788
- throwError('callback must be a function');
1804
+ throwError('each callback must be a function');
1789
1805
  }
1790
1806
  isolate({ type: IsolateTypes.EACH }, function () {
1791
1807
  list.forEach(function (arg, index) {
@@ -1799,6 +1815,31 @@
1799
1815
  */
1800
1816
  var ERROR_HOOK_CALLED_OUTSIDE = 'hook called outside of a running suite.';
1801
1817
 
1818
+ /**
1819
+ * Conditionally skips running tests within the callback.
1820
+ *
1821
+ * @example
1822
+ *
1823
+ * skipWhen(res => res.hasErrors('username'), () => {
1824
+ * test('username', 'User already taken', async () => await doesUserExist(username)
1825
+ * });
1826
+ */
1827
+ function skipWhen(conditional, callback) {
1828
+ isolate({ type: IsolateTypes.SKIP_WHEN }, function () {
1829
+ context.run({
1830
+ skipped:
1831
+ // Checking for nested conditional. If we're in a nested skipWhen,
1832
+ // we should skip the test if the parent conditional is true.
1833
+ isExcludedIndividually() ||
1834
+ // Otherwise, we should skip the test if the conditional is true.
1835
+ optionalFunctionValue(conditional, optionalFunctionValue(produceDraft))
1836
+ }, function () { return callback(); });
1837
+ });
1838
+ }
1839
+ function isExcludedIndividually() {
1840
+ return !!context.useX().skipped;
1841
+ }
1842
+
1802
1843
  /**
1803
1844
  * Adds a field or a list of fields into the inclusion list
1804
1845
  *
@@ -1825,9 +1866,6 @@
1825
1866
  skip.group = function (item) {
1826
1867
  return addTo(1 /* SKIP */, 'groups', item);
1827
1868
  };
1828
- function isExcludedIndividually() {
1829
- return !!context.useX().skipped;
1830
- }
1831
1869
  //Checks whether a certain test profile excluded by any of the exclusion groups.
1832
1870
  // eslint-disable-next-line complexity, max-statements, max-lines-per-function
1833
1871
  function isExcluded(testObject) {
@@ -1973,7 +2011,7 @@
1973
2011
  });
1974
2012
  }
1975
2013
  function throwGroupError(error) {
1976
- throwError("Wrong arguments passed to group. Group " + error + ".");
2014
+ throwError("Wrong arguments passed to group. Group ".concat(error, "."));
1977
2015
  }
1978
2016
 
1979
2017
  function include(fieldName) {
@@ -1999,6 +2037,45 @@
1999
2037
  }
2000
2038
  }
2001
2039
 
2040
+ /**
2041
+ * Sets the suite to "eager" (fail fast) mode.
2042
+ * Eager mode will skip running subsequent tests of a failing fields.
2043
+ *
2044
+ * @example
2045
+ * // in the following example, the second test of username will not run
2046
+ * // if the first test of username failed.
2047
+ * const suite = create((data) => {
2048
+ * eager();
2049
+ *
2050
+ * test('username', 'username is required', () => {
2051
+ * enforce(data.username).isNotBlank();
2052
+ * });
2053
+ *
2054
+ * test('username', 'username is too short', () => {
2055
+ * enforce(data.username).longerThan(2);
2056
+ * });
2057
+ * });
2058
+ */
2059
+ function eager() {
2060
+ setMode(Modes.EAGER);
2061
+ }
2062
+ function shouldSkipBasedOnMode(testObject) {
2063
+ if (isEager() && hasErrors(testObject.fieldName))
2064
+ return true;
2065
+ return false;
2066
+ }
2067
+ function isEager() {
2068
+ return isMode(Modes.EAGER);
2069
+ }
2070
+ function isMode(mode) {
2071
+ var currentMode = context.useX().mode;
2072
+ return currentMode[0] === mode;
2073
+ }
2074
+ function setMode(nextMode) {
2075
+ var mode = context.useX().mode;
2076
+ mode[0] = nextMode;
2077
+ }
2078
+
2002
2079
  /**
2003
2080
  * Conditionally omits tests from the suite.
2004
2081
  *
@@ -2011,7 +2088,8 @@
2011
2088
  function omitWhen(conditional, callback) {
2012
2089
  isolate({ type: IsolateTypes.OMIT_WHEN }, function () {
2013
2090
  context.run({
2014
- omitted: optionalFunctionValue(conditional, optionalFunctionValue(produceDraft))
2091
+ omitted: isOmitted() ||
2092
+ optionalFunctionValue(conditional, optionalFunctionValue(produceDraft))
2015
2093
  }, function () { return callback(); });
2016
2094
  });
2017
2095
  }
@@ -2049,23 +2127,6 @@
2049
2127
  });
2050
2128
  }
2051
2129
 
2052
- /**
2053
- * Conditionally skips running tests within the callback.
2054
- *
2055
- * @example
2056
- *
2057
- * skipWhen(res => res.hasErrors('username'), () => {
2058
- * test('username', 'User already taken', async () => await doesUserExist(username)
2059
- * });
2060
- */
2061
- function skipWhen(conditional, callback) {
2062
- isolate({ type: IsolateTypes.SKIP_WHEN }, function () {
2063
- context.run({
2064
- skipped: optionalFunctionValue(conditional, optionalFunctionValue(produceDraft))
2065
- }, function () { return callback(); });
2066
- });
2067
- }
2068
-
2069
2130
  function isPromise(value) {
2070
2131
  return value && isFunction(value.then);
2071
2132
  }
@@ -2159,7 +2220,7 @@
2159
2220
  }
2160
2221
  }
2161
2222
  catch (e) {
2162
- throwError("Your test function " + testObject.fieldName + " returned a value. Only \"false\" or Promise returns are supported.");
2223
+ throwError("Unexpected error encountered during test registration.\n Test Object: ".concat(testObject, ".\n Error: ").concat(e, "."));
2163
2224
  }
2164
2225
  }
2165
2226
 
@@ -2230,7 +2291,7 @@
2230
2291
  if (shouldAllowReorder()) {
2231
2292
  return;
2232
2293
  }
2233
- throwErrorDeferred("Vest Critical Error: Tests called in different order than previous run.\n expected: " + prevTest.fieldName + "\n received: " + 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.");
2294
+ throwErrorDeferred("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."));
2234
2295
  }
2235
2296
  function handleKeyTest(key, newTestObject) {
2236
2297
  var prevTestByKey = usePrevTestByKey(key);
@@ -2245,6 +2306,11 @@
2245
2306
  // eslint-disable-next-line max-statements
2246
2307
  function registerPrevRunTest(testObject) {
2247
2308
  var prevRunTest = useTestAtCursor(testObject);
2309
+ if (shouldSkipBasedOnMode(testObject)) {
2310
+ moveForward();
2311
+ testObject.skip();
2312
+ return testObject;
2313
+ }
2248
2314
  if (isOmitted()) {
2249
2315
  prevRunTest.omit();
2250
2316
  moveForward();
@@ -2309,7 +2375,7 @@
2309
2375
  for (var _i = 1; _i < arguments.length; _i++) {
2310
2376
  args[_i - 1] = arguments[_i];
2311
2377
  }
2312
- var _a = (isFunction(args[1]) ? args : __spreadArray([undefined], args)), message = _a[0], testFn = _a[1], key = _a[2];
2378
+ var _a = (isFunction(args[1]) ? args : __spreadArray([undefined], args, true)), message = _a[0], testFn = _a[1], key = _a[2];
2313
2379
  if (isNotString(fieldName)) {
2314
2380
  throwIncompatibleParamsError('fieldName', 'string');
2315
2381
  }
@@ -2337,7 +2403,7 @@
2337
2403
  memo: bindTestMemo(testBase)
2338
2404
  });
2339
2405
  function throwIncompatibleParamsError(name, expected) {
2340
- throwError("Incompatible params passed to test function. " + name + " must be a " + expected);
2406
+ throwError("Incompatible params passed to test function. ".concat(name, " must be a ").concat(expected));
2341
2407
  }
2342
2408
 
2343
2409
  var ERROR_OUTSIDE_OF_TEST = "warn hook called outside of a test callback. It won't have an effect."
@@ -2353,12 +2419,13 @@
2353
2419
  ctx.currentTest.warn();
2354
2420
  }
2355
2421
 
2356
- var VERSION = "4.0.3";
2422
+ var VERSION = "4.2.0";
2357
2423
 
2358
2424
  exports.VERSION = VERSION;
2359
2425
  exports.context = context;
2360
2426
  exports.create = create;
2361
2427
  exports.each = each;
2428
+ exports.eager = eager;
2362
2429
  exports.enforce = enforce;
2363
2430
  exports.group = group;
2364
2431
  exports.include = include;