vest 5.0.0-dev-781e21 → 5.0.2-dev-d315d9

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 (182) hide show
  1. package/LICENSE +2 -2
  2. package/README.md +2 -57
  3. package/dist/cjs/classnames.development.js +18 -16
  4. package/dist/cjs/classnames.production.js +1 -1
  5. package/dist/cjs/enforce/compose.development.js +5 -54
  6. package/dist/cjs/enforce/compose.production.js +1 -1
  7. package/dist/cjs/enforce/compounds.development.js +20 -83
  8. package/dist/cjs/enforce/compounds.production.js +1 -1
  9. package/dist/cjs/enforce/schema.development.js +19 -82
  10. package/dist/cjs/enforce/schema.production.js +1 -1
  11. package/dist/cjs/parser.development.js +12 -9
  12. package/dist/cjs/parser.production.js +1 -1
  13. package/dist/cjs/promisify.development.js +4 -8
  14. package/dist/cjs/promisify.production.js +1 -1
  15. package/dist/cjs/vest.development.js +1287 -1153
  16. package/dist/cjs/vest.production.js +1 -1
  17. package/dist/es/classnames.development.js +20 -18
  18. package/dist/es/classnames.production.js +1 -1
  19. package/dist/es/enforce/compose.development.js +1 -58
  20. package/dist/es/enforce/compose.production.js +1 -1
  21. package/dist/es/enforce/compounds.development.js +2 -90
  22. package/dist/es/enforce/compounds.production.js +1 -1
  23. package/dist/es/enforce/schema.development.js +2 -88
  24. package/dist/es/enforce/schema.production.js +1 -1
  25. package/dist/es/parser.development.js +12 -9
  26. package/dist/es/parser.production.js +1 -1
  27. package/dist/es/promisify.development.js +5 -9
  28. package/dist/es/promisify.production.js +1 -1
  29. package/dist/es/vest.development.js +1286 -1148
  30. package/dist/es/vest.production.js +1 -1
  31. package/dist/umd/classnames.development.js +21 -19
  32. package/dist/umd/classnames.production.js +1 -1
  33. package/dist/umd/enforce/compose.development.js +9 -57
  34. package/dist/umd/enforce/compose.production.js +1 -1
  35. package/dist/umd/enforce/compounds.development.js +32 -94
  36. package/dist/umd/enforce/compounds.production.js +1 -1
  37. package/dist/umd/enforce/schema.development.js +32 -94
  38. package/dist/umd/enforce/schema.production.js +1 -1
  39. package/dist/umd/parser.development.js +16 -13
  40. package/dist/umd/parser.production.js +1 -1
  41. package/dist/umd/promisify.development.js +7 -11
  42. package/dist/umd/promisify.production.js +1 -1
  43. package/dist/umd/vest.development.js +1289 -1155
  44. package/dist/umd/vest.production.js +1 -1
  45. package/package.json +12 -16
  46. package/src/__tests__/__snapshots__/integration.async-tests.test.ts.snap +71 -0
  47. package/src/__tests__/__snapshots__/integration.base.test.ts.snap +71 -0
  48. package/src/__tests__/__snapshots__/integration.stateful-async.test.ts.snap +243 -0
  49. package/src/__tests__/__snapshots__/integration.stateful-tests.test.ts.snap +376 -0
  50. package/src/__tests__/integration.async-tests.test.ts +90 -0
  51. package/src/__tests__/integration.base.test.ts +45 -0
  52. package/src/__tests__/integration.exclusive.test.ts +88 -0
  53. package/src/__tests__/integration.stateful-async.test.ts +137 -0
  54. package/src/__tests__/integration.stateful-tests.test.ts +155 -0
  55. package/src/__tests__/isolate.test.ts +288 -0
  56. package/src/__tests__/state_refill.test.ts +41 -0
  57. package/src/core/SuiteWalker/SuiteWalker.ts +64 -0
  58. package/src/core/SuiteWalker/__tests__/hasRemainingTests.test.ts +130 -0
  59. package/src/core/VestBus/VestBus.ts +78 -0
  60. package/src/core/context/PersistedContext.ts +243 -0
  61. package/src/core/context/SuiteContext.ts +74 -0
  62. package/src/core/isolate/IsolateTest/IsolateTest.ts +213 -0
  63. package/src/core/isolate/IsolateTest/IsolateTestReconciler.ts +156 -0
  64. package/src/core/isolate/IsolateTest/IsolateTestStateMachine.ts +69 -0
  65. package/src/core/isolate/IsolateTest/SimpleStateMachine.ts +43 -0
  66. package/src/core/isolate/IsolateTest/TestWalker.ts +77 -0
  67. package/src/core/isolate/IsolateTypes.ts +10 -0
  68. package/src/core/isolate/isIsolate.ts +6 -0
  69. package/src/core/isolate/isolate.ts +110 -0
  70. package/src/core/isolate/reconciler/Reconciler/Reconciler.ts +123 -0
  71. package/src/core/isolate/reconciler/cancelOverriddenPendingTest.ts +15 -0
  72. package/src/core/isolate/reconciler/isSameProfileTest.ts +12 -0
  73. package/src/core/isolate/walker.ts +127 -0
  74. package/src/core/test/TestTypes.ts +3 -0
  75. package/src/core/test/__tests__/IsolateTest.test.ts +152 -0
  76. package/src/core/test/__tests__/__snapshots__/IsolateTest.test.ts.snap +39 -0
  77. package/src/core/test/__tests__/__snapshots__/memo.test.ts.snap +101 -0
  78. package/src/core/test/__tests__/__snapshots__/test.test.ts.snap +231 -0
  79. package/src/core/test/__tests__/key.test.ts +195 -0
  80. package/src/core/test/__tests__/memo.test.ts +218 -0
  81. package/src/core/test/__tests__/merging_of_previous_test_runs.test.ts +341 -0
  82. package/src/core/test/__tests__/runAsyncTest.test.ts +175 -0
  83. package/src/core/test/__tests__/test.test.ts +226 -0
  84. package/src/core/test/helpers/__tests__/nonMatchingSeverityProfile.test.ts +52 -0
  85. package/src/core/test/helpers/asVestTest.ts +9 -0
  86. package/src/core/test/helpers/matchingFieldName.ts +16 -0
  87. package/src/core/test/helpers/matchingGroupName.ts +12 -0
  88. package/src/core/test/helpers/nonMatchingSeverityProfile.ts +14 -0
  89. package/src/core/test/helpers/shouldUseErrorMessage.ts +9 -0
  90. package/src/core/test/test.memo.ts +81 -0
  91. package/src/core/test/test.ts +64 -0
  92. package/src/core/test/testLevelFlowControl/runTest.ts +86 -0
  93. package/src/core/test/testLevelFlowControl/verifyTestRun.ts +32 -0
  94. package/src/core/test/testObjectIsolate.ts +11 -0
  95. package/src/errors/ErrorStrings.ts +4 -0
  96. package/src/exports/__tests__/classnames.test.ts +92 -0
  97. package/src/exports/__tests__/parser.test.ts +441 -0
  98. package/src/exports/__tests__/promisify.test.ts +77 -0
  99. package/src/exports/classnames.ts +35 -0
  100. package/src/exports/enforce@compose.ts +1 -0
  101. package/src/exports/enforce@compounds.ts +1 -0
  102. package/src/exports/enforce@schema.ts +1 -0
  103. package/src/exports/parser.ts +63 -0
  104. package/src/exports/promisify.ts +18 -0
  105. package/src/hooks/__tests__/__snapshots__/include.test.ts.snap +794 -0
  106. package/src/hooks/__tests__/eager.test.ts +130 -0
  107. package/src/hooks/__tests__/exclusive.test.ts +578 -0
  108. package/src/hooks/__tests__/include.test.ts +431 -0
  109. package/src/hooks/__tests__/optional.test.ts +83 -0
  110. package/src/hooks/__tests__/warn.test.ts +42 -0
  111. package/src/hooks/exclusive.ts +179 -0
  112. package/src/hooks/include.ts +54 -0
  113. package/src/hooks/mode.ts +47 -0
  114. package/src/hooks/optional/OptionalTypes.ts +31 -0
  115. package/src/hooks/optional/optional.ts +69 -0
  116. package/src/hooks/warn.ts +19 -0
  117. package/src/isolates/__tests__/__snapshots__/each.test.ts.snap +3 -0
  118. package/src/isolates/__tests__/__snapshots__/group.test.ts.snap +114 -0
  119. package/src/isolates/__tests__/__snapshots__/omitWhen.test.ts.snap +443 -0
  120. package/src/isolates/__tests__/__snapshots__/skipWhen.test.ts.snap +99 -0
  121. package/src/isolates/__tests__/each.test.ts +35 -0
  122. package/src/isolates/__tests__/group.test.ts +362 -0
  123. package/src/isolates/__tests__/omitWhen.test.ts +246 -0
  124. package/src/isolates/__tests__/skipWhen.test.ts +163 -0
  125. package/src/isolates/each.ts +30 -0
  126. package/src/isolates/group.ts +9 -0
  127. package/src/isolates/omitWhen.ts +41 -0
  128. package/src/isolates/skipWhen.ts +42 -0
  129. package/src/suite/__tests__/__snapshots__/create.test.ts.snap +67 -0
  130. package/src/suite/__tests__/create.test.ts +109 -0
  131. package/src/suite/__tests__/remove.test.ts +50 -0
  132. package/src/suite/__tests__/resetField.test.ts +74 -0
  133. package/src/suite/createSuite.ts +94 -0
  134. package/src/suite/runCallbacks.ts +28 -0
  135. package/src/suiteResult/Severity.ts +15 -0
  136. package/src/suiteResult/SuiteResultTypes.ts +42 -0
  137. package/src/suiteResult/__tests__/done.test.ts +334 -0
  138. package/src/suiteResult/__tests__/produce.test.ts +163 -0
  139. package/src/suiteResult/done/deferDoneCallback.ts +28 -0
  140. package/src/suiteResult/done/shouldSkipDoneRegistration.ts +20 -0
  141. package/src/suiteResult/selectors/__tests__/__snapshots__/collectFailureMessages.test.ts.snap +89 -0
  142. package/src/suiteResult/selectors/__tests__/collectFailureMessages.test.ts +124 -0
  143. package/src/suiteResult/selectors/__tests__/getFailures.test.ts +158 -0
  144. package/src/suiteResult/selectors/__tests__/getFailuresByGroup.test.ts +199 -0
  145. package/src/suiteResult/selectors/__tests__/hasFailures.test.ts +141 -0
  146. package/src/suiteResult/selectors/__tests__/hasFailuresByGroup.test.ts +185 -0
  147. package/src/suiteResult/selectors/__tests__/hasFailuresByTestObject.test.ts +88 -0
  148. package/src/suiteResult/selectors/__tests__/isValid.test.ts +359 -0
  149. package/src/suiteResult/selectors/__tests__/isValidByGroup.test.ts +480 -0
  150. package/src/suiteResult/selectors/collectFailures.ts +43 -0
  151. package/src/suiteResult/selectors/hasFailuresByTestObjects.ts +62 -0
  152. package/src/suiteResult/selectors/produceSuiteSummary.ts +135 -0
  153. package/src/suiteResult/selectors/shouldAddValidProperty.ts +148 -0
  154. package/src/suiteResult/selectors/suiteSelectors.ts +199 -0
  155. package/src/suiteResult/suiteResult.ts +15 -0
  156. package/src/suiteResult/suiteRunResult.ts +43 -0
  157. package/src/vest.ts +36 -0
  158. package/testUtils/TVestMock.ts +5 -0
  159. package/testUtils/__tests__/partition.test.ts +4 -4
  160. package/testUtils/mockThrowError.ts +4 -2
  161. package/testUtils/suiteDummy.ts +2 -1
  162. package/testUtils/testDummy.ts +12 -10
  163. package/testUtils/testPromise.ts +3 -0
  164. package/tsconfig.json +84 -2
  165. package/types/classnames.d.ts +39 -4
  166. package/types/classnames.d.ts.map +1 -0
  167. package/types/enforce/compose.d.ts +2 -126
  168. package/types/enforce/compose.d.ts.map +1 -0
  169. package/types/enforce/compounds.d.ts +2 -136
  170. package/types/enforce/compounds.d.ts.map +1 -0
  171. package/types/enforce/schema.d.ts +2 -144
  172. package/types/enforce/schema.d.ts.map +1 -0
  173. package/types/parser.d.ts +45 -10
  174. package/types/parser.d.ts.map +1 -0
  175. package/types/promisify.d.ts +36 -34
  176. package/types/promisify.d.ts.map +1 -0
  177. package/types/vest.d.ts +169 -224
  178. package/types/vest.d.ts.map +1 -0
  179. package/CHANGELOG.md +0 -87
  180. package/testUtils/expandStateRef.ts +0 -8
  181. package/testUtils/runCreateRef.ts +0 -10
  182. package/testUtils/testObjects.ts +0 -6
@@ -0,0 +1,443 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`omitWhen When conditional is falsy boolean conditional Should have all tests within the omit block referenced in the result 1`] = `
4
+ {
5
+ "field_1": {
6
+ "errorCount": 1,
7
+ "errors": [],
8
+ "testCount": 2,
9
+ "valid": false,
10
+ "warnCount": 0,
11
+ "warnings": [],
12
+ },
13
+ "field_2": {
14
+ "errorCount": 0,
15
+ "errors": [],
16
+ "testCount": 0,
17
+ "valid": false,
18
+ "warnCount": 0,
19
+ "warnings": [],
20
+ },
21
+ "field_3": {
22
+ "errorCount": 0,
23
+ "errors": [],
24
+ "testCount": 0,
25
+ "valid": false,
26
+ "warnCount": 0,
27
+ "warnings": [],
28
+ },
29
+ "field_4": {
30
+ "errorCount": 0,
31
+ "errors": [],
32
+ "testCount": 0,
33
+ "valid": false,
34
+ "warnCount": 0,
35
+ "warnings": [],
36
+ },
37
+ }
38
+ `;
39
+
40
+ exports[`omitWhen When conditional is falsy boolean conditional Should run tests normally 1`] = `
41
+ {
42
+ "field_1": {
43
+ "errorCount": 1,
44
+ "errors": [],
45
+ "testCount": 2,
46
+ "valid": false,
47
+ "warnCount": 0,
48
+ "warnings": [],
49
+ },
50
+ "field_2": {
51
+ "errorCount": 0,
52
+ "errors": [],
53
+ "testCount": 0,
54
+ "valid": false,
55
+ "warnCount": 0,
56
+ "warnings": [],
57
+ },
58
+ "field_3": {
59
+ "errorCount": 0,
60
+ "errors": [],
61
+ "testCount": 0,
62
+ "valid": false,
63
+ "warnCount": 0,
64
+ "warnings": [],
65
+ },
66
+ "field_4": {
67
+ "errorCount": 0,
68
+ "errors": [],
69
+ "testCount": 0,
70
+ "valid": false,
71
+ "warnCount": 0,
72
+ "warnings": [],
73
+ },
74
+ }
75
+ `;
76
+
77
+ exports[`omitWhen When conditional is falsy boolean conditional Should run tests normally 2`] = `
78
+ {
79
+ "field_1": {
80
+ "errorCount": 1,
81
+ "errors": [],
82
+ "testCount": 2,
83
+ "valid": false,
84
+ "warnCount": 0,
85
+ "warnings": [],
86
+ },
87
+ "field_2": {
88
+ "errorCount": 0,
89
+ "errors": [],
90
+ "testCount": 0,
91
+ "valid": false,
92
+ "warnCount": 0,
93
+ "warnings": [],
94
+ },
95
+ "field_3": {
96
+ "errorCount": 0,
97
+ "errors": [],
98
+ "testCount": 0,
99
+ "valid": false,
100
+ "warnCount": 0,
101
+ "warnings": [],
102
+ },
103
+ "field_4": {
104
+ "errorCount": 0,
105
+ "errors": [],
106
+ "testCount": 1,
107
+ "valid": true,
108
+ "warnCount": 0,
109
+ "warnings": [],
110
+ },
111
+ }
112
+ `;
113
+
114
+ exports[`omitWhen When conditional is falsy function conditional Should have all tests within the omit block referenced in the result 1`] = `
115
+ {
116
+ "field_1": {
117
+ "errorCount": 1,
118
+ "errors": [],
119
+ "testCount": 2,
120
+ "valid": false,
121
+ "warnCount": 0,
122
+ "warnings": [],
123
+ },
124
+ "field_2": {
125
+ "errorCount": 0,
126
+ "errors": [],
127
+ "testCount": 0,
128
+ "valid": false,
129
+ "warnCount": 0,
130
+ "warnings": [],
131
+ },
132
+ "field_3": {
133
+ "errorCount": 0,
134
+ "errors": [],
135
+ "testCount": 0,
136
+ "valid": false,
137
+ "warnCount": 0,
138
+ "warnings": [],
139
+ },
140
+ "field_4": {
141
+ "errorCount": 0,
142
+ "errors": [],
143
+ "testCount": 0,
144
+ "valid": false,
145
+ "warnCount": 0,
146
+ "warnings": [],
147
+ },
148
+ }
149
+ `;
150
+
151
+ exports[`omitWhen When conditional is falsy function conditional Should run tests normally 1`] = `
152
+ {
153
+ "field_1": {
154
+ "errorCount": 1,
155
+ "errors": [],
156
+ "testCount": 2,
157
+ "valid": false,
158
+ "warnCount": 0,
159
+ "warnings": [],
160
+ },
161
+ "field_2": {
162
+ "errorCount": 0,
163
+ "errors": [],
164
+ "testCount": 0,
165
+ "valid": false,
166
+ "warnCount": 0,
167
+ "warnings": [],
168
+ },
169
+ "field_3": {
170
+ "errorCount": 0,
171
+ "errors": [],
172
+ "testCount": 0,
173
+ "valid": false,
174
+ "warnCount": 0,
175
+ "warnings": [],
176
+ },
177
+ "field_4": {
178
+ "errorCount": 0,
179
+ "errors": [],
180
+ "testCount": 0,
181
+ "valid": false,
182
+ "warnCount": 0,
183
+ "warnings": [],
184
+ },
185
+ }
186
+ `;
187
+
188
+ exports[`omitWhen When conditional is falsy function conditional Should run tests normally 2`] = `
189
+ {
190
+ "field_1": {
191
+ "errorCount": 1,
192
+ "errors": [],
193
+ "testCount": 2,
194
+ "valid": false,
195
+ "warnCount": 0,
196
+ "warnings": [],
197
+ },
198
+ "field_2": {
199
+ "errorCount": 0,
200
+ "errors": [],
201
+ "testCount": 0,
202
+ "valid": false,
203
+ "warnCount": 0,
204
+ "warnings": [],
205
+ },
206
+ "field_3": {
207
+ "errorCount": 0,
208
+ "errors": [],
209
+ "testCount": 0,
210
+ "valid": false,
211
+ "warnCount": 0,
212
+ "warnings": [],
213
+ },
214
+ "field_4": {
215
+ "errorCount": 0,
216
+ "errors": [],
217
+ "testCount": 1,
218
+ "valid": true,
219
+ "warnCount": 0,
220
+ "warnings": [],
221
+ },
222
+ }
223
+ `;
224
+
225
+ exports[`omitWhen When conditional is truthy boolean conditional Should avoid running the omitted tests 1`] = `
226
+ {
227
+ "errorCount": 1,
228
+ "getErrors": [Function],
229
+ "getErrorsByGroup": [Function],
230
+ "getWarnings": [Function],
231
+ "getWarningsByGroup": [Function],
232
+ "groups": {},
233
+ "hasErrors": [Function],
234
+ "hasErrorsByGroup": [Function],
235
+ "hasWarnings": [Function],
236
+ "hasWarningsByGroup": [Function],
237
+ "isValid": [Function],
238
+ "isValidByGroup": [Function],
239
+ "suiteName": undefined,
240
+ "testCount": 2,
241
+ "tests": {
242
+ "field_1": {
243
+ "errorCount": 0,
244
+ "errors": [],
245
+ "testCount": 1,
246
+ "valid": true,
247
+ "warnCount": 0,
248
+ "warnings": [],
249
+ },
250
+ "field_2": {
251
+ "errorCount": 1,
252
+ "errors": [],
253
+ "testCount": 1,
254
+ "valid": false,
255
+ "warnCount": 0,
256
+ "warnings": [],
257
+ },
258
+ "field_3": {
259
+ "errorCount": 0,
260
+ "errors": [],
261
+ "testCount": 0,
262
+ "valid": true,
263
+ "warnCount": 0,
264
+ "warnings": [],
265
+ },
266
+ "field_4": {
267
+ "errorCount": 0,
268
+ "errors": [],
269
+ "testCount": 0,
270
+ "valid": true,
271
+ "warnCount": 0,
272
+ "warnings": [],
273
+ },
274
+ },
275
+ "valid": false,
276
+ "warnCount": 0,
277
+ }
278
+ `;
279
+
280
+ exports[`omitWhen When conditional is truthy boolean conditional Should skip and not run omitted fields when no filter provided 1`] = `
281
+ {
282
+ "errorCount": 1,
283
+ "getErrors": [Function],
284
+ "getErrorsByGroup": [Function],
285
+ "getWarnings": [Function],
286
+ "getWarningsByGroup": [Function],
287
+ "groups": {},
288
+ "hasErrors": [Function],
289
+ "hasErrorsByGroup": [Function],
290
+ "hasWarnings": [Function],
291
+ "hasWarningsByGroup": [Function],
292
+ "isValid": [Function],
293
+ "isValidByGroup": [Function],
294
+ "suiteName": undefined,
295
+ "testCount": 2,
296
+ "tests": {
297
+ "field_1": {
298
+ "errorCount": 0,
299
+ "errors": [],
300
+ "testCount": 1,
301
+ "valid": true,
302
+ "warnCount": 0,
303
+ "warnings": [],
304
+ },
305
+ "field_2": {
306
+ "errorCount": 1,
307
+ "errors": [],
308
+ "testCount": 1,
309
+ "valid": false,
310
+ "warnCount": 0,
311
+ "warnings": [],
312
+ },
313
+ "field_3": {
314
+ "errorCount": 0,
315
+ "errors": [],
316
+ "testCount": 0,
317
+ "valid": true,
318
+ "warnCount": 0,
319
+ "warnings": [],
320
+ },
321
+ "field_4": {
322
+ "errorCount": 0,
323
+ "errors": [],
324
+ "testCount": 0,
325
+ "valid": true,
326
+ "warnCount": 0,
327
+ "warnings": [],
328
+ },
329
+ },
330
+ "valid": false,
331
+ "warnCount": 0,
332
+ }
333
+ `;
334
+
335
+ exports[`omitWhen When conditional is truthy function conditional Should avoid running the omitted tests 1`] = `
336
+ {
337
+ "errorCount": 1,
338
+ "getErrors": [Function],
339
+ "getErrorsByGroup": [Function],
340
+ "getWarnings": [Function],
341
+ "getWarningsByGroup": [Function],
342
+ "groups": {},
343
+ "hasErrors": [Function],
344
+ "hasErrorsByGroup": [Function],
345
+ "hasWarnings": [Function],
346
+ "hasWarningsByGroup": [Function],
347
+ "isValid": [Function],
348
+ "isValidByGroup": [Function],
349
+ "suiteName": undefined,
350
+ "testCount": 2,
351
+ "tests": {
352
+ "field_1": {
353
+ "errorCount": 0,
354
+ "errors": [],
355
+ "testCount": 1,
356
+ "valid": true,
357
+ "warnCount": 0,
358
+ "warnings": [],
359
+ },
360
+ "field_2": {
361
+ "errorCount": 1,
362
+ "errors": [],
363
+ "testCount": 1,
364
+ "valid": false,
365
+ "warnCount": 0,
366
+ "warnings": [],
367
+ },
368
+ "field_3": {
369
+ "errorCount": 0,
370
+ "errors": [],
371
+ "testCount": 0,
372
+ "valid": true,
373
+ "warnCount": 0,
374
+ "warnings": [],
375
+ },
376
+ "field_4": {
377
+ "errorCount": 0,
378
+ "errors": [],
379
+ "testCount": 0,
380
+ "valid": true,
381
+ "warnCount": 0,
382
+ "warnings": [],
383
+ },
384
+ },
385
+ "valid": false,
386
+ "warnCount": 0,
387
+ }
388
+ `;
389
+
390
+ exports[`omitWhen When conditional is truthy function conditional Should skip and not run omitted fields when no filter provided 1`] = `
391
+ {
392
+ "errorCount": 1,
393
+ "getErrors": [Function],
394
+ "getErrorsByGroup": [Function],
395
+ "getWarnings": [Function],
396
+ "getWarningsByGroup": [Function],
397
+ "groups": {},
398
+ "hasErrors": [Function],
399
+ "hasErrorsByGroup": [Function],
400
+ "hasWarnings": [Function],
401
+ "hasWarningsByGroup": [Function],
402
+ "isValid": [Function],
403
+ "isValidByGroup": [Function],
404
+ "suiteName": undefined,
405
+ "testCount": 2,
406
+ "tests": {
407
+ "field_1": {
408
+ "errorCount": 0,
409
+ "errors": [],
410
+ "testCount": 1,
411
+ "valid": true,
412
+ "warnCount": 0,
413
+ "warnings": [],
414
+ },
415
+ "field_2": {
416
+ "errorCount": 1,
417
+ "errors": [],
418
+ "testCount": 1,
419
+ "valid": false,
420
+ "warnCount": 0,
421
+ "warnings": [],
422
+ },
423
+ "field_3": {
424
+ "errorCount": 0,
425
+ "errors": [],
426
+ "testCount": 0,
427
+ "valid": true,
428
+ "warnCount": 0,
429
+ "warnings": [],
430
+ },
431
+ "field_4": {
432
+ "errorCount": 0,
433
+ "errors": [],
434
+ "testCount": 0,
435
+ "valid": true,
436
+ "warnCount": 0,
437
+ "warnings": [],
438
+ },
439
+ },
440
+ "valid": false,
441
+ "warnCount": 0,
442
+ }
443
+ `;
@@ -0,0 +1,99 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`skipWhen Should pass result draft to the functional condition 1`] = `
4
+ {
5
+ "errorCount": 0,
6
+ "getErrors": [Function],
7
+ "getErrorsByGroup": [Function],
8
+ "getWarnings": [Function],
9
+ "getWarningsByGroup": [Function],
10
+ "groups": {},
11
+ "hasErrors": [Function],
12
+ "hasErrorsByGroup": [Function],
13
+ "hasWarnings": [Function],
14
+ "hasWarningsByGroup": [Function],
15
+ "isValid": [Function],
16
+ "isValidByGroup": [Function],
17
+ "suiteName": undefined,
18
+ "testCount": 0,
19
+ "tests": {},
20
+ "valid": false,
21
+ "warnCount": 0,
22
+ }
23
+ `;
24
+
25
+ exports[`skipWhen Should pass result draft to the functional condition 2`] = `
26
+ {
27
+ "errorCount": 1,
28
+ "getErrors": [Function],
29
+ "getErrorsByGroup": [Function],
30
+ "getWarnings": [Function],
31
+ "getWarningsByGroup": [Function],
32
+ "groups": {},
33
+ "hasErrors": [Function],
34
+ "hasErrorsByGroup": [Function],
35
+ "hasWarnings": [Function],
36
+ "hasWarningsByGroup": [Function],
37
+ "isValid": [Function],
38
+ "isValidByGroup": [Function],
39
+ "suiteName": undefined,
40
+ "testCount": 1,
41
+ "tests": {
42
+ "f1": {
43
+ "errorCount": 1,
44
+ "errors": [
45
+ "msg",
46
+ ],
47
+ "testCount": 1,
48
+ "valid": false,
49
+ "warnCount": 0,
50
+ "warnings": [],
51
+ },
52
+ },
53
+ "valid": false,
54
+ "warnCount": 0,
55
+ }
56
+ `;
57
+
58
+ exports[`skipWhen Should pass result draft to the functional condition 3`] = `
59
+ {
60
+ "errorCount": 2,
61
+ "getErrors": [Function],
62
+ "getErrorsByGroup": [Function],
63
+ "getWarnings": [Function],
64
+ "getWarningsByGroup": [Function],
65
+ "groups": {},
66
+ "hasErrors": [Function],
67
+ "hasErrorsByGroup": [Function],
68
+ "hasWarnings": [Function],
69
+ "hasWarningsByGroup": [Function],
70
+ "isValid": [Function],
71
+ "isValidByGroup": [Function],
72
+ "suiteName": undefined,
73
+ "testCount": 2,
74
+ "tests": {
75
+ "f1": {
76
+ "errorCount": 1,
77
+ "errors": [
78
+ "msg",
79
+ ],
80
+ "testCount": 1,
81
+ "valid": false,
82
+ "warnCount": 0,
83
+ "warnings": [],
84
+ },
85
+ "f2": {
86
+ "errorCount": 1,
87
+ "errors": [
88
+ "msg",
89
+ ],
90
+ "testCount": 1,
91
+ "valid": false,
92
+ "warnCount": 0,
93
+ "warnings": [],
94
+ },
95
+ },
96
+ "valid": false,
97
+ "warnCount": 0,
98
+ }
99
+ `;
@@ -0,0 +1,35 @@
1
+ import * as vest from 'vest';
2
+
3
+ describe('each', () => {
4
+ describe('When callback is not a function', () => {
5
+ it('should throw', () => {
6
+ const control = jest.fn();
7
+ const suite = vest.create(() => {
8
+ expect(() => {
9
+ // @ts-expect-error
10
+ vest.each([null], null);
11
+ }).toThrowErrorMatchingSnapshot();
12
+ control();
13
+ });
14
+
15
+ suite();
16
+ expect(control).toHaveBeenCalledTimes(1);
17
+ });
18
+ });
19
+
20
+ it('Should pass to callback the current list item and index', () => {
21
+ const cb = jest.fn();
22
+ const suite = vest.create(() => {
23
+ vest.each([1, 2, 3, 'str'], cb);
24
+ });
25
+
26
+ suite();
27
+
28
+ expect(cb).toHaveBeenCalledTimes(4);
29
+
30
+ expect(cb).toHaveBeenNthCalledWith(1, 1, 0);
31
+ expect(cb).toHaveBeenNthCalledWith(2, 2, 1);
32
+ expect(cb).toHaveBeenNthCalledWith(3, 3, 2);
33
+ expect(cb).toHaveBeenNthCalledWith(4, 'str', 3);
34
+ });
35
+ });