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.
- package/dist/exports/classnames.cjs +2 -2
- package/dist/exports/classnames.mjs +2 -2
- package/dist/exports/debounce.cjs +1 -1
- package/dist/exports/debounce.mjs +1 -1
- package/dist/exports/memo.cjs +1 -1
- package/dist/exports/memo.mjs +1 -1
- package/dist/exports/parser.cjs +2 -2
- package/dist/exports/parser.mjs +2 -2
- package/dist/{parser-BwKlnVQB.mjs → parser-BDHdwZo7.mjs} +2 -2
- package/dist/{parser-BwKlnVQB.mjs.map → parser-BDHdwZo7.mjs.map} +1 -1
- package/dist/{parser-kVnFfJrH.cjs → parser-DagIUS0b.cjs} +2 -2
- package/dist/{parser-kVnFfJrH.cjs.map → parser-DagIUS0b.cjs.map} +1 -1
- package/dist/{vest-Bb1dSrg7.cjs → vest-B-NiE6Di.cjs} +22 -11
- package/dist/vest-B-NiE6Di.cjs.map +1 -0
- package/dist/{vest-CJMSUTEl.mjs → vest-C_ndMBdJ.mjs} +23 -12
- package/dist/vest-C_ndMBdJ.mjs.map +1 -0
- package/dist/vest.cjs +1 -1
- package/dist/vest.mjs +1 -1
- package/package.json +6 -3
- package/src/core/Runtime.ts +10 -3
- package/src/core/VestBus/VestBus.ts +3 -15
- package/src/core/context/SuiteContext.ts +2 -2
- package/src/core/isolate/IsolateTest/IsolateTestReconciler.ts +4 -7
- package/src/isolates/omitWhen.ts +10 -4
- package/src/isolates/skipWhen.ts +7 -1
- package/src/suite/__tests__/recordValidation.test.ts +113 -0
- package/src/suite/__tests__/schema.runtime.test.ts +3 -2
- package/src/suite/__tests__/schema.types.test.ts +49 -0
- package/types/IsolateSuite-D5Qr0Oyg.d.mts.map +1 -1
- package/types/IsolateSuite-t022G3ua.d.cts.map +1 -1
- package/types/vest.d.cts +17 -5
- package/types/vest.d.cts.map +1 -1
- package/types/vest.d.mts +17 -5
- package/types/vest.d.mts.map +1 -1
- package/types/vest.d.ts +17 -5
- package/dist/vest-Bb1dSrg7.cjs.map +0 -1
- package/dist/vest-CJMSUTEl.mjs.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const require_chunk = require('../chunk-CbDLau6x.cjs');
|
|
2
|
-
require('../vest-
|
|
2
|
+
require('../vest-B-NiE6Di.cjs');
|
|
3
3
|
require('../IsolateTestStateMachine-BBP3PZx3.cjs');
|
|
4
|
-
const require_parser = require('../parser-
|
|
4
|
+
const require_parser = require('../parser-DagIUS0b.cjs');
|
|
5
5
|
let vest_utils = require("vest-utils");
|
|
6
6
|
|
|
7
7
|
//#region src/exports/classnames.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../vest-
|
|
1
|
+
import "../vest-C_ndMBdJ.mjs";
|
|
2
2
|
import "../IsolateTestStateMachine-BejZsTRI.mjs";
|
|
3
|
-
import { t as parse } from "../parser-
|
|
3
|
+
import { t as parse } from "../parser-BDHdwZo7.mjs";
|
|
4
4
|
import { isFunction, makeBrand } from "vest-utils";
|
|
5
5
|
|
|
6
6
|
//#region src/exports/classnames.ts
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('../chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_vest = require('../vest-
|
|
2
|
+
const require_vest = require('../vest-B-NiE6Di.cjs');
|
|
3
3
|
require('../IsolateTestStateMachine-BBP3PZx3.cjs');
|
|
4
4
|
let vest_utils = require("vest-utils");
|
|
5
5
|
let vestjs_runtime = require("vestjs-runtime");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { b as SuiteContext, f as getTestFromAbortSignal, p as registerReconciler } from "../vest-
|
|
1
|
+
import { b as SuiteContext, f as getTestFromAbortSignal, p as registerReconciler } from "../vest-C_ndMBdJ.mjs";
|
|
2
2
|
import "../IsolateTestStateMachine-BejZsTRI.mjs";
|
|
3
3
|
import { isPromise } from "vest-utils";
|
|
4
4
|
import { Isolate, IsolateSelectors } from "vestjs-runtime";
|
package/dist/exports/memo.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('../chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_vest = require('../vest-
|
|
2
|
+
const require_vest = require('../vest-B-NiE6Di.cjs');
|
|
3
3
|
require('../IsolateTestStateMachine-BBP3PZx3.cjs');
|
|
4
4
|
let vest_utils = require("vest-utils");
|
|
5
5
|
let vestjs_runtime = require("vestjs-runtime");
|
package/dist/exports/memo.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { p as registerReconciler, v as VestTest, y as createVestIsolate } from "../vest-
|
|
1
|
+
import { p as registerReconciler, v as VestTest, y as createVestIsolate } from "../vest-C_ndMBdJ.mjs";
|
|
2
2
|
import "../IsolateTestStateMachine-BejZsTRI.mjs";
|
|
3
3
|
import { cache, isNullish, makeResult, unwrap } from "vest-utils";
|
|
4
4
|
import { IsolateSelectors, Walker } from "vestjs-runtime";
|
package/dist/exports/parser.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require('../vest-
|
|
1
|
+
require('../vest-B-NiE6Di.cjs');
|
|
2
2
|
require('../IsolateTestStateMachine-BBP3PZx3.cjs');
|
|
3
|
-
const require_parser = require('../parser-
|
|
3
|
+
const require_parser = require('../parser-DagIUS0b.cjs');
|
|
4
4
|
|
|
5
5
|
exports.parse = require_parser.parse;
|
package/dist/exports/parser.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { S as ErrorStrings, _ as suiteSelectors } from "./vest-
|
|
1
|
+
import { S as ErrorStrings, _ as suiteSelectors } from "./vest-C_ndMBdJ.mjs";
|
|
2
2
|
import { hasOwnProperty, invariant, isNullish, isPositive, makeBrand } from "vest-utils";
|
|
3
3
|
|
|
4
4
|
//#region src/exports/parser.ts
|
|
@@ -33,4 +33,4 @@ function parse(summary) {
|
|
|
33
33
|
|
|
34
34
|
//#endregion
|
|
35
35
|
export { parse as t };
|
|
36
|
-
//# sourceMappingURL=parser-
|
|
36
|
+
//# sourceMappingURL=parser-BDHdwZo7.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-
|
|
1
|
+
{"version":3,"file":"parser-BDHdwZo7.mjs","names":["testedStorage: Record<string, boolean>"],"sources":["../src/exports/parser.ts"],"sourcesContent":["import {\n hasOwnProperty,\n invariant,\n isNullish,\n isPositive,\n makeBrand,\n} from 'vest-utils';\n\nimport { ErrorStrings } from '../errors/ErrorStrings';\nimport {\n SuiteResult,\n SuiteSummary,\n TFieldName,\n TGroupName,\n TSchema,\n} from '../suiteResult/SuiteResultTypes';\nimport { suiteSelectors } from '../vest';\n\nexport function parse<\n F extends TFieldName,\n G extends TGroupName,\n S extends TSchema,\n>(summary: SuiteSummary<F, G> | SuiteResult<F, G, S>): ParsedVestObject<F> {\n invariant(\n summary && hasOwnProperty(summary, 'valid'),\n ErrorStrings.PARSER_EXPECT_RESULT_OBJECT,\n );\n\n const sel = suiteSelectors(summary);\n\n const testedStorage: Record<string, boolean> = {};\n\n const selectors = {\n invalid: sel.hasErrors,\n pending: sel.isPending,\n tested: isTested,\n untested: isUntested,\n valid: sel.isValid,\n warning: sel.hasWarnings,\n };\n\n return selectors;\n\n // Booleans\n function isTested(fieldName?: F | string): boolean {\n if (isNullish(fieldName)) {\n return isPositive(summary.testCount);\n }\n\n const safeFieldName = makeBrand<TFieldName>(fieldName);\n\n if (hasOwnProperty(testedStorage, safeFieldName)) {\n return testedStorage[safeFieldName];\n }\n\n addFieldToTestedStorage(safeFieldName);\n\n return selectors.tested(safeFieldName as F);\n }\n\n function addFieldToTestedStorage(fieldName: TFieldName): void {\n testedStorage[fieldName] =\n hasOwnProperty(summary.tests, fieldName) &&\n isPositive(summary.tests[fieldName].testCount);\n }\n\n function isUntested(fieldName?: F | string): boolean {\n const safeFieldName = fieldName\n ? makeBrand<TFieldName>(fieldName)\n : undefined;\n\n return !(\n isPositive(summary.testCount) &&\n selectors.tested(safeFieldName as F | undefined)\n );\n }\n}\n\nexport type ParsedVestObject<F extends TFieldName> = {\n valid(fieldName?: F | string): boolean;\n tested(fieldName?: F | string): boolean;\n invalid(fieldName?: F | string): boolean;\n untested(fieldName?: F | string): boolean;\n warning(fieldName?: F | string): boolean;\n pending(fieldName?: F | string): boolean;\n};\n"],"mappings":";;;;AAkBA,SAAgB,MAId,SAAyE;AACzE,WACE,WAAW,eAAe,SAAS,QAAQ,EAC3C,aAAa,4BACd;CAED,MAAM,MAAM,eAAe,QAAQ;CAEnC,MAAMA,gBAAyC,EAAE;CAEjD,MAAM,YAAY;EAChB,SAAS,IAAI;EACb,SAAS,IAAI;EACb,QAAQ;EACR,UAAU;EACV,OAAO,IAAI;EACX,SAAS,IAAI;EACd;AAED,QAAO;CAGP,SAAS,SAAS,WAAiC;AACjD,MAAI,UAAU,UAAU,CACtB,QAAO,WAAW,QAAQ,UAAU;EAGtC,MAAM,gBAAgB,UAAsB,UAAU;AAEtD,MAAI,eAAe,eAAe,cAAc,CAC9C,QAAO,cAAc;AAGvB,0BAAwB,cAAc;AAEtC,SAAO,UAAU,OAAO,cAAmB;;CAG7C,SAAS,wBAAwB,WAA6B;AAC5D,gBAAc,aACZ,eAAe,QAAQ,OAAO,UAAU,IACxC,WAAW,QAAQ,MAAM,WAAW,UAAU;;CAGlD,SAAS,WAAW,WAAiC;EACnD,MAAM,gBAAgB,YAClB,UAAsB,UAAU,GAChC;AAEJ,SAAO,EACL,WAAW,QAAQ,UAAU,IAC7B,UAAU,OAAO,cAA+B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_chunk = require('./chunk-CbDLau6x.cjs');
|
|
2
|
-
const require_vest = require('./vest-
|
|
2
|
+
const require_vest = require('./vest-B-NiE6Di.cjs');
|
|
3
3
|
let vest_utils = require("vest-utils");
|
|
4
4
|
|
|
5
5
|
//#region src/exports/parser.ts
|
|
@@ -39,4 +39,4 @@ Object.defineProperty(exports, 'parse', {
|
|
|
39
39
|
return parse;
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
|
-
//# sourceMappingURL=parser-
|
|
42
|
+
//# sourceMappingURL=parser-DagIUS0b.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser-
|
|
1
|
+
{"version":3,"file":"parser-DagIUS0b.cjs","names":["ErrorStrings","suiteSelectors","testedStorage: Record<string, boolean>"],"sources":["../src/exports/parser.ts"],"sourcesContent":["import {\n hasOwnProperty,\n invariant,\n isNullish,\n isPositive,\n makeBrand,\n} from 'vest-utils';\n\nimport { ErrorStrings } from '../errors/ErrorStrings';\nimport {\n SuiteResult,\n SuiteSummary,\n TFieldName,\n TGroupName,\n TSchema,\n} from '../suiteResult/SuiteResultTypes';\nimport { suiteSelectors } from '../vest';\n\nexport function parse<\n F extends TFieldName,\n G extends TGroupName,\n S extends TSchema,\n>(summary: SuiteSummary<F, G> | SuiteResult<F, G, S>): ParsedVestObject<F> {\n invariant(\n summary && hasOwnProperty(summary, 'valid'),\n ErrorStrings.PARSER_EXPECT_RESULT_OBJECT,\n );\n\n const sel = suiteSelectors(summary);\n\n const testedStorage: Record<string, boolean> = {};\n\n const selectors = {\n invalid: sel.hasErrors,\n pending: sel.isPending,\n tested: isTested,\n untested: isUntested,\n valid: sel.isValid,\n warning: sel.hasWarnings,\n };\n\n return selectors;\n\n // Booleans\n function isTested(fieldName?: F | string): boolean {\n if (isNullish(fieldName)) {\n return isPositive(summary.testCount);\n }\n\n const safeFieldName = makeBrand<TFieldName>(fieldName);\n\n if (hasOwnProperty(testedStorage, safeFieldName)) {\n return testedStorage[safeFieldName];\n }\n\n addFieldToTestedStorage(safeFieldName);\n\n return selectors.tested(safeFieldName as F);\n }\n\n function addFieldToTestedStorage(fieldName: TFieldName): void {\n testedStorage[fieldName] =\n hasOwnProperty(summary.tests, fieldName) &&\n isPositive(summary.tests[fieldName].testCount);\n }\n\n function isUntested(fieldName?: F | string): boolean {\n const safeFieldName = fieldName\n ? makeBrand<TFieldName>(fieldName)\n : undefined;\n\n return !(\n isPositive(summary.testCount) &&\n selectors.tested(safeFieldName as F | undefined)\n );\n }\n}\n\nexport type ParsedVestObject<F extends TFieldName> = {\n valid(fieldName?: F | string): boolean;\n tested(fieldName?: F | string): boolean;\n invalid(fieldName?: F | string): boolean;\n untested(fieldName?: F | string): boolean;\n warning(fieldName?: F | string): boolean;\n pending(fieldName?: F | string): boolean;\n};\n"],"mappings":";;;;;AAkBA,SAAgB,MAId,SAAyE;AACzE,2BACE,0CAA0B,SAAS,QAAQ,EAC3CA,0BAAa,4BACd;CAED,MAAM,MAAMC,4BAAe,QAAQ;CAEnC,MAAMC,gBAAyC,EAAE;CAEjD,MAAM,YAAY;EAChB,SAAS,IAAI;EACb,SAAS,IAAI;EACb,QAAQ;EACR,UAAU;EACV,OAAO,IAAI;EACX,SAAS,IAAI;EACd;AAED,QAAO;CAGP,SAAS,SAAS,WAAiC;AACjD,gCAAc,UAAU,CACtB,mCAAkB,QAAQ,UAAU;EAGtC,MAAM,0CAAsC,UAAU;AAEtD,qCAAmB,eAAe,cAAc,CAC9C,QAAO,cAAc;AAGvB,0BAAwB,cAAc;AAEtC,SAAO,UAAU,OAAO,cAAmB;;CAG7C,SAAS,wBAAwB,WAA6B;AAC5D,gBAAc,4CACG,QAAQ,OAAO,UAAU,+BAC7B,QAAQ,MAAM,WAAW,UAAU;;CAGlD,SAAS,WAAW,WAAiC;EACnD,MAAM,gBAAgB,sCACI,UAAU,GAChC;AAEJ,SAAO,6BACM,QAAQ,UAAU,IAC7B,UAAU,OAAO,cAA+B"}
|
|
@@ -38,7 +38,7 @@ const SuiteContext = (0, context.createCascade)((ctxRef, parentContext) => {
|
|
|
38
38
|
if (parentContext) return null;
|
|
39
39
|
return (0, vest_utils.assign)({
|
|
40
40
|
inclusion: {},
|
|
41
|
-
mode: vest_utils.
|
|
41
|
+
mode: (0, vest_utils.createTinyState)(Modes.EAGER),
|
|
42
42
|
modifiers: {
|
|
43
43
|
onlyGroup: /* @__PURE__ */ new Set(),
|
|
44
44
|
skipGroup: /* @__PURE__ */ new Set()
|
|
@@ -459,8 +459,8 @@ function useClearTestIndexes(root) {
|
|
|
459
459
|
const createSuiteResultCache = () => (0, vest_utils.cache)();
|
|
460
460
|
function useCreateVestState({ VestReconciler: VestReconciler$1 }) {
|
|
461
461
|
const stateRef = {
|
|
462
|
-
doneCallbacks: vest_utils.
|
|
463
|
-
fieldCallbacks: vest_utils.
|
|
462
|
+
doneCallbacks: (0, vest_utils.createTinyState)(() => []),
|
|
463
|
+
fieldCallbacks: (0, vest_utils.createTinyState)(() => ({})),
|
|
464
464
|
suiteId: (0, vest_utils.seq)(),
|
|
465
465
|
suiteResultCache: createSuiteResultCache()
|
|
466
466
|
};
|
|
@@ -1309,10 +1309,16 @@ function LazyDraft() {
|
|
|
1309
1309
|
/**
|
|
1310
1310
|
* Conditionally skips running tests within the callback.
|
|
1311
1311
|
*
|
|
1312
|
+
* Unlike `omitWhen`, skipped tests **retain their previous result** from
|
|
1313
|
+
* the last run. Use `skipWhen` when you want to avoid re-evaluating
|
|
1314
|
+
* tests that already have a known result (e.g., skip an async uniqueness
|
|
1315
|
+
* check while the field still has synchronous validation errors).
|
|
1316
|
+
*
|
|
1312
1317
|
* @example
|
|
1313
1318
|
*
|
|
1319
|
+
* // Skip the async check while there are sync errors on the field
|
|
1314
1320
|
* skipWhen(res => res.hasErrors('username'), () => {
|
|
1315
|
-
*
|
|
1321
|
+
* test('username', 'User already taken', async () => await doesUserExist(username));
|
|
1316
1322
|
* });
|
|
1317
1323
|
*/
|
|
1318
1324
|
function skipWhen(condition, callback) {
|
|
@@ -1657,10 +1663,9 @@ function useRunDoneCallbacks() {
|
|
|
1657
1663
|
function useInitVestBus() {
|
|
1658
1664
|
const VestBus = vestjs_runtime.Bus.useBus();
|
|
1659
1665
|
useRegistryBusEvents(VestBus);
|
|
1660
|
-
VestBus.on("
|
|
1666
|
+
VestBus.on("TEST_RUN_STARTED", () => {
|
|
1661
1667
|
useExpireSuiteResultCache();
|
|
1662
1668
|
});
|
|
1663
|
-
VestBus.on("TEST_RUN_STARTED", () => {});
|
|
1664
1669
|
VestBus.on("ISOLATE_ENTER", (isolate) => {
|
|
1665
1670
|
if (VestTest.is(isolate)) useOnTestStart(isolate);
|
|
1666
1671
|
});
|
|
@@ -2134,13 +2139,19 @@ function shouldSkipGroup(groupName) {
|
|
|
2134
2139
|
/**
|
|
2135
2140
|
* Conditionally omits tests from the suite.
|
|
2136
2141
|
*
|
|
2137
|
-
*
|
|
2138
|
-
*
|
|
2142
|
+
* Unlike `skipWhen`, omitted tests are **completely removed** from the
|
|
2143
|
+
* result — they do not retain their previous state and are not counted
|
|
2144
|
+
* in `testCount`, `errorCount`, or validity checks. Use `omitWhen` when
|
|
2145
|
+
* the tests are irrelevant to the current form state (e.g., omit
|
|
2146
|
+
* "confirm password" tests when the password field is empty).
|
|
2139
2147
|
*
|
|
2140
2148
|
* @example
|
|
2141
2149
|
*
|
|
2142
|
-
*
|
|
2143
|
-
*
|
|
2150
|
+
* // Don't validate confirmation when password is empty
|
|
2151
|
+
* omitWhen(!data.password, () => {
|
|
2152
|
+
* test('confirm', 'Passwords do not match', () => {
|
|
2153
|
+
* enforce(data.confirm).equals(data.password);
|
|
2154
|
+
* });
|
|
2144
2155
|
* });
|
|
2145
2156
|
*/
|
|
2146
2157
|
function omitWhen(conditional, callback) {
|
|
@@ -2729,4 +2740,4 @@ Object.defineProperty(exports, 'warn', {
|
|
|
2729
2740
|
return warn;
|
|
2730
2741
|
}
|
|
2731
2742
|
});
|
|
2732
|
-
//# sourceMappingURL=vest-
|
|
2743
|
+
//# sourceMappingURL=vest-B-NiE6Di.cjs.map
|