vest 4.6.0 → 4.6.2-dev-b07a89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/enforce/compose.development.js +20 -54
- package/dist/cjs/enforce/compose.production.js +1 -1
- package/dist/cjs/enforce/compounds.development.js +1 -89
- package/dist/cjs/enforce/compounds.production.js +1 -1
- package/dist/cjs/enforce/schema.development.js +1 -89
- package/dist/cjs/enforce/schema.production.js +1 -1
- package/dist/cjs/vest.development.js +5 -75
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/enforce/compose.development.js +2 -56
- package/dist/es/enforce/compose.production.js +1 -1
- package/dist/es/enforce/compounds.development.js +1 -90
- package/dist/es/enforce/compounds.production.js +1 -1
- package/dist/es/enforce/schema.development.js +1 -88
- package/dist/es/enforce/schema.production.js +1 -1
- package/dist/es/vest.development.js +6 -76
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/enforce/compose.development.js +7 -58
- package/dist/umd/enforce/compose.production.js +1 -1
- package/dist/umd/enforce/compounds.development.js +4 -91
- package/dist/umd/enforce/compounds.production.js +1 -1
- package/dist/umd/enforce/schema.development.js +4 -91
- package/dist/umd/enforce/schema.production.js +1 -1
- package/dist/umd/vest.development.js +8 -79
- package/dist/umd/vest.production.js +1 -1
- package/package.json +4 -3
- package/tsconfig.json +85 -1
- package/types/classnames.d.ts +1 -0
- package/types/classnames.d.ts.map +1 -0
- package/types/enforce/compose.d.ts +2 -125
- package/types/enforce/compose.d.ts.map +1 -0
- package/types/enforce/compounds.d.ts +1 -135
- package/types/enforce/compounds.d.ts.map +1 -0
- package/types/enforce/schema.d.ts +2 -144
- package/types/enforce/schema.d.ts.map +1 -0
- package/types/parser.d.ts +1 -0
- package/types/parser.d.ts.map +1 -0
- package/types/promisify.d.ts +1 -0
- package/types/promisify.d.ts.map +1 -0
- package/types/vest.d.ts +6 -16
- package/types/vest.d.ts.map +1 -0
|
@@ -1,144 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
...infer U
|
|
4
|
-
] ? U : never;
|
|
5
|
-
type Stringable = string | ((...args: any[]) => string);
|
|
6
|
-
type CB = (...args: any[]) => any;
|
|
7
|
-
type EnforceCustomMatcher<F extends CB, R> = (...args: DropFirst<Parameters<F>>) => R;
|
|
8
|
-
type RuleReturn = boolean | {
|
|
9
|
-
pass: boolean;
|
|
10
|
-
message?: Stringable;
|
|
11
|
-
};
|
|
12
|
-
type RuleDetailedResult = {
|
|
13
|
-
pass: boolean;
|
|
14
|
-
message?: string;
|
|
15
|
-
};
|
|
16
|
-
type Args = any[];
|
|
17
|
-
type BaseRules = typeof baseRules;
|
|
18
|
-
type KBaseRules = keyof BaseRules;
|
|
19
|
-
declare function condition(value: any, callback: (value: any) => RuleReturn): RuleReturn;
|
|
20
|
-
declare function endsWith(value: string, arg1: string): boolean;
|
|
21
|
-
declare function equals(value: unknown, arg1: unknown): boolean;
|
|
22
|
-
declare function greaterThanOrEquals(value: string | number, gte: string | number): boolean;
|
|
23
|
-
declare function inside(value: unknown, arg1: string | unknown[]): boolean;
|
|
24
|
-
declare function isBetween(value: number | string, min: number | string, max: number | string): boolean;
|
|
25
|
-
declare function isBlank(value: unknown): boolean;
|
|
26
|
-
declare function isKeyOf(key: string | symbol | number, obj: any): boolean;
|
|
27
|
-
declare function isNaN(value: unknown): boolean;
|
|
28
|
-
declare function isNegative(value: number | string): boolean;
|
|
29
|
-
declare function isNumber(value: unknown): value is number;
|
|
30
|
-
declare function isTruthy(value: unknown): boolean;
|
|
31
|
-
declare function isValueOf(value: any, objectToCheck: any): boolean;
|
|
32
|
-
declare function lessThan(value: string | number, lt: string | number): boolean;
|
|
33
|
-
declare function lessThanOrEquals(value: string | number, lte: string | number): boolean;
|
|
34
|
-
declare function longerThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
35
|
-
declare function matches(value: string, regex: RegExp | string): boolean;
|
|
36
|
-
declare function shorterThan(value: string | unknown[], arg1: string | number): boolean;
|
|
37
|
-
declare function shorterThanOrEquals(value: string | unknown[], arg1: string | number): boolean;
|
|
38
|
-
declare function startsWith(value: string, arg1: string): boolean;
|
|
39
|
-
declare const baseRules: {
|
|
40
|
-
condition: typeof condition;
|
|
41
|
-
doesNotEndWith: (value: string, arg1: string) => boolean;
|
|
42
|
-
doesNotStartWith: (value: string, arg1: string) => boolean;
|
|
43
|
-
endsWith: typeof endsWith;
|
|
44
|
-
equals: typeof equals;
|
|
45
|
-
greaterThan: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
46
|
-
greaterThanOrEquals: typeof greaterThanOrEquals;
|
|
47
|
-
gt: typeof import("packages/vest-utils/types/vest-utils").greaterThan;
|
|
48
|
-
gte: typeof greaterThanOrEquals;
|
|
49
|
-
inside: typeof inside;
|
|
50
|
-
isArray: typeof import("packages/vest-utils/types/vest-utils").isArray;
|
|
51
|
-
isBetween: typeof isBetween;
|
|
52
|
-
isBlank: typeof isBlank;
|
|
53
|
-
isBoolean: typeof import("packages/vest-utils/types/vest-utils").isBoolean;
|
|
54
|
-
isEmpty: typeof import("packages/vest-utils/types/vest-utils").isEmpty;
|
|
55
|
-
isEven: (value: any) => boolean;
|
|
56
|
-
isFalsy: (value: unknown) => boolean;
|
|
57
|
-
isKeyOf: typeof isKeyOf;
|
|
58
|
-
isNaN: typeof isNaN;
|
|
59
|
-
isNegative: typeof isNegative;
|
|
60
|
-
isNotArray: (value: unknown) => boolean;
|
|
61
|
-
isNotBetween: (value: string | number, min: string | number, max: string | number) => boolean;
|
|
62
|
-
isNotBlank: (value: unknown) => boolean;
|
|
63
|
-
isNotBoolean: (value: unknown) => boolean;
|
|
64
|
-
isNotEmpty: (value: unknown) => boolean;
|
|
65
|
-
isNotKeyOf: (key: string | number | symbol, obj: any) => boolean;
|
|
66
|
-
isNotNaN: (value: unknown) => boolean;
|
|
67
|
-
isNotNull: (value: unknown) => boolean;
|
|
68
|
-
isNotNullish: (value: any) => boolean;
|
|
69
|
-
isNotNumber: (value: unknown) => boolean;
|
|
70
|
-
isNotNumeric: (value: string | number) => boolean;
|
|
71
|
-
isNotString: (v: unknown) => boolean;
|
|
72
|
-
isNotUndefined: (value?: unknown) => boolean;
|
|
73
|
-
isNotValueOf: (value: any, objectToCheck: any) => boolean;
|
|
74
|
-
isNull: typeof import("packages/vest-utils/types/vest-utils").isNull;
|
|
75
|
-
isNullish: typeof import("packages/vest-utils/types/vest-utils").isNullish;
|
|
76
|
-
isNumber: typeof isNumber;
|
|
77
|
-
isNumeric: typeof import("packages/vest-utils/types/vest-utils").isNumeric;
|
|
78
|
-
isOdd: (value: any) => boolean;
|
|
79
|
-
isPositive: typeof import("packages/vest-utils/types/vest-utils").isPositive;
|
|
80
|
-
isString: typeof import("packages/vest-utils/types/vest-utils").isStringValue;
|
|
81
|
-
isTruthy: typeof isTruthy;
|
|
82
|
-
isUndefined: typeof import("packages/vest-utils/types/vest-utils").isUndefined;
|
|
83
|
-
isValueOf: typeof isValueOf;
|
|
84
|
-
lengthEquals: typeof import("packages/vest-utils/types/vest-utils").lengthEquals;
|
|
85
|
-
lengthNotEquals: (value: string | unknown[], arg1: string | number) => boolean;
|
|
86
|
-
lessThan: typeof lessThan;
|
|
87
|
-
lessThanOrEquals: typeof lessThanOrEquals;
|
|
88
|
-
longerThan: typeof import("packages/vest-utils/types/vest-utils").longerThan;
|
|
89
|
-
longerThanOrEquals: typeof longerThanOrEquals;
|
|
90
|
-
lt: typeof lessThan;
|
|
91
|
-
lte: typeof lessThanOrEquals;
|
|
92
|
-
matches: typeof matches;
|
|
93
|
-
notEquals: (value: unknown, arg1: unknown) => boolean;
|
|
94
|
-
notInside: (value: unknown, arg1: string | unknown[]) => boolean;
|
|
95
|
-
notMatches: (value: string, regex: string | RegExp) => boolean;
|
|
96
|
-
numberEquals: typeof import("packages/vest-utils/types/vest-utils").numberEquals;
|
|
97
|
-
numberNotEquals: (value: string | number, eq: string | number) => boolean;
|
|
98
|
-
shorterThan: typeof shorterThan;
|
|
99
|
-
shorterThanOrEquals: typeof shorterThanOrEquals;
|
|
100
|
-
startsWith: typeof startsWith;
|
|
101
|
-
};
|
|
102
|
-
type Rules<E> = n4s.EnforceCustomMatchers<Rules<E> & E> & Record<string, (...args: Args) => Rules<E> & E> & {
|
|
103
|
-
[P in KBaseRules]: (...args: DropFirst<Parameters<BaseRules[P]>> | Args) => Rules<E> & E;
|
|
104
|
-
};
|
|
105
|
-
/* eslint-disable @typescript-eslint/no-namespace, @typescript-eslint/no-empty-interface */
|
|
106
|
-
declare global {
|
|
107
|
-
namespace n4s {
|
|
108
|
-
interface IRules<E> extends Rules<E> {
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
type LazyRules = n4s.IRules<LazyRuleMethods>;
|
|
113
|
-
type Lazy = LazyRules & LazyRuleMethods &
|
|
114
|
-
// This is a "catch all" hack to make TS happy while not
|
|
115
|
-
// losing type hints
|
|
116
|
-
Record<string, CB>;
|
|
117
|
-
type LazyRuleMethods = LazyRuleRunners & {
|
|
118
|
-
message: (message: LazyMessage) => Lazy;
|
|
119
|
-
};
|
|
120
|
-
type LazyRuleRunners = {
|
|
121
|
-
test: (value: unknown) => boolean;
|
|
122
|
-
run: (value: unknown) => RuleDetailedResult;
|
|
123
|
-
};
|
|
124
|
-
type LazyMessage = string | ((value: unknown, originalMessage?: Stringable) => string);
|
|
125
|
-
declare function isArrayOf(inputArray: any[], currentRule: LazyRuleRunners): RuleDetailedResult;
|
|
126
|
-
interface ShapeObject extends Record<string, any>, Record<string, LazyRuleRunners> {
|
|
127
|
-
}
|
|
128
|
-
declare function loose(inputObject: Record<string, any>, shapeObject: ShapeObject): RuleDetailedResult;
|
|
129
|
-
declare function optional(value: any, ruleChain: Lazy): RuleDetailedResult;
|
|
130
|
-
declare function shape(inputObject: Record<string, any>, shapeObject: ShapeObject): RuleDetailedResult;
|
|
131
|
-
// Help needed improving the typings of this file.
|
|
132
|
-
// Ideally, we'd be able to extend ShapeObject, but that's not possible.
|
|
133
|
-
declare function partial<T extends Record<any, any>>(shapeObject: T): T;
|
|
134
|
-
declare global {
|
|
135
|
-
namespace n4s {
|
|
136
|
-
interface EnforceCustomMatchers<R> {
|
|
137
|
-
isArrayOf: EnforceCustomMatcher<typeof isArrayOf, R>;
|
|
138
|
-
loose: EnforceCustomMatcher<typeof loose, R>;
|
|
139
|
-
shape: EnforceCustomMatcher<typeof shape, R>;
|
|
140
|
-
optional: EnforceCustomMatcher<typeof optional, R>;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
export { partial };
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/exports/enforce@schema.ts"],"names":[],"mappings":""}
|
package/types/parser.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.d.ts","sourceRoot":"","sources":["../src/exports/parser.ts","../src/core/suite/produce/summaryGenerators/SuiteSummaryTypes.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAMA,iBAAgB,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,gBAAgB,CAuC7D;AAED,UAAU,gBAAgB;IACxB,KAAK,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC,MAAM,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACrC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IACtC,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACtC"}
|
package/types/promisify.d.ts
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promisify.d.ts","sourceRoot":"","sources":["../src/exports/promisify.ts","../src/core/suite/produce/summaryGenerators/SuiteSummaryTypes.ts","../src/core/test/lib/shouldUseErrorAsMessage.ts","../src/hooks/optionalFields.ts","../src/core/state/createStateRef.ts","../src/hooks/mode/Modes.ts","../src/core/isolate/isolateCursor.ts","../src/core/isolate/generateIsolate.ts","../src/core/ctx/ctx.ts","../src/core/state/stateHooks.ts","../src/core/test/VestTest.ts","../src/core/isolate/IsolateTypes.ts","../src/core/isolate/isolateHooks.ts","../src/core/test/key.ts","../src/core/isolate/isolate.ts","../src/core/suite/produce/summaryGenerators/helpers/matchingFieldName.ts","../src/core/suite/hasRemainingTests.ts","../src/core/suite/produce/produceSuiteRunResult.ts","../src/core/test/omitOptionalFields.ts","../src/core/test/lib/removeTestFromState.ts","../src/core/suite/produce/runCallbacks.ts","../src/core/vestBus.ts","../src/core/suite/create.ts","../src/core/suite/produce/Severity.ts","../src/core/suite/produce/summaryGenerators/helpers/matchingGroupName.ts","../src/core/suite/produce/summaryGenerators/helpers/nonMatchingSeverityProfile.ts","../src/core/suite/produce/summaryGenerators/hasFailuresByTestObjects.ts","../src/core/suite/produce/summaryGenerators/shouldAddValidProperty.ts","../src/core/suite/produce/summaryGenerators/genTestsSummary.ts","../src/core/suite/produce/summarySelectors/collectFailures.ts","../src/core/suite/produce/summarySelectors/suiteSelectors.ts","../src/core/suite/produce/produceSuiteResult.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,QAAA,MAAM,SAAS,0BACW,GAAG,EAAE,KAAK,cAAc,eACtC,GAAG,EAAE,KAAG,QAAQ,WAAW,CAOpC,CAAC"}
|
package/types/vest.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { enforce } from 'n4s';
|
|
2
|
+
import { CB, nestedArray } from "vest-utils";
|
|
3
|
+
import { UseState } from "vast";
|
|
2
4
|
type SuiteSummary = {
|
|
3
5
|
groups: Groups;
|
|
4
6
|
tests: Tests;
|
|
@@ -69,7 +71,6 @@ type AsyncTest = Promise<string | void>;
|
|
|
69
71
|
type TestResult = AsyncTest | boolean | void;
|
|
70
72
|
type TestFn = () => TestResult;
|
|
71
73
|
type KStatus = "UNTESTED" | "SKIPPED" | "FAILED" | "WARNING" | "PASSING" | "PENDING" | "CANCELED" | "OMITTED";
|
|
72
|
-
type CB = (...args: any[]) => any;
|
|
73
74
|
// eslint-disable-next-line max-lines-per-function, max-statements
|
|
74
75
|
declare function suiteSelectors(summary: SuiteSummary): SuiteSelectors;
|
|
75
76
|
interface SuiteSelectors {
|
|
@@ -152,13 +153,6 @@ declare enum Modes {
|
|
|
152
153
|
ALL = 0,
|
|
153
154
|
EAGER = 1
|
|
154
155
|
}
|
|
155
|
-
type NestedArray<T> = Array<NestedArray<T> | T>;
|
|
156
|
-
type SetStateInput<S> = S | ((prevState: S) => S);
|
|
157
|
-
type StateHandlerReturn<S> = [
|
|
158
|
-
S,
|
|
159
|
-
(nextState: SetStateInput<S>) => void
|
|
160
|
-
];
|
|
161
|
-
type UseState<S> = () => StateHandlerReturn<S>;
|
|
162
156
|
/**
|
|
163
157
|
* Marks a field as optional, either just by name, or by a given condition.
|
|
164
158
|
*
|
|
@@ -204,13 +198,8 @@ type TestObjects = {
|
|
|
204
198
|
prev: VestTests;
|
|
205
199
|
current: VestTests;
|
|
206
200
|
};
|
|
207
|
-
type VestTests = NestedArray<VestTest>;
|
|
208
|
-
declare const _default:
|
|
209
|
-
run: <R>(ctxRef: Partial<CTXType>, fn: (context: CTXType) => R) => R;
|
|
210
|
-
bind: <Fn extends (...args: any[]) => any>(ctxRef: Partial<CTXType>, fn: Fn) => Fn;
|
|
211
|
-
use: () => CTXType | undefined;
|
|
212
|
-
useX: (errorMessage?: string | undefined) => CTXType;
|
|
213
|
-
};
|
|
201
|
+
type VestTests = nestedArray.NestedArray<VestTest>;
|
|
202
|
+
declare const _default: import("context").CtxCascadeApi<CTXType>;
|
|
214
203
|
type CTXType = {
|
|
215
204
|
isolate: Isolate;
|
|
216
205
|
stateRef?: StateRef;
|
|
@@ -347,6 +336,7 @@ declare const test: typeof testBase & {
|
|
|
347
336
|
* Sets a running test to warn only mode.
|
|
348
337
|
*/
|
|
349
338
|
declare function warn(): void;
|
|
350
|
-
declare const VERSION = "4.6.
|
|
339
|
+
declare const VERSION = "4.6.2-dev-b07a89";
|
|
351
340
|
export { suiteSelectors, test, create, each, only, skip, warn, group, optional, skipWhen, omitWhen, enforce, VERSION, context, include, eager };
|
|
352
341
|
export type { SuiteResult, SuiteRunResult, SuiteSummary, VestTest, Suite };
|
|
342
|
+
//# sourceMappingURL=vest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vest.d.ts","sourceRoot":"","sources":["../src/vest.ts","../src/core/suite/produce/summaryGenerators/SuiteSummaryTypes.ts","../src/core/test/lib/shouldUseErrorAsMessage.ts","../src/hooks/optionalFields.ts","../src/core/isolate/isolateCursor.ts","../src/core/isolate/IsolateTypes.ts","../src/hooks/mode/Modes.ts","../src/core/isolate/generateIsolate.ts","../src/core/ctx/ctx.ts","../src/core/isolate/isolateHooks.ts","../src/core/test/key.ts","../src/core/isolate/isolate.ts","../src/core/suite/produce/summaryGenerators/helpers/matchingFieldName.ts","../src/core/suite/hasRemainingTests.ts","../src/core/suite/produce/produceSuiteRunResult.ts","../src/core/test/omitOptionalFields.ts","../src/core/test/lib/removeTestFromState.ts","../src/core/suite/produce/runCallbacks.ts","../src/core/vestBus.ts","../src/core/suite/create.ts","../src/core/suite/produce/Severity.ts","../src/core/suite/produce/summaryGenerators/helpers/matchingGroupName.ts","../src/core/suite/produce/summaryGenerators/helpers/nonMatchingSeverityProfile.ts","../src/core/suite/produce/summaryGenerators/hasFailuresByTestObjects.ts","../src/core/suite/produce/summaryGenerators/shouldAddValidProperty.ts","../src/core/suite/produce/summaryGenerators/genTestsSummary.ts","../src/core/suite/produce/summarySelectors/collectFailures.ts","../src/core/suite/produce/summarySelectors/suiteSelectors.ts","../src/core/suite/produce/produceSuiteResult.ts","../src/core/state/createStateRef.ts","../src/core/state/stateHooks.ts","../src/core/test/VestTest.ts","../src/core/isolate/isolates/each.ts","../src/hooks/hookErrors.ts","../src/core/isolate/isolates/skipWhen.ts","../src/hooks/exclusive.ts","../src/core/isolate/isolates/group.ts","../src/hooks/include.ts","../src/hooks/mode/mode.ts","../src/core/isolate/isolates/omitWhen.ts","../src/core/test/lib/isSameProfileTest.ts","../src/core/test/lib/cancelOverriddenPendingTest.ts","../src/core/test/runAsyncTest.ts","../src/core/test/runSyncTest.ts","../src/core/test/lib/registerTest.ts","../src/core/test/lib/useTestAtCursor.ts","../src/core/test/lib/registerPrevRunTest.ts","../src/core/test/test.memo.ts","../src/core/test/test.ts","../src/hooks/warn.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoB9B,QAAA,MAAM,OAAO,qBAAqB,CAAC;AAEnC,OAAO,wIAiBN,CAAC;AAEF,YAAY,8DAA8D,CAAC"}
|