vest 4.4.3-dev-c786f7 → 4.5.0-dev-9b46fb

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 (41) hide show
  1. package/dist/cjs/classnames.development.js +13 -36
  2. package/dist/cjs/classnames.production.js +1 -1
  3. package/dist/cjs/enforce/compose.development.js +1 -1
  4. package/dist/cjs/enforce/compose.production.js +1 -1
  5. package/dist/cjs/enforce/compounds.development.js +1 -1
  6. package/dist/cjs/enforce/compounds.production.js +1 -1
  7. package/dist/cjs/enforce/schema.development.js +1 -1
  8. package/dist/cjs/enforce/schema.production.js +1 -1
  9. package/dist/cjs/parser.development.js +13 -36
  10. package/dist/cjs/parser.production.js +1 -1
  11. package/dist/cjs/vest.development.js +88 -94
  12. package/dist/cjs/vest.production.js +1 -1
  13. package/dist/es/classnames.development.js +14 -37
  14. package/dist/es/classnames.production.js +1 -1
  15. package/dist/es/enforce/compose.development.js +1 -1
  16. package/dist/es/enforce/compose.production.js +1 -1
  17. package/dist/es/enforce/compounds.development.js +1 -1
  18. package/dist/es/enforce/compounds.production.js +1 -1
  19. package/dist/es/enforce/schema.development.js +1 -1
  20. package/dist/es/enforce/schema.production.js +1 -1
  21. package/dist/es/parser.development.js +14 -37
  22. package/dist/es/parser.production.js +1 -1
  23. package/dist/es/vest.development.js +89 -96
  24. package/dist/es/vest.production.js +1 -1
  25. package/dist/umd/classnames.development.js +16 -45
  26. package/dist/umd/classnames.production.js +1 -1
  27. package/dist/umd/enforce/compose.development.js +17 -0
  28. package/dist/umd/enforce/compounds.development.js +68 -51
  29. package/dist/umd/enforce/compounds.production.js +1 -1
  30. package/dist/umd/enforce/schema.development.js +17 -0
  31. package/dist/umd/parser.development.js +16 -45
  32. package/dist/umd/parser.production.js +1 -1
  33. package/dist/umd/vest.development.js +106 -95
  34. package/dist/umd/vest.production.js +1 -1
  35. package/package.json +4 -4
  36. package/types/enforce/compose.d.ts +2 -1
  37. package/types/enforce/compounds.d.ts +2 -1
  38. package/types/enforce/schema.d.ts +2 -1
  39. package/types/parser.d.ts +8 -7
  40. package/types/promisify.d.ts +20 -35
  41. package/types/vest.d.ts +45 -60
package/types/vest.d.ts CHANGED
@@ -1,4 +1,24 @@
1
1
  import { enforce } from 'n4s';
2
+ type SuiteSummary = {
3
+ groups: Groups;
4
+ tests: Tests;
5
+ valid: boolean;
6
+ } & SummaryBase;
7
+ type GroupTestSummary = SingleTestSummary;
8
+ type Groups = Record<string, Group>;
9
+ type Group = Record<string, GroupTestSummary>;
10
+ type Tests = Record<string, SingleTestSummary>;
11
+ type SingleTestSummary = SummaryBase & {
12
+ errors: string[];
13
+ warnings: string[];
14
+ valid: boolean;
15
+ };
16
+ type SummaryBase = {
17
+ errorCount: number;
18
+ warnCount: number;
19
+ testCount: number;
20
+ };
21
+ type FailureMessages = Record<string, string[]>;
2
22
  declare enum TestSeverity {
3
23
  Error = "error",
4
24
  Warning = "warning"
@@ -48,61 +68,27 @@ type AsyncTest = Promise<string | void>;
48
68
  type TestResult = AsyncTest | boolean | void;
49
69
  type TestFn = () => TestResult;
50
70
  type KStatus = "UNTESTED" | "SKIPPED" | "FAILED" | "WARNING" | "PASSING" | "PENDING" | "CANCELED" | "OMITTED";
51
- type CB = (...args: any[]) => void;
52
- /**
53
- * Reads the testObjects list and gets full validation result from it.
54
- */
55
- declare function genTestsSummary(): SuiteSummary;
56
- type SuiteSummary = {
57
- groups: Groups;
58
- tests: Tests;
59
- valid: boolean;
60
- } & SummaryBase;
61
- type GroupTestSummary = SingleTestSummary;
62
- type Groups = Record<string, Group>;
63
- type Group = Record<string, GroupTestSummary>;
64
- type Tests = Record<string, SingleTestSummary>;
65
- type SingleTestSummary = SummaryBase & {
66
- errors: string[];
67
- warnings: string[];
68
- valid: boolean;
69
- };
70
- type SummaryBase = {
71
- errorCount: number;
72
- warnCount: number;
73
- testCount: number;
74
- };
75
- type FailureMessages = Record<string, string[]>;
76
- declare function getErrors(): FailureMessages;
77
- declare function getErrors(fieldName?: string): string[];
78
- declare function getWarnings(): FailureMessages;
79
- declare function getWarnings(fieldName?: string): string[];
80
- declare function getErrorsByGroup(groupName: string): FailureMessages;
81
- declare function getErrorsByGroup(groupName: string, fieldName: string): string[];
82
- declare function getWarningsByGroup(groupName: string): FailureMessages;
83
- declare function getWarningsByGroup(groupName: string, fieldName: string): string[];
84
- declare function hasErrors(fieldName?: string): boolean;
85
- declare function hasWarnings(fieldName?: string): boolean;
86
- declare function hasErrorsByGroup(groupName: string, fieldName?: string): boolean;
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
- type SuiteResult = ReturnType<typeof genTestsSummary> & {
91
- /**
92
- * Returns whether the suite as a whole is valid.
93
- * Determined if there are no errors, and if no
94
- * required fields are skipped.
95
- */
96
- isValid: typeof isValid;
97
- isValidByGroup: typeof isValidByGroup;
98
- hasErrors: typeof hasErrors;
99
- hasWarnings: typeof hasWarnings;
100
- getErrors: typeof getErrors;
101
- getWarnings: typeof getWarnings;
102
- hasErrorsByGroup: typeof hasErrorsByGroup;
103
- hasWarningsByGroup: typeof hasWarningsByGroup;
104
- getErrorsByGroup: typeof getErrorsByGroup;
105
- getWarningsByGroup: typeof getWarningsByGroup;
71
+ type CB = (...args: any[]) => any;
72
+ // eslint-disable-next-line max-lines-per-function, max-statements
73
+ declare function suiteSelectors(summary: SuiteSummary): SuiteSelectors;
74
+ interface SuiteSelectors {
75
+ getErrors(fieldName: string): string[];
76
+ getErrors(): FailureMessages;
77
+ getWarnings(): FailureMessages;
78
+ getWarnings(fieldName: string): string[];
79
+ getErrorsByGroup(groupName: string, fieldName: string): string[];
80
+ getErrorsByGroup(groupName: string): FailureMessages;
81
+ getWarningsByGroup(groupName: string): FailureMessages;
82
+ getWarningsByGroup(groupName: string, fieldName: string): string[];
83
+ hasErrors(fieldName?: string): boolean;
84
+ hasWarnings(fieldName?: string): boolean;
85
+ hasErrorsByGroup(groupName: string, fieldName?: string): boolean;
86
+ hasWarningsByGroup(groupName: string, fieldName?: string): boolean;
87
+ isValid(fieldName?: string): boolean;
88
+ isValidByGroup(groupName: string, fieldName?: string): boolean;
89
+ }
90
+ type SuiteResult = SuiteSummary & SuiteSelectors & {
91
+ suiteName: SuiteName;
106
92
  };
107
93
  type SuiteRunResult = SuiteResult & {
108
94
  done: Done;
@@ -136,8 +122,9 @@ type Suite<T extends CB> = {
136
122
  * });
137
123
  * });
138
124
  */
139
- declare function create<T extends CB>(suiteName: string, suiteCallback: T): Suite<T>;
125
+ declare function create<T extends CB>(suiteName: SuiteName, suiteCallback: T): Suite<T>;
140
126
  declare function create<T extends CB>(suiteCallback: T): Suite<T>;
127
+ type SuiteName = string | void;
141
128
  type IsolateCursor = {
142
129
  current: () => number;
143
130
  next: () => void;
@@ -182,7 +169,6 @@ type OptionalFields = Record<string, [
182
169
  rule: (() => boolean) | boolean,
183
170
  isApplied: boolean
184
171
  ]>;
185
- type SuiteName = string | void;
186
172
  type TestCallbacks = {
187
173
  fieldCallbacks: Record<string, Array<(res: SuiteResult) => void>>;
188
174
  doneCallbacks: Array<(res: SuiteResult) => void>;
@@ -219,7 +205,6 @@ type CTXType = {
219
205
  };
220
206
  emit: (event: string, ...args: any[]) => void;
221
207
  };
222
- summary?: SuiteSummary;
223
208
  };
224
209
  declare const context: typeof _default;
225
210
  /**
@@ -349,6 +334,6 @@ declare const test: typeof testBase & {
349
334
  * Sets a running test to warn only mode.
350
335
  */
351
336
  declare function warn(): void;
352
- declare const VERSION = "4.4.3-dev-c786f7";
353
- export { test, create, each, only, skip, warn, group, optional, skipWhen, omitWhen, enforce, VERSION, context, include, eager };
337
+ declare const VERSION = "4.5.0-dev-9b46fb";
338
+ export { suiteSelectors, test, create, each, only, skip, warn, group, optional, skipWhen, omitWhen, enforce, VERSION, context, include, eager };
354
339
  export type { SuiteResult, SuiteRunResult, SuiteSummary, VestTest, Suite };