bupkis 0.1.2 → 0.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.
Files changed (198) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +16 -16
  3. package/dist/commonjs/assertion/assertion-async.d.ts +2 -1
  4. package/dist/commonjs/assertion/assertion-async.d.ts.map +1 -1
  5. package/dist/commonjs/assertion/assertion-async.js +84 -2
  6. package/dist/commonjs/assertion/assertion-async.js.map +1 -1
  7. package/dist/commonjs/assertion/assertion-sync.d.ts +1 -1
  8. package/dist/commonjs/assertion/assertion-sync.d.ts.map +1 -1
  9. package/dist/commonjs/assertion/assertion-sync.js +5 -1
  10. package/dist/commonjs/assertion/assertion-sync.js.map +1 -1
  11. package/dist/commonjs/assertion/assertion-types.d.ts +39 -84
  12. package/dist/commonjs/assertion/assertion-types.d.ts.map +1 -1
  13. package/dist/commonjs/assertion/assertion.d.ts +1 -1
  14. package/dist/commonjs/assertion/assertion.d.ts.map +1 -1
  15. package/dist/commonjs/assertion/assertion.js +1 -14
  16. package/dist/commonjs/assertion/assertion.js.map +1 -1
  17. package/dist/commonjs/assertion/create.d.ts +5 -33
  18. package/dist/commonjs/assertion/create.d.ts.map +1 -1
  19. package/dist/commonjs/assertion/create.js +17 -6
  20. package/dist/commonjs/assertion/create.js.map +1 -1
  21. package/dist/commonjs/assertion/impl/async.d.ts +122 -21
  22. package/dist/commonjs/assertion/impl/async.d.ts.map +1 -1
  23. package/dist/commonjs/assertion/impl/async.js +114 -90
  24. package/dist/commonjs/assertion/impl/async.js.map +1 -1
  25. package/dist/commonjs/assertion/impl/callback.d.ts +104 -0
  26. package/dist/commonjs/assertion/impl/callback.d.ts.map +1 -0
  27. package/dist/commonjs/assertion/impl/callback.js +694 -0
  28. package/dist/commonjs/assertion/impl/callback.js.map +1 -0
  29. package/dist/commonjs/assertion/impl/index.d.ts +1 -1
  30. package/dist/commonjs/assertion/impl/index.d.ts.map +1 -1
  31. package/dist/commonjs/assertion/impl/index.js.map +1 -1
  32. package/dist/commonjs/assertion/impl/sync-esoteric.js +1 -1
  33. package/dist/commonjs/assertion/impl/sync-esoteric.js.map +1 -1
  34. package/dist/commonjs/assertion/impl/sync-parametric.d.ts +37 -34
  35. package/dist/commonjs/assertion/impl/sync-parametric.d.ts.map +1 -1
  36. package/dist/commonjs/assertion/impl/sync-parametric.js +32 -47
  37. package/dist/commonjs/assertion/impl/sync-parametric.js.map +1 -1
  38. package/dist/commonjs/assertion/impl/sync.d.ts +105 -58
  39. package/dist/commonjs/assertion/impl/sync.d.ts.map +1 -1
  40. package/dist/commonjs/assertion/impl/sync.js +4 -1
  41. package/dist/commonjs/assertion/impl/sync.js.map +1 -1
  42. package/dist/commonjs/bootstrap.d.ts +199 -85
  43. package/dist/commonjs/bootstrap.d.ts.map +1 -1
  44. package/dist/commonjs/bootstrap.js +19 -10
  45. package/dist/commonjs/bootstrap.js.map +1 -1
  46. package/dist/commonjs/constant.js +7 -1
  47. package/dist/commonjs/constant.js.map +1 -1
  48. package/dist/commonjs/error.d.ts +32 -5
  49. package/dist/commonjs/error.d.ts.map +1 -1
  50. package/dist/commonjs/error.js +60 -5
  51. package/dist/commonjs/error.js.map +1 -1
  52. package/dist/commonjs/expect.d.ts +130 -3
  53. package/dist/commonjs/expect.d.ts.map +1 -1
  54. package/dist/commonjs/expect.js +116 -1
  55. package/dist/commonjs/expect.js.map +1 -1
  56. package/dist/commonjs/guards.d.ts +45 -20
  57. package/dist/commonjs/guards.d.ts.map +1 -1
  58. package/dist/commonjs/guards.js +56 -40
  59. package/dist/commonjs/guards.js.map +1 -1
  60. package/dist/commonjs/index.d.ts +241 -86
  61. package/dist/commonjs/index.d.ts.map +1 -1
  62. package/dist/commonjs/index.js +44 -42
  63. package/dist/commonjs/index.js.map +1 -1
  64. package/dist/commonjs/metadata.d.ts +1 -27
  65. package/dist/commonjs/metadata.d.ts.map +1 -1
  66. package/dist/commonjs/metadata.js +16 -15
  67. package/dist/commonjs/metadata.js.map +1 -1
  68. package/dist/commonjs/schema.d.ts +76 -33
  69. package/dist/commonjs/schema.d.ts.map +1 -1
  70. package/dist/commonjs/schema.js +77 -34
  71. package/dist/commonjs/schema.js.map +1 -1
  72. package/dist/commonjs/types.d.ts +480 -39
  73. package/dist/commonjs/types.d.ts.map +1 -1
  74. package/dist/commonjs/types.js +12 -2
  75. package/dist/commonjs/types.js.map +1 -1
  76. package/dist/commonjs/util.d.ts +72 -49
  77. package/dist/commonjs/util.d.ts.map +1 -1
  78. package/dist/commonjs/util.js +175 -155
  79. package/dist/commonjs/util.js.map +1 -1
  80. package/dist/commonjs/value-to-schema.d.ts +122 -0
  81. package/dist/commonjs/value-to-schema.d.ts.map +1 -0
  82. package/dist/commonjs/value-to-schema.js +309 -0
  83. package/dist/commonjs/value-to-schema.js.map +1 -0
  84. package/dist/esm/assertion/assertion-async.d.ts +2 -1
  85. package/dist/esm/assertion/assertion-async.d.ts.map +1 -1
  86. package/dist/esm/assertion/assertion-async.js +85 -3
  87. package/dist/esm/assertion/assertion-async.js.map +1 -1
  88. package/dist/esm/assertion/assertion-sync.d.ts +1 -1
  89. package/dist/esm/assertion/assertion-sync.d.ts.map +1 -1
  90. package/dist/esm/assertion/assertion-sync.js +6 -2
  91. package/dist/esm/assertion/assertion-sync.js.map +1 -1
  92. package/dist/esm/assertion/assertion-types.d.ts +39 -84
  93. package/dist/esm/assertion/assertion-types.d.ts.map +1 -1
  94. package/dist/esm/assertion/assertion.d.ts +1 -1
  95. package/dist/esm/assertion/assertion.d.ts.map +1 -1
  96. package/dist/esm/assertion/assertion.js +1 -14
  97. package/dist/esm/assertion/assertion.js.map +1 -1
  98. package/dist/esm/assertion/create.d.ts +5 -33
  99. package/dist/esm/assertion/create.d.ts.map +1 -1
  100. package/dist/esm/assertion/create.js +14 -4
  101. package/dist/esm/assertion/create.js.map +1 -1
  102. package/dist/esm/assertion/impl/async.d.ts +122 -21
  103. package/dist/esm/assertion/impl/async.d.ts.map +1 -1
  104. package/dist/esm/assertion/impl/async.js +113 -89
  105. package/dist/esm/assertion/impl/async.js.map +1 -1
  106. package/dist/esm/assertion/impl/callback.d.ts +104 -0
  107. package/dist/esm/assertion/impl/callback.d.ts.map +1 -0
  108. package/dist/esm/assertion/impl/callback.js +691 -0
  109. package/dist/esm/assertion/impl/callback.js.map +1 -0
  110. package/dist/esm/assertion/impl/index.d.ts +1 -1
  111. package/dist/esm/assertion/impl/index.d.ts.map +1 -1
  112. package/dist/esm/assertion/impl/index.js +1 -1
  113. package/dist/esm/assertion/impl/index.js.map +1 -1
  114. package/dist/esm/assertion/impl/sync-esoteric.js +2 -2
  115. package/dist/esm/assertion/impl/sync-esoteric.js.map +1 -1
  116. package/dist/esm/assertion/impl/sync-parametric.d.ts +37 -34
  117. package/dist/esm/assertion/impl/sync-parametric.d.ts.map +1 -1
  118. package/dist/esm/assertion/impl/sync-parametric.js +32 -47
  119. package/dist/esm/assertion/impl/sync-parametric.js.map +1 -1
  120. package/dist/esm/assertion/impl/sync.d.ts +105 -58
  121. package/dist/esm/assertion/impl/sync.d.ts.map +1 -1
  122. package/dist/esm/assertion/impl/sync.js +3 -1
  123. package/dist/esm/assertion/impl/sync.js.map +1 -1
  124. package/dist/esm/bootstrap.d.ts +199 -85
  125. package/dist/esm/bootstrap.d.ts.map +1 -1
  126. package/dist/esm/bootstrap.js +19 -10
  127. package/dist/esm/bootstrap.js.map +1 -1
  128. package/dist/esm/constant.js +6 -0
  129. package/dist/esm/constant.js.map +1 -1
  130. package/dist/esm/error.d.ts +32 -5
  131. package/dist/esm/error.d.ts.map +1 -1
  132. package/dist/esm/error.js +59 -5
  133. package/dist/esm/error.js.map +1 -1
  134. package/dist/esm/expect.d.ts +130 -3
  135. package/dist/esm/expect.d.ts.map +1 -1
  136. package/dist/esm/expect.js +117 -2
  137. package/dist/esm/expect.js.map +1 -1
  138. package/dist/esm/guards.d.ts +45 -20
  139. package/dist/esm/guards.d.ts.map +1 -1
  140. package/dist/esm/guards.js +48 -31
  141. package/dist/esm/guards.js.map +1 -1
  142. package/dist/esm/index.d.ts +241 -86
  143. package/dist/esm/index.d.ts.map +1 -1
  144. package/dist/esm/index.js +46 -7
  145. package/dist/esm/index.js.map +1 -1
  146. package/dist/esm/metadata.d.ts +1 -27
  147. package/dist/esm/metadata.d.ts.map +1 -1
  148. package/dist/esm/metadata.js +2 -1
  149. package/dist/esm/metadata.js.map +1 -1
  150. package/dist/esm/schema.d.ts +76 -33
  151. package/dist/esm/schema.d.ts.map +1 -1
  152. package/dist/esm/schema.js +77 -34
  153. package/dist/esm/schema.js.map +1 -1
  154. package/dist/esm/types.d.ts +480 -39
  155. package/dist/esm/types.d.ts.map +1 -1
  156. package/dist/esm/types.js +12 -2
  157. package/dist/esm/types.js.map +1 -1
  158. package/dist/esm/util.d.ts +72 -49
  159. package/dist/esm/util.d.ts.map +1 -1
  160. package/dist/esm/util.js +159 -153
  161. package/dist/esm/util.js.map +1 -1
  162. package/dist/esm/value-to-schema.d.ts +122 -0
  163. package/dist/esm/value-to-schema.d.ts.map +1 -0
  164. package/dist/esm/value-to-schema.js +305 -0
  165. package/dist/esm/value-to-schema.js.map +1 -0
  166. package/package.json +94 -17
  167. package/src/assertion/assertion-async.ts +113 -3
  168. package/src/assertion/assertion-sync.ts +5 -2
  169. package/src/assertion/assertion-types.ts +52 -45
  170. package/src/assertion/assertion.ts +2 -17
  171. package/src/assertion/create.ts +16 -65
  172. package/src/assertion/impl/async.ts +132 -92
  173. package/src/assertion/impl/callback.ts +882 -0
  174. package/src/assertion/impl/index.ts +1 -1
  175. package/src/assertion/impl/sync-esoteric.ts +2 -2
  176. package/src/assertion/impl/sync-parametric.ts +41 -49
  177. package/src/assertion/impl/sync.ts +3 -0
  178. package/src/bootstrap.ts +21 -11
  179. package/src/constant.ts +8 -0
  180. package/src/error.ts +75 -4
  181. package/src/expect.ts +275 -20
  182. package/src/guards.ts +74 -69
  183. package/src/index.ts +72 -11
  184. package/src/metadata.ts +3 -4
  185. package/src/schema.ts +80 -36
  186. package/src/types.ts +625 -72
  187. package/src/util.ts +174 -222
  188. package/src/value-to-schema.ts +464 -0
  189. package/dist/commonjs/api.d.ts +0 -93
  190. package/dist/commonjs/api.d.ts.map +0 -1
  191. package/dist/commonjs/api.js +0 -8
  192. package/dist/commonjs/api.js.map +0 -1
  193. package/dist/esm/api.d.ts +0 -93
  194. package/dist/esm/api.d.ts.map +0 -1
  195. package/dist/esm/api.js +0 -7
  196. package/dist/esm/api.js.map +0 -1
  197. package/src/api.ts +0 -149
  198. package/src/schema.md +0 -15
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AA0BzD,2BAA2B;AAC3B,QAAA,MAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4MAAQ,CAAC;AACvB,gCAAgC;AAChC,QAAA,MAAQ,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8YAAQ,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"bootstrap.d.ts","sourceRoot":"","sources":["../../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAwB3D,QAAA;AACE;;;;;GAKG;AACH,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACN;;;;;GAKG;AACH,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2hBACN,CAAC;AAER,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC"}
@@ -1,20 +1,18 @@
1
1
  /**
2
2
  * Factory function for creating the main assertion functions.
3
3
  *
4
- * This module provides the `bootstrap()` function that creates both synchronous
5
- * and asynchronous assertion engines. It contains the core implementation
6
- * previously split between `expect.ts` and `expect-async.ts`.
4
+ * This module provides the {@link bootstrap} function that creates both
5
+ * synchronous and asynchronous assertion engines.
7
6
  *
8
7
  * @packageDocumentation
9
8
  */
10
- import { SyncAssertions } from './assertion/impl/sync.js';
11
- import { AsyncAssertions } from './assertion/index.js';
9
+ import { AsyncAssertions, SyncAssertions } from './assertion/index.js';
12
10
  import { createUse } from './use.js';
13
11
  /**
14
12
  * Factory function that creates both synchronous and asynchronous assertion
15
13
  * engines.
16
14
  *
17
- * @returns Object containing `expect` and `expectAsync` functions
15
+ * @returns Object containing {@link expect} and {@link expectAsync} functions
18
16
  * @internal
19
17
  */
20
18
  const bootstrap = () => {
@@ -22,9 +20,20 @@ const bootstrap = () => {
22
20
  return { expect, expectAsync };
23
21
  };
24
22
  const api = bootstrap();
25
- /** {@inheritDoc Expect} */
26
- const { expect } = api;
27
- /** {@inheritDoc ExpectAsync} */
28
- const { expectAsync } = api;
23
+ const {
24
+ /**
25
+ * The main synchronous assertion function which can execute only built-in
26
+ * assertions.
27
+ *
28
+ * @function
29
+ */
30
+ expect,
31
+ /**
32
+ * The main asynchronous assertion function which can execute only built-in
33
+ * assertions.
34
+ *
35
+ * @function
36
+ */
37
+ expectAsync, } = api;
29
38
  export { expect, expectAsync };
30
39
  //# sourceMappingURL=bootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,SAAS,GAAG,GAGhB,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CACvC,cAAc,EACd,eAAe,CAChB,CAAC,CAAC,GAAG,cAAc,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC;IAE3C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;AAExB,2BAA2B;AAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC;AACvB,gCAAgC;AAChC,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;AAE5B,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/bootstrap.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC;;;;;;GAMG;AACH,MAAM,SAAS,GAAG,GAGhB,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,SAAS,CACvC,cAAc,EACd,eAAe,CAChB,CAAC,CAAC,GAAG,cAAc,EAAE,GAAG,eAAe,CAAC,CAAC,CAAC;IAE3C,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;AACjC,CAAC,CAAC;AAEF,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;AAExB,MAAM;AACJ;;;;;GAKG;AACH,MAAM;AACN;;;;;GAKG;AACH,WAAW,GACZ,GAAG,GAAG,CAAC;AAER,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC"}
@@ -21,6 +21,12 @@ export const kStringLiteral = Symbol('bupkis:string-literal');
21
21
  * @internal
22
22
  */
23
23
  export const kBupkisAssertionError = Symbol('bupkis-error');
24
+ /**
25
+ * Symbol used to flag a `FailAssertionError`
26
+ *
27
+ * @internal
28
+ */
29
+ export const kBupkisFailAssertionError = Symbol('bupkis-fail-error');
24
30
  /**
25
31
  * Symbol used to flag a `NegatedAssertionError`
26
32
  *
@@ -1 +1 @@
1
- {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/constant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAkB,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAE7E;;;;GAIG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAE3E;;;;GAIG;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAkB,MAAM,CAC/D,sBAAsB,CACvB,CAAC"}
1
+ {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/constant.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAkB,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAE7E;;;;GAIG;AAEH,MAAM,CAAC,MAAM,qBAAqB,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAE3E;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GACpC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAE9B;;;;GAIG;AAEH,MAAM,CAAC,MAAM,4BAA4B,GAAkB,MAAM,CAC/D,sBAAsB,CACvB,CAAC"}
@@ -6,15 +6,42 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  import { AssertionError as NodeAssertionError } from 'node:assert';
9
- import { kBupkisAssertionError } from './constant.js';
9
+ import { z } from 'zod/v4';
10
+ import { type AssertionParts, type ParsedValues } from './types.js';
10
11
  /**
11
12
  * _BUPKIS_' s custom `AssertionError` class, which is just a thin wrapper
12
13
  * around Node.js' {@link NodeAssertionError AssertionError}.
13
- *
14
- * @public
15
14
  */
16
15
  export declare class AssertionError extends NodeAssertionError {
17
- [kBupkisAssertionError]: boolean;
18
- static isAssertionError(err: unknown): err is AssertionError;
16
+ name: string;
17
+ /**
18
+ * Translates a {@link z.ZodError} into an {@link AssertionError} with a
19
+ * human-friendly message.
20
+ *
21
+ * @remarks
22
+ * This does not handle parameterized assertions with more than one parameter
23
+ * too cleanly; it's unclear how a test runner would display the expected
24
+ * values. This will probably need a fix in the future.
25
+ * @param stackStartFn The function to start the stack trace from
26
+ * @param zodError The original `ZodError`
27
+ * @param values Values which caused the error
28
+ * @returns New `AssertionError`
29
+ */
30
+ static fromZodError<Parts extends AssertionParts>(zodError: z.ZodError, stackStartFn: (...args: any[]) => any, values: ParsedValues<Parts>): AssertionError;
31
+ /**
32
+ * Type guard for an instance of this error.
33
+ *
34
+ * @param value Some value
35
+ * @returns `true` if `value` is an instance of `AssertionError`
36
+ */
37
+ static isAssertionError(value: unknown): value is AssertionError;
38
+ }
39
+ /**
40
+ * Variant of an {@link AssertionError} that is thrown when
41
+ * {@link bupkis!expect.fail} is called.
42
+ */
43
+ export declare class FailAssertionError extends AssertionError {
44
+ name: string;
45
+ static isFailAssertionError(err: unknown): err is FailAssertionError;
19
46
  }
20
47
  //# sourceMappingURL=error.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EACL,qBAAqB,EAEtB,MAAM,eAAe,CAAC;AAGvB;;;;;GAKG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;IACpD,CAAC,qBAAqB,CAAC,UAAQ;IAE/B,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,cAAc;CAK7D"}
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAC;AAQ3B,OAAO,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAEpE;;;GAGG;AACH,qBAAa,cAAe,SAAQ,kBAAkB;IAM3C,IAAI,SAAoB;IAEjC;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,YAAY,CAAC,KAAK,SAAS,cAAc,EAC9C,QAAQ,EAAE,CAAC,CAAC,QAAQ,EACpB,YAAY,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,EACrC,MAAM,EAAE,YAAY,CAAC,KAAK,CAAC,GAC1B,cAAc;IAmBjB;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,cAAc;CAMjE;AAED;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,cAAc;IAM3C,IAAI,SAAwB;IAErC,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,kBAAkB;CAMrE"}
package/dist/esm/error.js CHANGED
@@ -6,18 +6,71 @@
6
6
  * @packageDocumentation
7
7
  */
8
8
  import { AssertionError as NodeAssertionError } from 'node:assert';
9
- import { kBupkisAssertionError, kBupkisNegatedAssertionError, } from './constant.js';
9
+ import { z } from 'zod/v4';
10
+ import { kBupkisAssertionError, kBupkisFailAssertionError, kBupkisNegatedAssertionError, } from './constant.js';
10
11
  import { isA } from './guards.js';
11
12
  /**
12
13
  * _BUPKIS_' s custom `AssertionError` class, which is just a thin wrapper
13
14
  * around Node.js' {@link NodeAssertionError AssertionError}.
14
- *
15
- * @public
16
15
  */
17
16
  export class AssertionError extends NodeAssertionError {
17
+ /**
18
+ * @internal
19
+ */
18
20
  [kBupkisAssertionError] = true;
19
- static isAssertionError(err) {
20
- return (isA(err, NodeAssertionError) && Object.hasOwn(err, kBupkisAssertionError));
21
+ name = 'AssertionError';
22
+ /**
23
+ * Translates a {@link z.ZodError} into an {@link AssertionError} with a
24
+ * human-friendly message.
25
+ *
26
+ * @remarks
27
+ * This does not handle parameterized assertions with more than one parameter
28
+ * too cleanly; it's unclear how a test runner would display the expected
29
+ * values. This will probably need a fix in the future.
30
+ * @param stackStartFn The function to start the stack trace from
31
+ * @param zodError The original `ZodError`
32
+ * @param values Values which caused the error
33
+ * @returns New `AssertionError`
34
+ */
35
+ static fromZodError(zodError, stackStartFn, values) {
36
+ const flat = z.flattenError(zodError);
37
+ let pretty = flat.formErrors.join('; ');
38
+ for (const [keypath, errors] of Object.entries(flat.fieldErrors)) {
39
+ pretty += `; ${keypath}: ${errors.join('; ')}`;
40
+ }
41
+ const [actual, ...expected] = values;
42
+ return new AssertionError({
43
+ actual,
44
+ expected: expected.length === 1 ? expected[0] : expected,
45
+ message: `Assertion ${this} failed: ${pretty}`,
46
+ operator: `${this}`,
47
+ stackStartFn,
48
+ });
49
+ }
50
+ /**
51
+ * Type guard for an instance of this error.
52
+ *
53
+ * @param value Some value
54
+ * @returns `true` if `value` is an instance of `AssertionError`
55
+ */
56
+ static isAssertionError(value) {
57
+ return (isA(value, NodeAssertionError) &&
58
+ Object.hasOwn(value, kBupkisAssertionError));
59
+ }
60
+ }
61
+ /**
62
+ * Variant of an {@link AssertionError} that is thrown when
63
+ * {@link bupkis!expect.fail} is called.
64
+ */
65
+ export class FailAssertionError extends AssertionError {
66
+ /**
67
+ * @internal
68
+ */
69
+ [kBupkisFailAssertionError] = true;
70
+ name = 'FailAssertionError';
71
+ static isFailAssertionError(err) {
72
+ return (isA(err, FailAssertionError) &&
73
+ Object.hasOwn(err, kBupkisFailAssertionError));
21
74
  }
22
75
  }
23
76
  /**
@@ -27,6 +80,7 @@ export class AssertionError extends NodeAssertionError {
27
80
  */
28
81
  export class NegatedAssertionError extends AssertionError {
29
82
  [kBupkisNegatedAssertionError] = true;
83
+ name = 'NegatedAssertionError';
30
84
  static isNegatedAssertionError(err) {
31
85
  return (isA(err, AssertionError) &&
32
86
  Object.hasOwn(err, kBupkisNegatedAssertionError));
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,cAAc,IAAI,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEnE,OAAO,EACL,qBAAqB,EACrB,4BAA4B,GAC7B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;;;;GAKG;AACH,MAAM,OAAO,cAAe,SAAQ,kBAAkB;IACpD,CAAC,qBAAqB,CAAC,GAAG,IAAI,CAAC;IAE/B,MAAM,CAAC,gBAAgB,CAAC,GAAY;QAClC,OAAO,CACL,GAAG,CAAC,GAAG,EAAE,kBAAkB,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAC1E,CAAC;IACJ,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IACvD,CAAC,4BAA4B,CAAC,GAAG,IAAI,CAAC;IAEtC,MAAM,CAAC,uBAAuB,CAAC,GAAY;QACzC,OAAO,CACL,GAAG,CAAC,GAAG,EAAE,cAAc,CAAC;YACxB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,4BAA4B,CAAC,CACjD,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,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b,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAc;QACpC,OAAO,CACL,GAAG,CAAC,KAAK,EAAE,kBAAkB,CAAC;YAC9B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,qBAAqB,CAAC,CAC5C,CAAC;IACJ,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,OAAO,kBAAmB,SAAQ,cAAc;IACpD;;OAEG;IACH,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC;IAE1B,IAAI,GAAG,oBAAoB,CAAC;IAErC,MAAM,CAAC,oBAAoB,CAAC,GAAY;QACtC,OAAO,CACL,GAAG,CAAC,GAAG,EAAE,kBAAkB,CAAC;YAC5B,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,yBAAyB,CAAC,CAC9C,CAAC;IACJ,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,qBAAsB,SAAQ,cAAc;IACvD,CAAC,4BAA4B,CAAC,GAAG,IAAI,CAAC;IAE7B,IAAI,GAAG,uBAAuB,CAAC;IAExC,MAAM,CAAC,uBAAuB,CAAC,GAAY;QACzC,OAAO,CACL,GAAG,CAAC,GAAG,EAAE,cAAc,CAAC;YACxB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,4BAA4B,CAAC,CACjD,CAAC;IACJ,CAAC;CACF"}
@@ -1,9 +1,136 @@
1
- import { type Expect, type ExpectAsync, type ExpectAsyncFunction, type ExpectAsyncProps, type ExpectFunction, type ExpectSyncProps } from './api.js';
2
1
  import { type AnyAsyncAssertions, type AnySyncAssertions } from './assertion/assertion-types.js';
2
+ import { type Expect, type ExpectAsync, type ExpectAsyncFunction, type ExpectAsyncProps, type ExpectFunction, type ExpectSyncProps } from './types.js';
3
+ /**
4
+ * Creates an asynchronous expect function by extending a parent expectAsync
5
+ * function with additional assertions.
6
+ *
7
+ * This overload combines assertions from an existing parent expectAsync
8
+ * function with new assertions, creating a unified expectAsync function that
9
+ * supports both sets of assertions. The resulting function inherits all type
10
+ * information from both the parent and new assertions, providing complete
11
+ * TypeScript intellisense and type safety for Promise-based testing scenarios.
12
+ *
13
+ * @example
14
+ *
15
+ * ```typescript
16
+ * const baseExpectAsync = createExpectAsyncFunction(basicAsyncAssertions);
17
+ * const extendedExpectAsync = createExpectAsyncFunction(
18
+ * customAsyncAssertions,
19
+ * baseExpectAsync,
20
+ * );
21
+ *
22
+ * // Can use both basic and custom async assertions
23
+ * await extendedExpectAsync(promise, 'to resolve'); // From basic assertions
24
+ * await extendedExpectAsync(promise, 'to resolve with custom data'); // From custom assertions
25
+ * ```
26
+ *
27
+ * @param assertions - Array of new asynchronous assertion objects to add
28
+ * @param expect - Parent expectAsync function whose assertions will be
29
+ * inherited
30
+ * @returns ExpectAsync function with combined assertion types from both parent
31
+ * and new assertions
32
+ * @throws {@link AssertionError} When an assertion fails in normal
33
+ * (non-negated) mode
34
+ * @throws {@link NegatedAssertionError} When a negated assertion fails
35
+ * @throws {Error} When no matching assertion can be found for the provided
36
+ * arguments
37
+ */
3
38
  export declare function createExpectAsyncFunction<T extends AnyAsyncAssertions, U extends ExpectAsync<AnyAsyncAssertions>>(assertions: T, expect: U): ExpectAsyncFunction<T & U['assertions']>;
39
+ /**
40
+ * Creates a new asynchronous expect function with the provided assertions.
41
+ *
42
+ * This overload creates a standalone expectAsync function from the provided
43
+ * assertions without inheriting from any parent function. This is typically
44
+ * used to create the initial expectAsync function or when you want a clean
45
+ * slate without any inherited assertions for Promise-based testing.
46
+ *
47
+ * @example
48
+ *
49
+ * ```typescript
50
+ * const expectAsync = createExpectAsyncFunction(asyncAssertions);
51
+ * await expectAsync(promise, 'to resolve');
52
+ * await expectAsync(rejectedPromise, 'to reject');
53
+ * await expectAsync(promise, 'to resolve to', expectedValue);
54
+ * ```
55
+ *
56
+ * @param assertions - Array of asynchronous assertion objects that define the
57
+ * available assertion phrases and Promise-based logic
58
+ * @returns An asynchronous expect function that can execute the provided
59
+ * assertions using natural language syntax
60
+ * @throws {@link AssertionError} When an assertion fails in normal
61
+ * (non-negated) mode
62
+ * @throws {@link NegatedAssertionError} When a negated assertion fails
63
+ * @throws {Error} When no matching assertion can be found for the provided
64
+ * arguments
65
+ */
4
66
  export declare function createExpectAsyncFunction<T extends AnyAsyncAssertions>(assertions: T): ExpectAsyncFunction<T>;
5
- export declare function createExpectSyncFunction<T extends AnySyncAssertions, U extends Expect<AnySyncAssertions>>(assertions: T, expect: U): ExpectFunction<T & U['assertions']>;
6
- export declare function createExpectSyncFunction<T extends AnySyncAssertions>(assertions: T): ExpectFunction<T>;
67
+ /**
68
+ * Creates a synchronous expect function by extending a parent expect function
69
+ * with additional assertions.
70
+ *
71
+ * This overload combines assertions from an existing parent expect function
72
+ * with new assertions, creating a unified expect function that supports both
73
+ * sets of assertions. The resulting function inherits all type information from
74
+ * both the parent and new assertions, providing complete TypeScript
75
+ * intellisense and type safety.
76
+ *
77
+ * @example
78
+ *
79
+ * ```typescript
80
+ * const baseExpect = createExpectSyncFunction(basicAssertions);
81
+ * const extendedExpect = createExpectSyncFunction(
82
+ * customAssertions,
83
+ * baseExpect,
84
+ * );
85
+ *
86
+ * // Can use both basic and custom assertions
87
+ * extendedExpect(42, 'to be a number'); // From basic assertions
88
+ * extendedExpect(obj, 'to have custom prop'); // From custom assertions
89
+ * ```
90
+ *
91
+ * @param assertions - Array of new synchronous assertion objects to add
92
+ * @param expect - Parent expect function whose assertions will be inherited
93
+ * @returns Expect function with combined assertion types from both parent and
94
+ * new assertions
95
+ * @throws {@link AssertionError} When an assertion fails in normal
96
+ * (non-negated) mode
97
+ * @throws {@link NegatedAssertionError} When a negated assertion fails
98
+ * @throws {Error} When no matching assertion can be found for the provided
99
+ * arguments
100
+ */
101
+ export declare function createExpectSyncFunction<Assertions extends AnySyncAssertions, ParentExpect extends Expect<AnySyncAssertions>>(assertions: Assertions, expect: ParentExpect): ExpectFunction<Assertions & ParentExpect['assertions']>;
102
+ /**
103
+ * Creates a new synchronous expect function with the provided assertions.
104
+ *
105
+ * This overload creates a standalone expect function from the provided
106
+ * assertions without inheriting from any parent function. This is typically
107
+ * used to create the initial expect function or when you want a clean slate
108
+ * without any inherited assertions.
109
+ *
110
+ * @example
111
+ *
112
+ * ```typescript
113
+ * const expect = createExpectSyncFunction(basicAssertions);
114
+ * expect(42, 'to be a number');
115
+ * expect('hello', 'to be a string');
116
+ * expect([], 'to be empty');
117
+ * ```
118
+ *
119
+ * @param assertions - Array of synchronous assertion objects that define the
120
+ * available assertion phrases and logic
121
+ * @returns A synchronous expect function that can execute the provided
122
+ * assertions using natural language syntax
123
+ * @throws {@link AssertionError} When an assertion fails in normal
124
+ * (non-negated) mode
125
+ * @throws {@link NegatedAssertionError} When a negated assertion fails
126
+ * @throws {Error} When no matching assertion can be found for the provided
127
+ * arguments
128
+ */
129
+ export declare function createExpectSyncFunction<Assertions extends AnySyncAssertions>(assertions: Assertions): ExpectFunction<Assertions>;
130
+ /**
131
+ * Used by a {@link UseFn} to create base properties of the {@link Expect} and
132
+ * {@link ExpectAsync} functions.
133
+ */
7
134
  export declare function createBaseExpect<T extends AnySyncAssertions, U extends AnyAsyncAssertions>(syncAssertions: T, asyncAssertions: U, type: 'sync'): ExpectSyncProps<T, U>;
8
135
  export declare function createBaseExpect<T extends AnySyncAssertions, U extends AnyAsyncAssertions>(syncAssertions: T, asyncAssertions: U, type: 'async'): ExpectAsyncProps<U, T>;
9
136
  //# sourceMappingURL=expect.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"expect.d.ts","sourceRoot":"","sources":["../../src/expect.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,MAAM,EACX,KAAK,WAAW,EAChB,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,eAAe,EACrB,MAAM,UAAU,CAAC;AAClB,OAAO,EAEL,KAAK,kBAAkB,EAEvB,KAAK,iBAAiB,EASvB,MAAM,gCAAgC,CAAC;AAQxC,wBAA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kBAAkB,EAC5B,cAAc,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -1,10 +1,72 @@
1
1
  import Debug from 'debug';
2
2
  import { inspect } from 'util';
3
3
  import { createAssertion, createAsyncAssertion } from './assertion/create.js';
4
- import { AssertionError, NegatedAssertionError } from './error.js';
4
+ import { AssertionError, FailAssertionError, NegatedAssertionError, } from './error.js';
5
5
  import { isAssertionFailure, isString } from './guards.js';
6
6
  import { createUse } from './use.js';
7
7
  const debug = Debug('bupkis:expect');
8
+ /**
9
+ * Implementation function that creates an asynchronous expect function with
10
+ * optional parent inheritance.
11
+ *
12
+ * This is the concrete implementation that handles both overload cases for
13
+ * Promise-based assertions. It creates an expectAsync function that uses a
14
+ * two-phase matching algorithm: first seeking exact phrase matches for optimal
15
+ * performance, then falling back to partial matches if needed. The function
16
+ * processes negation keywords, combines parent assertions with new ones, and
17
+ * ensures all operations are properly awaited.
18
+ *
19
+ * The matching algorithm prioritizes exact matches to minimize performance
20
+ * overhead, but provides flexibility through partial matching when exact
21
+ * phrases don't align. This enables natural language flexibility while
22
+ * maintaining execution speed for common async assertion patterns.
23
+ *
24
+ * @remarks
25
+ * The function performs async assertion matching in the following order:
26
+ *
27
+ * 1. Awaits `Promise.resolve()` to ensure the function is always asynchronous
28
+ * 2. Processes negation keywords ('not', 'to not') to determine assertion mode
29
+ * 3. Combines parent assertions (if provided) with new assertions in execution
30
+ * order
31
+ * 4. Attempts to parse arguments against each assertion's expected phrase pattern
32
+ * using `parseValuesAsync`
33
+ * 5. Prioritizes exact phrase matches over partial matches for performance
34
+ * 6. Executes the first successful match using {@link executeAsync} or throws an
35
+ * error if none found
36
+ *
37
+ * Performance considerations: The function loops through all available
38
+ * assertions for each call, but uses early termination when exact matches are
39
+ * found. For performance-critical code, consider using assertion functions with
40
+ * fewer total assertions or more specific phrase patterns to reduce matching
41
+ * overhead.
42
+ *
43
+ * All assertion execution is properly awaited to handle Promise-based
44
+ * validation logic, error handling, and negation scenarios in asynchronous
45
+ * contexts.
46
+ * @example
47
+ *
48
+ * ```typescript
49
+ * // Used internally by both public overloads
50
+ * const expectAsync1 = createExpectAsyncFunction(assertions); // No parent
51
+ * const expectAsync2 = createExpectAsyncFunction(assertions, parent); // With parent
52
+ * ```
53
+ *
54
+ * @param assertions - Array of asynchronous assertion objects to make available
55
+ * @param expect - Optional parent expectAsync function to inherit assertions
56
+ * from
57
+ * @returns Asynchronous expect function that processes natural language
58
+ * assertions with Promise support
59
+ * @throws {@link AssertionError} When an assertion fails in normal
60
+ * (non-negated) mode
61
+ * @throws {@link NegatedAssertionError} When a negated assertion fails (e.g.,
62
+ * `await expectAsync(promise, 'not to resolve')`)
63
+ * @throws {Error} When no matching assertion can be found for the provided
64
+ * arguments
65
+ * @internal This is the concrete implementation used by the public overloads
66
+ * @see {@link createExpectSyncFunction} for creating synchronous expect functions
67
+ * @see {@link createAsyncAssertion} for creating individual async assertion objects
68
+ * @see {@link ExpectAsync} for the main expectAsync interface
69
+ */
8
70
  export function createExpectAsyncFunction(assertions, expect) {
9
71
  debug('Creating expectAsync function with %d assertions', assertions.length + (expect?.assertions.length ?? 0));
10
72
  const expectAsyncFunction = async (...args) => {
@@ -31,6 +93,59 @@ export function createExpectAsyncFunction(assertions, expect) {
31
93
  };
32
94
  return expectAsyncFunction;
33
95
  }
96
+ /**
97
+ * Implementation function that creates a synchronous expect function with
98
+ * optional parent inheritance.
99
+ *
100
+ * This is the concrete implementation that handles both overload cases. It
101
+ * creates an expect function that uses a two-phase matching algorithm: first
102
+ * seeking exact phrase matches for optimal performance, then falling back to
103
+ * partial matches if needed. The function processes negation keywords and
104
+ * combines parent assertions with new ones.
105
+ *
106
+ * The matching algorithm prioritizes exact matches to minimize performance
107
+ * overhead, but provides flexibility through partial matching when exact
108
+ * phrases don't align. This enables natural language flexibility while
109
+ * maintaining execution speed for common assertion patterns.
110
+ *
111
+ * @remarks
112
+ * The function performs assertion matching in the following order:
113
+ *
114
+ * 1. Processes negation keywords ('not', 'to not') to determine assertion mode
115
+ * 2. Combines parent assertions (if provided) with new assertions in execution
116
+ * order
117
+ * 3. Attempts to parse arguments against each assertion's expected phrase pattern
118
+ * 4. Prioritizes exact phrase matches over partial matches for performance
119
+ * 5. Executes the first successful match or throws an error if none found
120
+ *
121
+ * Performance considerations: The function loops through all available
122
+ * assertions for each call, but uses early termination when exact matches are
123
+ * found. For performance-critical code, consider using assertion functions with
124
+ * fewer total assertions or more specific phrase patterns to reduce matching
125
+ * overhead.
126
+ * @example
127
+ *
128
+ * ```typescript
129
+ * // Used internally by both public overloads
130
+ * const expect1 = createExpectSyncFunction(assertions); // No parent
131
+ * const expect2 = createExpectSyncFunction(assertions, parent); // With parent
132
+ * ```
133
+ *
134
+ * @param assertions - Array of synchronous assertion objects to make available
135
+ * @param expect - Optional parent expect function to inherit assertions from
136
+ * @returns Synchronous expect function that processes natural language
137
+ * assertions
138
+ * @throws {@link AssertionError} When an assertion fails in normal
139
+ * (non-negated) mode
140
+ * @throws {@link NegatedAssertionError} When a negated assertion fails (e.g.,
141
+ * `expect(42, 'not to be a number')`)
142
+ * @throws {Error} When no matching assertion can be found for the provided
143
+ * arguments
144
+ * @internal This is the concrete implementation used by the public overloads
145
+ * @see {@link createExpectAsyncFunction} for creating asynchronous expect functions
146
+ * @see {@link createAssertion} for creating individual assertion objects
147
+ * @see {@link Expect} for the main expect interface
148
+ */
34
149
  export function createExpectSyncFunction(assertions, expect) {
35
150
  debug('Creating expect function with %d assertions', assertions.length + (expect?.assertions.length ?? 0));
36
151
  const expectFunction = (...args) => {
@@ -188,7 +303,7 @@ const detectNegation = (phrase) => {
188
303
  };
189
304
  };
190
305
  const fail = (reason) => {
191
- throw new AssertionError({ message: reason });
306
+ throw new FailAssertionError({ message: reason });
192
307
  };
193
308
  export function createBaseExpect(syncAssertions, asyncAssertions, type) {
194
309
  return type === 'sync'
@@ -1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