vest 6.2.8 → 6.3.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.
Files changed (37) hide show
  1. package/dist/exports/classnames.cjs +2 -2
  2. package/dist/exports/classnames.mjs +2 -2
  3. package/dist/exports/debounce.cjs +1 -1
  4. package/dist/exports/debounce.mjs +1 -1
  5. package/dist/exports/memo.cjs +1 -1
  6. package/dist/exports/memo.mjs +1 -1
  7. package/dist/exports/parser.cjs +2 -2
  8. package/dist/exports/parser.mjs +2 -2
  9. package/dist/{parser-BwKlnVQB.mjs → parser-BDHdwZo7.mjs} +2 -2
  10. package/dist/{parser-BwKlnVQB.mjs.map → parser-BDHdwZo7.mjs.map} +1 -1
  11. package/dist/{parser-kVnFfJrH.cjs → parser-DagIUS0b.cjs} +2 -2
  12. package/dist/{parser-kVnFfJrH.cjs.map → parser-DagIUS0b.cjs.map} +1 -1
  13. package/dist/{vest-Bb1dSrg7.cjs → vest-B-NiE6Di.cjs} +22 -11
  14. package/dist/vest-B-NiE6Di.cjs.map +1 -0
  15. package/dist/{vest-CJMSUTEl.mjs → vest-C_ndMBdJ.mjs} +23 -12
  16. package/dist/vest-C_ndMBdJ.mjs.map +1 -0
  17. package/dist/vest.cjs +1 -1
  18. package/dist/vest.mjs +1 -1
  19. package/package.json +6 -3
  20. package/src/core/Runtime.ts +10 -3
  21. package/src/core/VestBus/VestBus.ts +3 -15
  22. package/src/core/context/SuiteContext.ts +2 -2
  23. package/src/core/isolate/IsolateTest/IsolateTestReconciler.ts +4 -7
  24. package/src/isolates/omitWhen.ts +10 -4
  25. package/src/isolates/skipWhen.ts +7 -1
  26. package/src/suite/__tests__/recordValidation.test.ts +113 -0
  27. package/src/suite/__tests__/schema.runtime.test.ts +3 -2
  28. package/src/suite/__tests__/schema.types.test.ts +49 -0
  29. package/types/IsolateSuite-D5Qr0Oyg.d.mts.map +1 -1
  30. package/types/IsolateSuite-t022G3ua.d.cts.map +1 -1
  31. package/types/vest.d.cts +17 -5
  32. package/types/vest.d.cts.map +1 -1
  33. package/types/vest.d.mts +17 -5
  34. package/types/vest.d.mts.map +1 -1
  35. package/types/vest.d.ts +17 -5
  36. package/dist/vest-Bb1dSrg7.cjs.map +0 -1
  37. package/dist/vest-CJMSUTEl.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { n as TestAction, r as TestStatus, t as IsolateTestStateMachine } from "./IsolateTestStateMachine-BejZsTRI.mjs";
2
2
  import { enforce, enforce as enforce$1 } from "n4s";
3
- import { asArray, assign, cache, callEach, defaultTo, deferThrow, dynamicValue, either, freezeAssign, greaterThan, hasOwnProperty, invariant, isArray, isEmpty, isFunction, isNotEmptySet, isNotNullish, isObject, isPositive, isPromise, isStringValue, isUndefined, makeBrand, makeResult, seq, text, tinyState, withCatch, withResolvers } from "vest-utils";
3
+ import { asArray, assign, cache, callEach, createTinyState, defaultTo, deferThrow, dynamicValue, either, freezeAssign, greaterThan, hasOwnProperty, invariant, isArray, isEmpty, isFunction, isNotEmptySet, isNotNullish, isObject, isPositive, isPromise, isStringValue, isUndefined, makeBrand, makeResult, seq, text, withCatch, withResolvers } from "vest-utils";
4
4
  import { Bus, FocusModes, FocusSelectors, Isolate, IsolateFocused, IsolateInspector, IsolateMutator, IsolateRegistry, IsolateReorderable, IsolateSelectors, IsolateTransient, Reconciler, VestRuntime, Walker } from "vestjs-runtime";
5
5
  import { createCascade } from "context";
6
6
 
@@ -37,7 +37,7 @@ const SuiteContext = createCascade((ctxRef, parentContext) => {
37
37
  if (parentContext) return null;
38
38
  return assign({
39
39
  inclusion: {},
40
- mode: tinyState.createTinyState(Modes.EAGER),
40
+ mode: createTinyState(Modes.EAGER),
41
41
  modifiers: {
42
42
  onlyGroup: /* @__PURE__ */ new Set(),
43
43
  skipGroup: /* @__PURE__ */ new Set()
@@ -458,8 +458,8 @@ function useClearTestIndexes(root) {
458
458
  const createSuiteResultCache = () => cache();
459
459
  function useCreateVestState({ VestReconciler: VestReconciler$1 }) {
460
460
  const stateRef = {
461
- doneCallbacks: tinyState.createTinyState(() => []),
462
- fieldCallbacks: tinyState.createTinyState(() => ({})),
461
+ doneCallbacks: createTinyState(() => []),
462
+ fieldCallbacks: createTinyState(() => ({})),
463
463
  suiteId: seq(),
464
464
  suiteResultCache: createSuiteResultCache()
465
465
  };
@@ -1308,10 +1308,16 @@ function LazyDraft() {
1308
1308
  /**
1309
1309
  * Conditionally skips running tests within the callback.
1310
1310
  *
1311
+ * Unlike `omitWhen`, skipped tests **retain their previous result** from
1312
+ * the last run. Use `skipWhen` when you want to avoid re-evaluating
1313
+ * tests that already have a known result (e.g., skip an async uniqueness
1314
+ * check while the field still has synchronous validation errors).
1315
+ *
1311
1316
  * @example
1312
1317
  *
1318
+ * // Skip the async check while there are sync errors on the field
1313
1319
  * skipWhen(res => res.hasErrors('username'), () => {
1314
- * test('username', 'User already taken', async () => await doesUserExist(username)
1320
+ * test('username', 'User already taken', async () => await doesUserExist(username));
1315
1321
  * });
1316
1322
  */
1317
1323
  function skipWhen(condition, callback) {
@@ -1656,10 +1662,9 @@ function useRunDoneCallbacks() {
1656
1662
  function useInitVestBus() {
1657
1663
  const VestBus = Bus.useBus();
1658
1664
  useRegistryBusEvents(VestBus);
1659
- VestBus.on("TEST_COMPLETED", () => {
1665
+ VestBus.on("TEST_RUN_STARTED", () => {
1660
1666
  useExpireSuiteResultCache();
1661
1667
  });
1662
- VestBus.on("TEST_RUN_STARTED", () => {});
1663
1668
  VestBus.on("ISOLATE_ENTER", (isolate) => {
1664
1669
  if (VestTest.is(isolate)) useOnTestStart(isolate);
1665
1670
  });
@@ -2133,13 +2138,19 @@ function shouldSkipGroup(groupName) {
2133
2138
  /**
2134
2139
  * Conditionally omits tests from the suite.
2135
2140
  *
2136
- * When the condition is met, the tests within the callback will be omitted
2137
- * and will not be executed. The callback itself will also be skipped.
2141
+ * Unlike `skipWhen`, omitted tests are **completely removed** from the
2142
+ * result they do not retain their previous state and are not counted
2143
+ * in `testCount`, `errorCount`, or validity checks. Use `omitWhen` when
2144
+ * the tests are irrelevant to the current form state (e.g., omit
2145
+ * "confirm password" tests when the password field is empty).
2138
2146
  *
2139
2147
  * @example
2140
2148
  *
2141
- * omitWhen(res => res.hasErrors('username'), () => {
2142
- * test('username', 'User already taken', async () => await doesUserExist(username)
2149
+ * // Don't validate confirmation when password is empty
2150
+ * omitWhen(!data.password, () => {
2151
+ * test('confirm', 'Passwords do not match', () => {
2152
+ * enforce(data.confirm).equals(data.password);
2153
+ * });
2143
2154
  * });
2144
2155
  */
2145
2156
  function omitWhen(conditional, callback) {
@@ -2603,4 +2614,4 @@ function createSuite(suiteCallback, schema) {
2603
2614
 
2604
2615
  //#endregion
2605
2616
  export { ErrorStrings as S, suiteSelectors as _, each as a, SuiteContext as b, include as c, test as d, getTestFromAbortSignal as f, optional as g, skipWhen as h, group as i, only as l, mode as m, createSuite as n, warn as o, registerReconciler as p, omitWhen as r, useWarn as s, enforce$1 as t, skip as u, VestTest as v, Modes as x, createVestIsolate as y };
2606
- //# sourceMappingURL=vest-CJMSUTEl.mjs.map
2617
+ //# sourceMappingURL=vest-C_ndMBdJ.mjs.map