bupkis 0.1.2 → 0.2.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 (130) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/README.md +8 -8
  3. package/dist/commonjs/assertion/assertion-types.d.ts +33 -82
  4. package/dist/commonjs/assertion/assertion-types.d.ts.map +1 -1
  5. package/dist/commonjs/assertion/create.d.ts +5 -33
  6. package/dist/commonjs/assertion/create.d.ts.map +1 -1
  7. package/dist/commonjs/assertion/create.js +17 -6
  8. package/dist/commonjs/assertion/create.js.map +1 -1
  9. package/dist/commonjs/assertion/impl/async.d.ts +5 -5
  10. package/dist/commonjs/assertion/impl/async.d.ts.map +1 -1
  11. package/dist/commonjs/assertion/impl/async.js +2 -2
  12. package/dist/commonjs/assertion/impl/async.js.map +1 -1
  13. package/dist/commonjs/assertion/impl/sync-parametric.d.ts +24 -24
  14. package/dist/commonjs/assertion/impl/sync-parametric.d.ts.map +1 -1
  15. package/dist/commonjs/assertion/impl/sync-parametric.js +3 -3
  16. package/dist/commonjs/assertion/impl/sync-parametric.js.map +1 -1
  17. package/dist/commonjs/assertion/impl/sync.d.ts +50 -50
  18. package/dist/commonjs/assertion/impl/sync.d.ts.map +1 -1
  19. package/dist/commonjs/bootstrap.d.ts +71 -61
  20. package/dist/commonjs/bootstrap.d.ts.map +1 -1
  21. package/dist/commonjs/bootstrap.js +20 -10
  22. package/dist/commonjs/bootstrap.js.map +1 -1
  23. package/dist/commonjs/error.d.ts +12 -5
  24. package/dist/commonjs/error.d.ts.map +1 -1
  25. package/dist/commonjs/error.js +19 -4
  26. package/dist/commonjs/error.js.map +1 -1
  27. package/dist/commonjs/expect.d.ts +130 -3
  28. package/dist/commonjs/expect.d.ts.map +1 -1
  29. package/dist/commonjs/expect.js +115 -0
  30. package/dist/commonjs/expect.js.map +1 -1
  31. package/dist/commonjs/guards.d.ts +22 -15
  32. package/dist/commonjs/guards.d.ts.map +1 -1
  33. package/dist/commonjs/guards.js +34 -20
  34. package/dist/commonjs/guards.js.map +1 -1
  35. package/dist/commonjs/index.d.ts +113 -62
  36. package/dist/commonjs/index.d.ts.map +1 -1
  37. package/dist/commonjs/index.js +44 -42
  38. package/dist/commonjs/index.js.map +1 -1
  39. package/dist/commonjs/metadata.d.ts +1 -27
  40. package/dist/commonjs/metadata.d.ts.map +1 -1
  41. package/dist/commonjs/metadata.js +16 -15
  42. package/dist/commonjs/metadata.js.map +1 -1
  43. package/dist/commonjs/schema.d.ts +59 -26
  44. package/dist/commonjs/schema.d.ts.map +1 -1
  45. package/dist/commonjs/schema.js +57 -24
  46. package/dist/commonjs/schema.js.map +1 -1
  47. package/dist/commonjs/types.d.ts +449 -39
  48. package/dist/commonjs/types.d.ts.map +1 -1
  49. package/dist/commonjs/types.js +12 -2
  50. package/dist/commonjs/types.js.map +1 -1
  51. package/dist/commonjs/util.d.ts +7 -0
  52. package/dist/commonjs/util.d.ts.map +1 -1
  53. package/dist/commonjs/util.js +7 -0
  54. package/dist/commonjs/util.js.map +1 -1
  55. package/dist/esm/assertion/assertion-types.d.ts +33 -82
  56. package/dist/esm/assertion/assertion-types.d.ts.map +1 -1
  57. package/dist/esm/assertion/create.d.ts +5 -33
  58. package/dist/esm/assertion/create.d.ts.map +1 -1
  59. package/dist/esm/assertion/create.js +14 -4
  60. package/dist/esm/assertion/create.js.map +1 -1
  61. package/dist/esm/assertion/impl/async.d.ts +5 -5
  62. package/dist/esm/assertion/impl/async.d.ts.map +1 -1
  63. package/dist/esm/assertion/impl/async.js +2 -2
  64. package/dist/esm/assertion/impl/async.js.map +1 -1
  65. package/dist/esm/assertion/impl/sync-parametric.d.ts +24 -24
  66. package/dist/esm/assertion/impl/sync-parametric.d.ts.map +1 -1
  67. package/dist/esm/assertion/impl/sync-parametric.js +3 -3
  68. package/dist/esm/assertion/impl/sync-parametric.js.map +1 -1
  69. package/dist/esm/assertion/impl/sync.d.ts +50 -50
  70. package/dist/esm/assertion/impl/sync.d.ts.map +1 -1
  71. package/dist/esm/bootstrap.d.ts +71 -61
  72. package/dist/esm/bootstrap.d.ts.map +1 -1
  73. package/dist/esm/bootstrap.js +19 -9
  74. package/dist/esm/bootstrap.js.map +1 -1
  75. package/dist/esm/error.d.ts +12 -5
  76. package/dist/esm/error.d.ts.map +1 -1
  77. package/dist/esm/error.js +19 -4
  78. package/dist/esm/error.js.map +1 -1
  79. package/dist/esm/expect.d.ts +130 -3
  80. package/dist/esm/expect.d.ts.map +1 -1
  81. package/dist/esm/expect.js +115 -0
  82. package/dist/esm/expect.js.map +1 -1
  83. package/dist/esm/guards.d.ts +22 -15
  84. package/dist/esm/guards.d.ts.map +1 -1
  85. package/dist/esm/guards.js +29 -13
  86. package/dist/esm/guards.js.map +1 -1
  87. package/dist/esm/index.d.ts +113 -62
  88. package/dist/esm/index.d.ts.map +1 -1
  89. package/dist/esm/index.js +46 -7
  90. package/dist/esm/index.js.map +1 -1
  91. package/dist/esm/metadata.d.ts +1 -27
  92. package/dist/esm/metadata.d.ts.map +1 -1
  93. package/dist/esm/metadata.js +2 -1
  94. package/dist/esm/metadata.js.map +1 -1
  95. package/dist/esm/schema.d.ts +59 -26
  96. package/dist/esm/schema.d.ts.map +1 -1
  97. package/dist/esm/schema.js +57 -24
  98. package/dist/esm/schema.js.map +1 -1
  99. package/dist/esm/types.d.ts +449 -39
  100. package/dist/esm/types.d.ts.map +1 -1
  101. package/dist/esm/types.js +12 -2
  102. package/dist/esm/types.js.map +1 -1
  103. package/dist/esm/util.d.ts +7 -0
  104. package/dist/esm/util.d.ts.map +1 -1
  105. package/dist/esm/util.js +7 -0
  106. package/dist/esm/util.js.map +1 -1
  107. package/package.json +89 -15
  108. package/src/assertion/assertion-types.ts +38 -41
  109. package/src/assertion/create.ts +16 -65
  110. package/src/assertion/impl/async.ts +2 -2
  111. package/src/assertion/impl/sync-parametric.ts +3 -3
  112. package/src/bootstrap.ts +21 -10
  113. package/src/error.ts +21 -4
  114. package/src/expect.ts +269 -18
  115. package/src/guards.ts +29 -51
  116. package/src/index.ts +71 -11
  117. package/src/metadata.ts +3 -4
  118. package/src/schema.ts +59 -26
  119. package/src/types.ts +593 -72
  120. package/src/util.ts +7 -0
  121. package/dist/commonjs/api.d.ts +0 -93
  122. package/dist/commonjs/api.d.ts.map +0 -1
  123. package/dist/commonjs/api.js +0 -8
  124. package/dist/commonjs/api.js.map +0 -1
  125. package/dist/esm/api.d.ts +0 -93
  126. package/dist/esm/api.d.ts.map +0 -1
  127. package/dist/esm/api.js +0 -7
  128. package/dist/esm/api.js.map +0 -1
  129. package/src/api.ts +0 -149
  130. package/src/schema.md +0 -15
@@ -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,wBAAgB,yBAAyB,CACvC,CAAC,SAAS,kBAAkB,EAC5B,CAAC,SAAS,WAAW,CAAC,kBAAkB,CAAC,EACzC,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;AACtE,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,kBAAkB,EACpE,UAAU,EAAE,CAAC,GACZ,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAmD1B,wBAAgB,wBAAwB,CACtC,CAAC,SAAS,iBAAiB,EAC3B,CAAC,SAAS,MAAM,CAAC,iBAAiB,CAAC,EACnC,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,C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AAS,kBAAkB,EACpE,UAAU,EAAE,CAAC,GACZ,mBAAmB,CAAC,CAAC,CAAC,CAAC;AAkH1B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,wBAAgB,wBAAwB,CACtC,UAAU,SAAS,iBAAiB,EACpC,YAAY,SAAS,MAAM,CAAC,iBAAiB,CAAC,EAE9C,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,YAAY,GACnB,cAAc,CAAC,UAAU,GAAG,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;AAE3D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,SAAS,iBAAiB,EAC3E,UAAU,EAAE,UAAU,GACrB,cAAc,CAAC,UAAU,CAAC,CAAC;AAsS9B;;;GAGG;AACH,wBAAgB,gBAAgB,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"}
@@ -5,6 +5,68 @@ import { AssertionError, 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) => {
@@ -1 +1 @@
1
- {"version":3,"file":"expect.js","sourceRoot":"","sources":["../../src/expect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAwB/B,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,KAAK,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AASrC,MAAM,UAAU,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,CA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CAAC;IAClD,KAAK,CAAC,4CAA4C,aAAa,EAAE,CAAC,CAAC;IACnE,MAAM,IAAI,SAAS,CACjB,4CAA4C,aAAa,EAAE,CAC5D,CAAC;AACJ,CAAC,CAAC;AAEF;;;;;;GAMG;AAEH,MAAM,cAAc,GAAG,CACrB,MAAc,EAId,EAAE;IACF,IAAI,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;QAC9B,OAAO;YACL,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,gBAAgB;YACpD,SAAS,EAAE,IAAI;SAChB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,aAAa,EAAE,MAAM;QACrB,SAAS,EAAE,KAAK;KACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,IAAI,GAAW,CAAC,MAAe,EAAS,EAAE;IAC9C,MAAM,IAAI,cAAc,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;AAChD,CAAC,CAAC;AAcF,MAAM,UAAU,gBAAgB,CAG9B,cAAiB,EAAE,eAAkB,EAAE,IAAsB;IAC7D,OAAO,IAAI,KAAK,MAAM;QACpB,CAAC,CAAC;YACE,UAAU,EAAE,cAAc;YAC1B,eAAe;YACf,oBAAoB;YACpB,IAAI;YACJ,GAAG,EAAE,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC;SAChD;QACH,CAAC,CAAC;YACE,UAAU,EAAE,eAAe;YAC3B,eAAe;YACf,oBAAoB;YACpB,IAAI;YACJ,GAAG,EAAE,SAAS,CAAC,cAAc,EAAE,eAAe,CAAC;SAChD,CAAC;AACR,CAAC"}
@@ -2,26 +2,32 @@
2
2
  * Type guard functions and runtime type checking utilities.
3
3
  *
4
4
  * This module provides various type guard functions for runtime type checking,
5
- * including guards for Zod schemas, constructors, Promise-like objects, and
6
- * assertion parts. These are used throughout the library for safe type
5
+ * including guards for Zod schemas, constructors, {@link PromiseLike} objects,
6
+ * and assertion parts. These are used throughout the library for safe type
7
7
  * narrowing and validation.
8
8
  *
9
+ * @category API
10
+ * @example
11
+ *
12
+ * ```ts
13
+ * import * as guards from 'bupkis/guards';
14
+ * ```
15
+ *
9
16
  * @packageDocumentation
10
17
  */
11
18
  import { type Primitive } from 'type-fest';
12
- import { z } from 'zod';
13
- import type { AssertionFailure } from './assertion/assertion-types.js';
19
+ import { z } from 'zod/v4';
14
20
  import type { Constructor } from './types.js';
15
21
  /**
16
- * Returns true if the given value looks like a Zod schema (v4), determined by
17
- * the presence of an internal `def.type` field.
22
+ * Returns `true` if the given value looks like a Zod v4 schema, determined by
23
+ * the presence of an internal {@link z.core.$ZodTypeDef} field.
18
24
  *
19
25
  * Note: This relies on Zod's internal shape and is intended for runtime
20
26
  * discrimination within this library.
21
27
  *
22
28
  * @template T
23
29
  * @param value - Value to test
24
- * @returns Whether the value is Zod-like
30
+ * @returns Whether the value is `ZodType`-like
25
31
  */
26
32
  export declare const isZodType: (value: unknown) => value is z.ZodType;
27
33
  /**
@@ -39,11 +45,17 @@ export declare const isZodPromise: (value: unknown) => value is z.ZodPromise;
39
45
  */
40
46
  export declare const isPromiseLike: (value: unknown) => value is PromiseLike<unknown>;
41
47
  /**
42
- * Returns true if the given value is a constructable function (i.e., a class).
48
+ * Returns `true` if the given value is a constructable function (i.e., a
49
+ * class).
43
50
  *
44
- * This may be the only way we can determine, at runtime, if a function is a
45
- * constructor without actually calling it.
51
+ * This works by wrapping `fn` in a {@link Proxy}, attaching a no-op
52
+ * {@link ProxyHandler.construct} trap to it, then attempting to construct the
53
+ * proxy via `new`.
46
54
  *
55
+ * @privateRemarks
56
+ * This may be the only way we can determine, at runtime, if a function is a
57
+ * constructor without actually calling it. I am unsure if this only works for
58
+ * classes.
47
59
  * @param fn - Function to test
48
60
  * @returns Whether the function is constructable
49
61
  */
@@ -62,8 +74,6 @@ export declare const isBoolean: (value: unknown) => value is boolean;
62
74
  * @returns `true` if the value is a function, `false` otherwise
63
75
  */
64
76
  export declare const isFunction: (value: unknown) => value is (...args: any[]) => any;
65
- export declare const isAssertionFailure: (value: unknown) => value is AssertionFailure;
66
- export declare const isAsyncFunction: (value: unknown) => value is (...args: any[]) => Promise<any>;
67
77
  /**
68
78
  * Type guard for a string value
69
79
  *
@@ -85,9 +95,6 @@ export declare const isNonNullObject: (value: unknown) => value is object;
85
95
  * @returns `true` if the value is null or not an object, `false` otherwise
86
96
  */
87
97
  export declare const isNullOrNonObject: (value: unknown) => value is null | Primitive;
88
- export type PrimitiveTypeName = 'bigint' | 'boolean' | 'function' | 'null' | 'number' | 'object' | 'string' | 'symbol' | 'undefined';
89
- export type PrimitiveTypeNameToType<T extends PrimitiveTypeName> = T extends 'undefined' ? undefined : T extends 'object' ? null | object : T extends 'function' ? (...args: any[]) => any : T extends 'string' ? string : T extends 'number' ? number : T extends 'boolean' ? boolean : T extends 'bigint' ? bigint : T extends 'symbol' ? symbol : never;
90
- export declare const isType: <T extends PrimitiveTypeName>(a: unknown, b: T) => a is PrimitiveTypeNameToType<T>;
91
98
  export declare const isA: <T extends Constructor>(value: unknown, ctor: T) => value is InstanceType<T>;
92
99
  export declare const isError: (value: unknown) => value is Error;
93
100
  //# sourceMappingURL=guards.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,KAAK,EACV,gBAAgB,EAGjB,MAAM,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,CAAC,CAAC,OAQnD,CAAC;AAEJ;;;;;GAKG;AACH,eAAO,MAAM,YAAY,GAAI,OAAO,OAAO,KAA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MAAM,eAAe,GAAI,IAAI,OAAO,KAAG,EAAE,IAAI,WAYnD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,OACxB,CAAC;AAE7B;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAC5C,CAAC;AA6B9B;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACxB,CAAC;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACb,CAAC;AAE9C;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,IAAI,GAAG,SACtB,CAAC;AAyB9C,eAAO,MAAM,GAAG,GAAI,CAAC,SAAS,WAAW,EACvC,OAAO,OAAO,EACd,MAAM,CAAC,KACN,KAAK,IAAI,YAAY,CAAC,CAAC,CAEzB,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,KAA0B,CAAC"}
@@ -2,23 +2,30 @@
2
2
  * Type guard functions and runtime type checking utilities.
3
3
  *
4
4
  * This module provides various type guard functions for runtime type checking,
5
- * including guards for Zod schemas, constructors, Promise-like objects, and
6
- * assertion parts. These are used throughout the library for safe type
5
+ * including guards for Zod schemas, constructors, {@link PromiseLike} objects,
6
+ * and assertion parts. These are used throughout the library for safe type
7
7
  * narrowing and validation.
8
8
  *
9
+ * @category API
10
+ * @example
11
+ *
12
+ * ```ts
13
+ * import * as guards from 'bupkis/guards';
14
+ * ```
15
+ *
9
16
  * @packageDocumentation
10
17
  */
11
- import { z } from 'zod';
18
+ import { z } from 'zod/v4';
12
19
  /**
13
- * Returns true if the given value looks like a Zod schema (v4), determined by
14
- * the presence of an internal `def.type` field.
20
+ * Returns `true` if the given value looks like a Zod v4 schema, determined by
21
+ * the presence of an internal {@link z.core.$ZodTypeDef} field.
15
22
  *
16
23
  * Note: This relies on Zod's internal shape and is intended for runtime
17
24
  * discrimination within this library.
18
25
  *
19
26
  * @template T
20
27
  * @param value - Value to test
21
- * @returns Whether the value is Zod-like
28
+ * @returns Whether the value is `ZodType`-like
22
29
  */
23
30
  export const isZodType = (value) => !!(value &&
24
31
  typeof value === 'object' &&
@@ -44,11 +51,17 @@ export const isPromiseLike = (value) => !!(value &&
44
51
  // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
45
52
  typeof value.then === 'function');
46
53
  /**
47
- * Returns true if the given value is a constructable function (i.e., a class).
54
+ * Returns `true` if the given value is a constructable function (i.e., a
55
+ * class).
48
56
  *
49
- * This may be the only way we can determine, at runtime, if a function is a
50
- * constructor without actually calling it.
57
+ * This works by wrapping `fn` in a {@link Proxy}, attaching a no-op
58
+ * {@link ProxyHandler.construct} trap to it, then attempting to construct the
59
+ * proxy via `new`.
51
60
  *
61
+ * @privateRemarks
62
+ * This may be the only way we can determine, at runtime, if a function is a
63
+ * constructor without actually calling it. I am unsure if this only works for
64
+ * classes.
52
65
  * @param fn - Function to test
53
66
  * @returns Whether the function is constructable
54
67
  */
@@ -94,8 +107,14 @@ const AssertionFailureSchema = z.object({
94
107
  .optional()
95
108
  .describe('A human-readable message describing the failure'),
96
109
  });
110
+ /**
111
+ * Type guard for a {@link AssertionFailure} object
112
+ *
113
+ * @param value Value to check
114
+ * @returns `true` if the value is an `AssertionFailure`, `false` otherwise
115
+ * @internal
116
+ */
97
117
  export const isAssertionFailure = (value) => AssertionFailureSchema.safeParse(value).success;
98
- export const isAsyncFunction = (value) => isFunction(value) && value.constructor.name === 'AsyncFunction';
99
118
  /**
100
119
  * Type guard for a string value
101
120
  *
@@ -134,9 +153,6 @@ export const isPhraseLiteralChoice = (value) => Array.isArray(value) && value.ev
134
153
  * @internal
135
154
  */
136
155
  export const isPhraseLiteral = (value) => isString(value) && !value.startsWith('not ');
137
- export const isType = (a, b) => {
138
- return typeof a === b;
139
- };
140
156
  export const isA = (value, ctor) => {
141
157
  return isNonNullObject(value) && value instanceof ctor;
142
158
  };
@@ -1 +1 @@
1
- {"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/guards.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AASxB;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAc,EAAsB,EAAE,CAC9D,CAAC,CAAC,CACA,KAAK;IACL,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,IAAI,KAAK;IACd,KAAK,CAAC,GAAG;IACT,OAAO,KAAK,CAAC,GAAG,KAAK,QAAQ;IAC7B,MAAM,IAAI,KAAK,CAAC,GAAG,CACpB,CAAC;AAEJ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAc,EAAyB,EAAE,CACpE,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC;AAEnD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAiC,EAAE,CAC7E,CAAC,CAAC,CACA,KAAK;IACL,OAAO,KAAK,KAAK,QAAQ;IACzB,sEAAsE;IACtE,OAAQ,KAAa,CAAC,IAAI,KAAK,UAAU,CAC1C,CAAC;AAEJ;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAW,EAAqB,EAAE;IAChE,IAAI,EAAE,KAAK,MAAM,IAAI,EAAE,KAAK,MAAM,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,CAAC;QACH,0EAA0E;QAC1E,6DAA6D;QAC7D,IAAI,IAAI,KAAK,CAAC,EAAS,EAAE,EAAE,SAAS,EAAE,GAAG,E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