vest 4.3.2 → 4.4.0-dev-08ec91
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/vest.development.js +148 -54
- package/dist/cjs/vest.production.js +1 -1
- package/dist/es/vest.development.js +148 -54
- package/dist/es/vest.production.js +1 -1
- package/dist/umd/vest.development.js +142 -48
- package/dist/umd/vest.production.js +1 -1
- package/package.json +3 -3
- package/types/classnames.d.ts +3 -5
- package/types/parser.d.ts +3 -5
- package/types/promisify.d.ts +7 -6
- package/types/vest.d.ts +29 -32
package/types/vest.d.ts
CHANGED
|
@@ -58,16 +58,14 @@ type SuiteSummary = {
|
|
|
58
58
|
tests: Tests;
|
|
59
59
|
valid: boolean;
|
|
60
60
|
} & SummaryBase;
|
|
61
|
-
type GroupTestSummary =
|
|
61
|
+
type GroupTestSummary = SingleTestSummary;
|
|
62
62
|
type Groups = Record<string, Group>;
|
|
63
63
|
type Group = Record<string, GroupTestSummary>;
|
|
64
64
|
type Tests = Record<string, SingleTestSummary>;
|
|
65
|
-
type SingleTestSummary =
|
|
66
|
-
valid: boolean;
|
|
67
|
-
};
|
|
68
|
-
type BaseTestSummary = SummaryBase & {
|
|
65
|
+
type SingleTestSummary = SummaryBase & {
|
|
69
66
|
errors: string[];
|
|
70
67
|
warnings: string[];
|
|
68
|
+
valid: boolean;
|
|
71
69
|
};
|
|
72
70
|
type SummaryBase = {
|
|
73
71
|
errorCount: number;
|
|
@@ -87,13 +85,16 @@ declare function hasErrors(fieldName?: string): boolean;
|
|
|
87
85
|
declare function hasWarnings(fieldName?: string): boolean;
|
|
88
86
|
declare function hasErrorsByGroup(groupName: string, fieldName?: string): boolean;
|
|
89
87
|
declare function hasWarningsByGroup(groupName: string, fieldName?: string): boolean;
|
|
88
|
+
declare function isValid(fieldName?: string): boolean;
|
|
89
|
+
declare function isValidByGroup(groupName: string, fieldName?: string): boolean;
|
|
90
90
|
type SuiteResult = ReturnType<typeof genTestsSummary> & {
|
|
91
91
|
/**
|
|
92
92
|
* Returns whether the suite as a whole is valid.
|
|
93
93
|
* Determined if there are no errors, and if no
|
|
94
94
|
* required fields are skipped.
|
|
95
95
|
*/
|
|
96
|
-
isValid:
|
|
96
|
+
isValid: typeof isValid;
|
|
97
|
+
isValidByGroup: typeof isValidByGroup;
|
|
97
98
|
hasErrors: typeof hasErrors;
|
|
98
99
|
hasWarnings: typeof hasWarnings;
|
|
99
100
|
getErrors: typeof getErrors;
|
|
@@ -137,7 +138,7 @@ type Suite<T extends CB> = {
|
|
|
137
138
|
*/
|
|
138
139
|
declare function create<T extends CB>(suiteName: string, suiteCallback: T): Suite<T>;
|
|
139
140
|
declare function create<T extends CB>(suiteCallback: T): Suite<T>;
|
|
140
|
-
|
|
141
|
+
type Cursor = {
|
|
141
142
|
addLevel: () => void;
|
|
142
143
|
cursorAt: () => number;
|
|
143
144
|
getCursor: () => number[];
|
|
@@ -162,36 +163,32 @@ declare enum Modes {
|
|
|
162
163
|
EAGER = 1
|
|
163
164
|
}
|
|
164
165
|
type NestedArray<T> = Array<NestedArray<T> | T>;
|
|
165
|
-
// eslint-disable-next-line max-lines-per-function
|
|
166
|
-
declare function createState(onStateChange?: (...args: unknown[]) => unknown): CreateStateReturn;
|
|
167
|
-
type StateInput<S> = S | ((prevState?: S) => S);
|
|
168
166
|
type SetStateInput<S> = S | ((prevState: S) => S);
|
|
169
|
-
type State = ReturnType<typeof createState>;
|
|
170
167
|
type StateHandlerReturn<S> = [
|
|
171
168
|
S,
|
|
172
169
|
(nextState: SetStateInput<S>) => void
|
|
173
170
|
];
|
|
174
|
-
type
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
type UseState<S> = () => StateHandlerReturn<S>;
|
|
172
|
+
type StateRef = {
|
|
173
|
+
optionalFields: UseState<OptionalFields>;
|
|
174
|
+
suiteId: UseState<string>;
|
|
175
|
+
suiteName: UseState<SuiteName>;
|
|
176
|
+
testCallbacks: UseState<TestCallbacks>;
|
|
177
|
+
testObjects: UseState<TestObjects>;
|
|
178
|
+
};
|
|
179
|
+
type OptionalFields = Record<string, [
|
|
180
|
+
rule: (() => boolean) | boolean,
|
|
181
|
+
isApplied: boolean
|
|
182
|
+
]>;
|
|
183
|
+
type SuiteName = string | void;
|
|
184
|
+
type TestCallbacks = {
|
|
185
|
+
fieldCallbacks: Record<string, Array<(res: SuiteResult) => void>>;
|
|
186
|
+
doneCallbacks: Array<(res: SuiteResult) => void>;
|
|
177
187
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
}): {
|
|
182
|
-
optionalFields: () => StateHandlerReturn<Record<string, boolean | (() => boolean)>>;
|
|
183
|
-
suiteId: () => StateHandlerReturn<string>;
|
|
184
|
-
suiteName: () => StateHandlerReturn<string | void>;
|
|
185
|
-
testCallbacks: () => StateHandlerReturn<{
|
|
186
|
-
fieldCallbacks: Record<string, ((res: SuiteResult) => void)[]>;
|
|
187
|
-
doneCallbacks: ((res: SuiteResult) => void)[];
|
|
188
|
-
}>;
|
|
189
|
-
testObjects: () => StateHandlerReturn<{
|
|
190
|
-
prev: NestedArray<VestTest>;
|
|
191
|
-
current: NestedArray<VestTest>;
|
|
192
|
-
}>;
|
|
188
|
+
type TestObjects = {
|
|
189
|
+
prev: NestedArray<VestTest>;
|
|
190
|
+
current: NestedArray<VestTest>;
|
|
193
191
|
};
|
|
194
|
-
type StateRef = ReturnType<typeof createStateRef>;
|
|
195
192
|
declare const _default: {
|
|
196
193
|
run: <R>(ctxRef: Partial<CTXType>, fn: (context: CTXType) => R) => R;
|
|
197
194
|
bind: <Fn extends (...args: any[]) => any>(ctxRef: Partial<CTXType>, fn: Fn) => Fn;
|
|
@@ -203,7 +200,7 @@ type CTXType = {
|
|
|
203
200
|
type: IsolateTypes;
|
|
204
201
|
keys: IsolateKeys;
|
|
205
202
|
};
|
|
206
|
-
testCursor:
|
|
203
|
+
testCursor: Cursor;
|
|
207
204
|
stateRef?: StateRef;
|
|
208
205
|
exclusion: {
|
|
209
206
|
tests: Record<string, boolean>;
|
|
@@ -353,6 +350,6 @@ declare const test: typeof testBase & {
|
|
|
353
350
|
* Sets a running test to warn only mode.
|
|
354
351
|
*/
|
|
355
352
|
declare function warn(): void;
|
|
356
|
-
declare const VERSION = "4.
|
|
353
|
+
declare const VERSION = "4.4.0-dev-08ec91";
|
|
357
354
|
export { test, create, each, only, skip, warn, group, optional, skipWhen, omitWhen, enforce, VERSION, context, include, eager };
|
|
358
355
|
export type { SuiteResult, SuiteRunResult, SuiteSummary, VestTest, Suite };
|