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"}
@@ -2,33 +2,42 @@
2
2
  /**
3
3
  * Factory function for creating the main assertion functions.
4
4
  *
5
- * This module provides the `bootstrap()` function that creates both synchronous
6
- * and asynchronous assertion engines. It contains the core implementation
7
- * previously split between `expect.ts` and `expect-async.ts`.
5
+ * This module provides the {@link bootstrap} function that creates both
6
+ * synchronous and asynchronous assertion engines.
8
7
  *
9
8
  * @packageDocumentation
10
9
  */
11
10
  Object.defineProperty(exports, "__esModule", { value: true });
12
11
  exports.expectAsync = exports.expect = void 0;
13
- const sync_js_1 = require("./assertion/impl/sync.js");
14
12
  const index_js_1 = require("./assertion/index.js");
15
13
  const use_js_1 = require("./use.js");
16
14
  /**
17
15
  * Factory function that creates both synchronous and asynchronous assertion
18
16
  * engines.
19
17
  *
20
- * @returns Object containing `expect` and `expectAsync` functions
18
+ * @returns Object containing {@link expect} and {@link expectAsync} functions
21
19
  * @internal
22
20
  */
23
21
  const bootstrap = () => {
24
- const { expect, expectAsync } = (0, use_js_1.createUse)(sync_js_1.SyncAssertions, index_js_1.AsyncAssertions)([...sync_js_1.SyncAssertions, ...index_js_1.AsyncAssertions]);
22
+ const { expect, expectAsync } = (0, use_js_1.createUse)(index_js_1.SyncAssertions, index_js_1.AsyncAssertions)([...index_js_1.SyncAssertions, ...index_js_1.AsyncAssertions]);
25
23
  return { expect, expectAsync };
26
24
  };
27
25
  const api = bootstrap();
28
- /** {@inheritDoc Expect} */
29
- const { expect } = api;
26
+ const {
27
+ /**
28
+ * The main synchronous assertion function which can execute only built-in
29
+ * assertions.
30
+ *
31
+ * @function
32
+ */
33
+ expect,
34
+ /**
35
+ * The main asynchronous assertion function which can execute only built-in
36
+ * assertions.
37
+ *
38
+ * @function
39
+ */
40
+ expectAsync, } = api;
30
41
  exports.expect = expect;
31
- /** {@inheritDoc ExpectAsync} */
32
- const { expectAsync } = api;
33
42
  exports.expectAsync = expectAsync;
34
43
  //# sourceMappingURL=bootstrap.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/bootstrap.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAGH,sDAA0D;AAC1D,mDAAuD;AACvD,qCAAqC;AAErC;;;;;;GAMG;AACH,MAAM,SAAS,GAAG,GAGhB,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAS,EACvC,wBAAc,EACd,0BAAe,CAChB,CAAC,CAAC,GAAG,wBAAc,EAAE,GAAG,0BAAe,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;AAId,wBAAM;AAHf,gCAAgC;AAChC,MAAM,EAAE,WAAW,EAAE,GAAG,GAAG,CAAC;AAEX,kCAAW"}
1
+ {"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../src/bootstrap.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAEH,mDAAuE;AAEvE,qCAAqC;AAErC;;;;;;GAMG;AACH,MAAM,SAAS,GAAG,GAGhB,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,GAAG,IAAA,kBAAS,EACvC,yBAAc,EACd,0BAAe,CAChB,CAAC,CAAC,GAAG,yBAAc,EAAE,GAAG,0BAAe,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;AAEC,wBAAM;AAAE,kCAAW"}
@@ -10,7 +10,7 @@
10
10
  * @internal
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.kBupkisNegatedAssertionError = exports.kBupkisAssertionError = exports.kStringLiteral = void 0;
13
+ exports.kBupkisNegatedAssertionError = exports.kBupkisFailAssertionError = exports.kBupkisAssertionError = exports.kStringLiteral = void 0;
14
14
  /**
15
15
  * Symbol flagging the value as a Bupkis-created string literal, which will be
16
16
  * omitted from the parameters to an `AssertionImpl`.
@@ -24,6 +24,12 @@ exports.kStringLiteral = Symbol('bupkis:string-literal');
24
24
  * @internal
25
25
  */
26
26
  exports.kBupkisAssertionError = Symbol('bupkis-error');
27
+ /**
28
+ * Symbol used to flag a `FailAssertionError`
29
+ *
30
+ * @internal
31
+ */
32
+ exports.kBupkisFailAssertionError = Symbol('bupkis-fail-error');
27
33
  /**
28
34
  * Symbol used to flag a `NegatedAssertionError`
29
35
  *
@@ -1 +1 @@
1
- {"version":3,"file":"constant.js","sourceRoot":"","sources":["../../src/constant.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH;;;;;GAKG;AAEU,QAAA,cAAc,GAAkB,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAE7E;;;;GAIG;AAEU,QAAA,qBAAqB,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAE3E;;;;GAIG;AAEU,QAAA,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;AAEU,QAAA,cAAc,GAAkB,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAE7E;;;;GAIG;AAEU,QAAA,qBAAqB,GAAkB,MAAM,CAAC,cAAc,CAAC,CAAC;AAE3E;;;;GAIG;AACU,QAAA,yBAAyB,GACpC,MAAM,CAAC,mBAAmB,CAAC,CAAC;AAE9B;;;;GAIG;AAEU,QAAA,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"}
@@ -7,23 +7,77 @@
7
7
  * @packageDocumentation
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.NegatedAssertionError = exports.AssertionError = void 0;
10
+ exports.NegatedAssertionError = exports.FailAssertionError = exports.AssertionError = void 0;
11
11
  const node_assert_1 = require("node:assert");
12
+ const v4_1 = require("zod/v4");
12
13
  const constant_js_1 = require("./constant.js");
13
14
  const guards_js_1 = require("./guards.js");
14
15
  /**
15
16
  * _BUPKIS_' s custom `AssertionError` class, which is just a thin wrapper
16
17
  * around Node.js' {@link NodeAssertionError AssertionError}.
17
- *
18
- * @public
19
18
  */
20
19
  class AssertionError extends node_assert_1.AssertionError {
20
+ /**
21
+ * @internal
22
+ */
21
23
  [constant_js_1.kBupkisAssertionError] = true;
22
- static isAssertionError(err) {
23
- return ((0, guards_js_1.isA)(err, node_assert_1.AssertionError) && Object.hasOwn(err, constant_js_1.kBupkisAssertionError));
24
+ name = 'AssertionError';
25
+ /**
26
+ * Translates a {@link z.ZodError} into an {@link AssertionError} with a
27
+ * human-friendly message.
28
+ *
29
+ * @remarks
30
+ * This does not handle parameterized assertions with more than one parameter
31
+ * too cleanly; it's unclear how a test runner would display the expected
32
+ * values. This will probably need a fix in the future.
33
+ * @param stackStartFn The function to start the stack trace from
34
+ * @param zodError The original `ZodError`
35
+ * @param values Values which caused the error
36
+ * @returns New `AssertionError`
37
+ */
38
+ static fromZodError(zodError, stackStartFn, values) {
39
+ const flat = v4_1.z.flattenError(zodError);
40
+ let pretty = flat.formErrors.join('; ');
41
+ for (const [keypath, errors] of Object.entries(flat.fieldErrors)) {
42
+ pretty += `; ${keypath}: ${errors.join('; ')}`;
43
+ }
44
+ const [actual, ...expected] = values;
45
+ return new AssertionError({
46
+ actual,
47
+ expected: expected.length === 1 ? expected[0] : expected,
48
+ message: `Assertion ${this} failed: ${pretty}`,
49
+ operator: `${this}`,
50
+ stackStartFn,
51
+ });
52
+ }
53
+ /**
54
+ * Type guard for an instance of this error.
55
+ *
56
+ * @param value Some value
57
+ * @returns `true` if `value` is an instance of `AssertionError`
58
+ */
59
+ static isAssertionError(value) {
60
+ return ((0, guards_js_1.isA)(value, node_assert_1.AssertionError) &&
61
+ Object.hasOwn(value, constant_js_1.kBupkisAssertionError));
24
62
  }
25
63
  }
26
64
  exports.AssertionError = AssertionError;
65
+ /**
66
+ * Variant of an {@link AssertionError} that is thrown when
67
+ * {@link bupkis!expect.fail} is called.
68
+ */
69
+ class FailAssertionError extends AssertionError {
70
+ /**
71
+ * @internal
72
+ */
73
+ [constant_js_1.kBupkisFailAssertionError] = true;
74
+ name = 'FailAssertionError';
75
+ static isFailAssertionError(err) {
76
+ return ((0, guards_js_1.isA)(err, FailAssertionError) &&
77
+ Object.hasOwn(err, constant_js_1.kBupkisFailAssertionError));
78
+ }
79
+ }
80
+ exports.FailAssertionError = FailAssertionError;
27
81
  /**
28
82
  * Error type used internally to catch failed negated assertions.
29
83
  *
@@ -31,6 +85,7 @@ exports.AssertionError = AssertionError;
31
85
  */
32
86
  class NegatedAssertionError extends AssertionError {
33
87
  [constant_js_1.kBupkisNegatedAssertionError] = true;
88
+ name = 'NegatedAssertionError';
34
89
  static isNegatedAssertionError(err) {
35
90
  return ((0, guards_js_1.isA)(err, AssertionError) &&
36
91
  Object.hasOwn(err, constant_js_1.kBupkisNegatedAssertionError));
@@ -1 +1 @@
1
- {"version":3,"file":"error.js","sourceRoot":"","sources":["../../src/error.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,6CAAmE;AAEnE,+CAGuB;AACvB,2CAAkC;AAElC;;;;;GAKG;AACH,MAAa,cAAe,SAAQ,4BAAkB;IACpD,CAAC,mCAAqB,CAAC,GAAG,IAAI,CAAC;IAE/B,MAAM,CAAC,gBAAgB,CAAC,GAAY;QAClC,OAAO,CACL,IAAA,eAAG,EAAC,GAAG,EAAE,4BAAkB,CAAC,IAAI,MAAM,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,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ;YACxD,OAAO,EAAE,aAAa,IAAI,YAAY,MAAM,EAAE;YAC9C,QAAQ,EAAE,GAAG,IAAI,EAAE;YACnB,YAAY;SACb,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,KAAc;QACpC,OAAO,CACL,IAAA,eAAG,EAAC,KAAK,EAAE,4BAAkB,CAAC;YAC9B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,mCAAqB,CAAC,CAC5C,CAAC;IACJ,CAAC;CACF;AAxDD,wCAwDC;AAED;;;GAGG;AACH,MAAa,kBAAmB,SAAQ,cAAc;IACpD;;OAEG;IACH,CAAC,uCAAyB,CAAC,GAAG,IAAI,CAAC;IAE1B,IAAI,GAAG,oBAAoB,CAAC;IAErC,MAAM,CAAC,oBAAoB,CAAC,GAAY;QACtC,OAAO,CACL,IAAA,eAAG,EAAC,GAAG,EAAE,kBAAkB,CAAC;YAC5B,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,uCAAyB,CAAC,CAC9C,CAAC;IACJ,CAAC;CACF;AAdD,gDAcC;AAED;;;;GAIG;AACH,MAAa,qBAAsB,SAAQ,cAAc;IACvD,CAAC,0CAA4B,CAAC,GAAG,IAAI,CAAC;IAE7B,IAAI,GAAG,uBAAuB,CAAC;IAExC,MAAM,CAAC,uBAAuB,CAAC,GAAY;QACzC,OAAO,CACL,IAAA,eAAG,EAAC,GAAG,EAAE,cAAc,CAAC;YACxB,MAAM,CAAC,MAAM,CAAC,GAAG,EAAE,0CAA4B,CAAC,CACjD,CAAC;IACJ,CAAC;CACF;AAXD,sDAWC"}
@@ -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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B,CAC9B,CAAC,SAAS,iBAAiB,EAC3B,CAAC,SAAS,kBAAkB,EAC5B,cAAc,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAC9E,wBAAgB,gBAAgB,CAC9B,CAAC,SAAS,iBAAiB,EAC3B,CAAC,SAAS,kBAAkB,EAC5B,cAAc,EAAE,CAAC,EAAE,eAAe,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,GAAG,gBAAgB,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC"}
@@ -13,6 +13,68 @@ const error_js_1 = require("./error.js");
13
13
  const guards_js_1 = require("./guards.js");
14
14
  const use_js_1 = require("./use.js");
15
15
  const debug = (0, debug_1.default)('bupkis:expect');
16
+ /**
17
+ * Implementation function that creates an asynchronous expect function with
18
+ * optional parent inheritance.
19
+ *
20
+ * This is the concrete implementation that handles both overload cases for
21
+ * Promise-based assertions. It creates an expectAsync function that uses a
22
+ * two-phase matching algorithm: first seeking exact phrase matches for optimal
23
+ * performance, then falling back to partial matches if needed. The function
24
+ * processes negation keywords, combines parent assertions with new ones, and
25
+ * ensures all operations are properly awaited.
26
+ *
27
+ * The matching algorithm prioritizes exact matches to minimize performance
28
+ * overhead, but provides flexibility through partial matching when exact
29
+ * phrases don't align. This enables natural language flexibility while
30
+ * maintaining execution speed for common async assertion patterns.
31
+ *
32
+ * @remarks
33
+ * The function performs async assertion matching in the following order:
34
+ *
35
+ * 1. Awaits `Promise.resolve()` to ensure the function is always asynchronous
36
+ * 2. Processes negation keywords ('not', 'to not') to determine assertion mode
37
+ * 3. Combines parent assertions (if provided) with new assertions in execution
38
+ * order
39
+ * 4. Attempts to parse arguments against each assertion's expected phrase pattern
40
+ * using `parseValuesAsync`
41
+ * 5. Prioritizes exact phrase matches over partial matches for performance
42
+ * 6. Executes the first successful match using {@link executeAsync} or throws an
43
+ * error if none found
44
+ *
45
+ * Performance considerations: The function loops through all available
46
+ * assertions for each call, but uses early termination when exact matches are
47
+ * found. For performance-critical code, consider using assertion functions with
48
+ * fewer total assertions or more specific phrase patterns to reduce matching
49
+ * overhead.
50
+ *
51
+ * All assertion execution is properly awaited to handle Promise-based
52
+ * validation logic, error handling, and negation scenarios in asynchronous
53
+ * contexts.
54
+ * @example
55
+ *
56
+ * ```typescript
57
+ * // Used internally by both public overloads
58
+ * const expectAsync1 = createExpectAsyncFunction(assertions); // No parent
59
+ * const expectAsync2 = createExpectAsyncFunction(assertions, parent); // With parent
60
+ * ```
61
+ *
62
+ * @param assertions - Array of asynchronous assertion objects to make available
63
+ * @param expect - Optional parent expectAsync function to inherit assertions
64
+ * from
65
+ * @returns Asynchronous expect function that processes natural language
66
+ * assertions with Promise support
67
+ * @throws {@link AssertionError} When an assertion fails in normal
68
+ * (non-negated) mode
69
+ * @throws {@link NegatedAssertionError} When a negated assertion fails (e.g.,
70
+ * `await expectAsync(promise, 'not to resolve')`)
71
+ * @throws {Error} When no matching assertion can be found for the provided
72
+ * arguments
73
+ * @internal This is the concrete implementation used by the public overloads
74
+ * @see {@link createExpectSyncFunction} for creating synchronous expect functions
75
+ * @see {@link createAsyncAssertion} for creating individual async assertion objects
76
+ * @see {@link ExpectAsync} for the main expectAsync interface
77
+ */
16
78
  function createExpectAsyncFunction(assertions, expect) {
17
79
  debug('Creating expectAsync function with %d assertions', assertions.length + (expect?.assertions.length ?? 0));
18
80
  const expectAsyncFunction = async (...args) => {
@@ -39,6 +101,59 @@ function createExpectAsyncFunction(assertions, expect) {
39
101
  };
40
102
  return expectAsyncFunction;
41
103
  }
104
+ /**
105
+ * Implementation function that creates a synchronous expect function with
106
+ * optional parent inheritance.
107
+ *
108
+ * This is the concrete implementation that handles both overload cases. It
109
+ * creates an expect function that uses a two-phase matching algorithm: first
110
+ * seeking exact phrase matches for optimal performance, then falling back to
111
+ * partial matches if needed. The function processes negation keywords and
112
+ * combines parent assertions with new ones.
113
+ *
114
+ * The matching algorithm prioritizes exact matches to minimize performance
115
+ * overhead, but provides flexibility through partial matching when exact
116
+ * phrases don't align. This enables natural language flexibility while
117
+ * maintaining execution speed for common assertion patterns.
118
+ *
119
+ * @remarks
120
+ * The function performs assertion matching in the following order:
121
+ *
122
+ * 1. Processes negation keywords ('not', 'to not') to determine assertion mode
123
+ * 2. Combines parent assertions (if provided) with new assertions in execution
124
+ * order
125
+ * 3. Attempts to parse arguments against each assertion's expected phrase pattern
126
+ * 4. Prioritizes exact phrase matches over partial matches for performance
127
+ * 5. Executes the first successful match or throws an error if none found
128
+ *
129
+ * Performance considerations: The function loops through all available
130
+ * assertions for each call, but uses early termination when exact matches are
131
+ * found. For performance-critical code, consider using assertion functions with
132
+ * fewer total assertions or more specific phrase patterns to reduce matching
133
+ * overhead.
134
+ * @example
135
+ *
136
+ * ```typescript
137
+ * // Used internally by both public overloads
138
+ * const expect1 = createExpectSyncFunction(assertions); // No parent
139
+ * const expect2 = createExpectSyncFunction(assertions, parent); // With parent
140
+ * ```
141
+ *
142
+ * @param assertions - Array of synchronous assertion objects to make available
143
+ * @param expect - Optional parent expect function to inherit assertions from
144
+ * @returns Synchronous expect function that processes natural language
145
+ * assertions
146
+ * @throws {@link AssertionError} When an assertion fails in normal
147
+ * (non-negated) mode
148
+ * @throws {@link NegatedAssertionError} When a negated assertion fails (e.g.,
149
+ * `expect(42, 'not to be a number')`)
150
+ * @throws {Error} When no matching assertion can be found for the provided
151
+ * arguments
152
+ * @internal This is the concrete implementation used by the public overloads
153
+ * @see {@link createExpectAsyncFunction} for creating asynchronous expect functions
154
+ * @see {@link createAssertion} for creating individual assertion objects
155
+ * @see {@link Expect} for the main expect interface
156
+ */
42
157
  function createExpectSyncFunction(assertions, expect) {
43
158
  debug('Creating expect function with %d assertions', assertions.length + (expect?.assertions.length ?? 0));
44
159
  const expectFunction = (...args) => {
@@ -196,7 +311,7 @@ const detectNegation = (phrase) => {
196
311
  };
197
312
  };
198
313
  const fail = (reason) => {
199
- throw new error_js_1.AssertionError({ message: reason });
314
+ throw new error_js_1.FailAssertionError({ message: reason });
200
315
  };
201
316
  function createBaseExpect(syncAssertions, asyncAssertions, type) {
202
317
  return type === 'sync'
@@ -1 +1 @@
1
- {"version":3,"file":"expect.js","sourceRoot":"","sources":["../../src/expect.ts"],"names":[],"mappings":";;;;;AAuCA,8DAgDC;AAUD,4DA+CC;AAwMD,4CAmBC;AA3WD,kDAA0B;AAC1B,+BAA+B;AAwB/B,qDAA8E;AAC9E,yCAAmE;AACnE,2CAA2D;AAC3D,qCAAqC;AAErC,MAAM,KAAK,GAAG,IAAA,eAAK,EAAC,eAAe,CAAC,CAAC;AASrC,SAAgB,yBAAyB,CAGvC,UAAa,EAAE,MAAU;IACzB,KAAK,CACH,kDAAkD,EAClD,UAAU,CAAC,MAAM,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,IAAI,CAAC,CAAC,CACrD,CAAC;IACF,MAAM,mBAAmB,GAAG,KAAK,EAAE,GAAG,IAAwB,EAAE,EAAE;QAChE,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;QACxB,MAAM,CAAC,SAAS,EAAE,aAAa,CAAC,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;QAC9D,MAAM,UAAU,GAGX,EAAE,CAAC;QACR,KAAK,MAAM,SAAS,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,IAAI,EAAE,CAAC,EAAE,GAAG,UAAU,CAAC,EAAE,CAAC;YACvE,MAAM,WAAW,GAAG,MAAM,SAAS,CAAC,gBAAgB,CAAC,aAAa,CAAC,CAAC;YACpE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,OAAO,EAAE,GAAG,WAAW,CAAC;YAE1D,IAAI,OAAO,EAAE,CAAC;gBACZ,IAAI,UAAU,EAAE,CAAC;oBACf,OAAO,YAAY,CACjB,SAAS,EACT,YAAY,EACZ,CAAC,GAAG,IAAI,CAAC,EACT,mBAAmB,EACnB,SAAS,EACT,WAAW,CAC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