@dereekb/util 13.4.0 → 13.4.1

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 (80) hide show
  1. package/fetch/index.cjs.js +191 -109
  2. package/fetch/index.esm.js +191 -109
  3. package/fetch/package.json +2 -2
  4. package/fetch/src/lib/error.d.ts +6 -0
  5. package/fetch/src/lib/fetch.d.ts +37 -0
  6. package/fetch/src/lib/fetch.file.d.ts +7 -5
  7. package/fetch/src/lib/fetch.limit.d.ts +7 -0
  8. package/fetch/src/lib/fetch.url.d.ts +6 -3
  9. package/fetch/src/lib/json.d.ts +12 -1
  10. package/fetch/src/lib/timeout.d.ts +8 -0
  11. package/fetch/src/lib/url.d.ts +33 -0
  12. package/index.cjs.js +1440 -746
  13. package/index.esm.js +1440 -747
  14. package/package.json +1 -1
  15. package/src/lib/array/array.boolean.d.ts +7 -0
  16. package/src/lib/array/array.filter.d.ts +4 -4
  17. package/src/lib/array/array.index.d.ts +3 -1
  18. package/src/lib/array/array.indexed.d.ts +9 -3
  19. package/src/lib/array/array.limit.d.ts +2 -0
  20. package/src/lib/assertion/assert.d.ts +3 -0
  21. package/src/lib/assertion/assert.error.d.ts +6 -0
  22. package/src/lib/boolean.d.ts +3 -0
  23. package/src/lib/date/expires.d.ts +3 -3
  24. package/src/lib/date/minute.d.ts +14 -8
  25. package/src/lib/date/time.d.ts +3 -0
  26. package/src/lib/error/error.server.d.ts +1 -0
  27. package/src/lib/file/pdf.d.ts +1 -1
  28. package/src/lib/getter/getter.cache.d.ts +1 -1
  29. package/src/lib/grouping.d.ts +11 -2
  30. package/src/lib/map/map.key.d.ts +1 -1
  31. package/src/lib/model/model.d.ts +14 -9
  32. package/src/lib/number/dollar.d.ts +8 -0
  33. package/src/lib/number/number.d.ts +4 -0
  34. package/src/lib/object/object.equal.d.ts +2 -2
  35. package/src/lib/object/object.filter.pojo.d.ts +7 -0
  36. package/src/lib/object/object.filter.tuple.d.ts +2 -0
  37. package/src/lib/object/object.map.d.ts +1 -1
  38. package/src/lib/path/path.d.ts +4 -2
  39. package/src/lib/promise/poll.d.ts +3 -0
  40. package/src/lib/promise/promise.d.ts +19 -7
  41. package/src/lib/promise/promise.loop.d.ts +27 -9
  42. package/src/lib/relation/relation.d.ts +12 -0
  43. package/src/lib/service/handler.config.d.ts +3 -1
  44. package/src/lib/service/handler.d.ts +6 -2
  45. package/src/lib/service/typed.service.d.ts +3 -1
  46. package/src/lib/set/set.d.ts +32 -19
  47. package/src/lib/set/set.hashset.d.ts +3 -1
  48. package/src/lib/sort.d.ts +11 -0
  49. package/src/lib/storage/storage.error.d.ts +3 -0
  50. package/src/lib/storage/storage.memory.d.ts +7 -0
  51. package/src/lib/storage/storage.object.d.ts +5 -0
  52. package/src/lib/string/dencoder.d.ts +4 -1
  53. package/src/lib/string/mimetype.d.ts +57 -19
  54. package/src/lib/string/transform.d.ts +10 -1
  55. package/src/lib/string/tree.d.ts +18 -6
  56. package/src/lib/string/url.d.ts +57 -19
  57. package/src/lib/tree/tree.d.ts +12 -4
  58. package/src/lib/tree/tree.flatten.d.ts +3 -1
  59. package/src/lib/value/address.d.ts +24 -7
  60. package/src/lib/value/bound.d.ts +3 -0
  61. package/src/lib/value/build.d.ts +3 -0
  62. package/src/lib/value/comparator.d.ts +4 -0
  63. package/src/lib/value/cron.d.ts +1 -0
  64. package/src/lib/value/decision.d.ts +3 -0
  65. package/src/lib/value/equal.d.ts +3 -0
  66. package/src/lib/value/indexed.d.ts +4 -0
  67. package/src/lib/value/label.d.ts +1 -0
  68. package/src/lib/value/map.d.ts +9 -0
  69. package/src/lib/value/maybe.d.ts +13 -0
  70. package/src/lib/value/modifier.d.ts +9 -0
  71. package/src/lib/value/point.d.ts +3 -0
  72. package/src/lib/value/url.d.ts +1 -0
  73. package/src/lib/value/vector.d.ts +5 -0
  74. package/test/index.cjs.js +29 -6
  75. package/test/index.esm.js +29 -6
  76. package/test/package.json +2 -2
  77. package/test/src/lib/jest/jest.fail.d.ts +3 -3
  78. package/test/src/lib/shared/shared.d.ts +7 -1
  79. package/test/src/lib/shared/shared.fail.d.ts +8 -2
  80. package/test/src/lib/shared/shared.wrap.d.ts +1 -0
package/test/index.cjs.js CHANGED
@@ -218,6 +218,7 @@ function _ts_generator$2(thisArg, body) {
218
218
  }
219
219
  /**
220
220
  * Passes the error to the TestDoneCallback.
221
+ *
221
222
  * @param done - the test framework's done callback to signal completion or failure
222
223
  * @param e - the error to pass to the callback; defaults to a generic error
223
224
  */ function failWithTestDoneCallback(done) {
@@ -232,6 +233,8 @@ function _ts_generator$2(thisArg, body) {
232
233
  * Creates a new TestDoneCallbackRef.
233
234
  *
234
235
  * Used to create a promise reference that can be used to assert that a test function was called.
236
+ *
237
+ * @returns a new {@link TestDoneCallbackRef} with a done callback and underlying promise
235
238
  */ function testDoneCallbackRef() {
236
239
  var _promise = util.promiseReference();
237
240
  var done = function done(e) {
@@ -266,6 +269,9 @@ function _ts_generator$2(thisArg, body) {
266
269
  * // async test code
267
270
  * done();
268
271
  * }));
272
+ *
273
+ * @param testFn - the callback-based test function that receives a done callback
274
+ * @returns a Promise-based wrapper function suitable for Vitest or other async test runners
269
275
  */ function callbackTest(testFn) {
270
276
  return function() {
271
277
  return _async_to_generator$2(function() {
@@ -697,6 +703,7 @@ function _ts_generator$1(thisArg, body) {
697
703
  /**
698
704
  * Wraps the input TestContextFactory to emit another type of Fixture for tests.
699
705
  *
706
+ * @param config - configuration specifying how to wrap fixtures and optional setup/teardown hooks
700
707
  * @returns a function that transforms a {@link TestContextFactory} of type `F` into one of type `W`
701
708
  */ function wrapTestContextFactory(config) {
702
709
  return function(factory) {
@@ -705,7 +712,8 @@ function _ts_generator$1(thisArg, body) {
705
712
  var wrap = config.wrapFixture(inputFixture);
706
713
  var effect;
707
714
  // add before each
708
- if (config.setupWrap != null) {
715
+ var setupWrap = config.setupWrap, teardownWrap = config.teardownWrap;
716
+ if (setupWrap != null) {
709
717
  beforeEach(function() {
710
718
  return _async_to_generator$1(function() {
711
719
  return _ts_generator$1(this, function(_state) {
@@ -713,7 +721,7 @@ function _ts_generator$1(thisArg, body) {
713
721
  case 0:
714
722
  return [
715
723
  4,
716
- config.setupWrap(wrap)
724
+ setupWrap(wrap)
717
725
  ];
718
726
  case 1:
719
727
  effect = _state.sent();
@@ -728,7 +736,7 @@ function _ts_generator$1(thisArg, body) {
728
736
  // add tests
729
737
  buildTests(wrap);
730
738
  // add after each
731
- if (config.teardownWrap != null) {
739
+ if (teardownWrap != null) {
732
740
  afterEach(function() {
733
741
  return _async_to_generator$1(function() {
734
742
  return _ts_generator$1(this, function(_state) {
@@ -736,7 +744,7 @@ function _ts_generator$1(thisArg, body) {
736
744
  case 0:
737
745
  return [
738
746
  4,
739
- config.teardownWrap(wrap, effect)
747
+ teardownWrap(wrap, effect)
740
748
  ];
741
749
  case 1:
742
750
  _state.sent();
@@ -801,7 +809,7 @@ function _ts_generator$1(thisArg, body) {
801
809
  return _ts_generator$1(this, function(_state) {
802
810
  switch(_state.label){
803
811
  case 0:
804
- deleteInstanceEffect === null || deleteInstanceEffect === void 0 ? void 0 : deleteInstanceEffect();
812
+ deleteInstanceEffect();
805
813
  if (!config.teardownInstance) return [
806
814
  3,
807
815
  2
@@ -1074,6 +1082,7 @@ function _ts_generator(thisArg, body) {
1074
1082
  * Creates an {@link ExpectedFailError} without throwing it, for use in deferred error handling.
1075
1083
  *
1076
1084
  * @param message - optional error message
1085
+ * @returns a new {@link ExpectedFailError} instance
1077
1086
  */ function failSuccessfullyError(message) {
1078
1087
  return new ExpectedFailError(message);
1079
1088
  }
@@ -1101,6 +1110,7 @@ function _ts_generator(thisArg, body) {
1101
1110
  * Creates an {@link UnexpectedSuccessFailureError} without throwing it.
1102
1111
  *
1103
1112
  * @param message - optional error message; defaults to a standard "expected an error" message
1113
+ * @returns a new {@link UnexpectedSuccessFailureError} instance
1104
1114
  */ function failDueToSuccessError(message) {
1105
1115
  return new UnexpectedSuccessFailureError(message !== null && message !== void 0 ? message : 'expected an error to occur but was successful instead');
1106
1116
  }
@@ -1137,6 +1147,8 @@ function _ts_generator(thisArg, body) {
1137
1147
  /**
1138
1148
  * Default error handler for {@link expectSuccessfulFail} that passes through {@link ExpectedFailError}
1139
1149
  * instances and re-throws all other errors.
1150
+ *
1151
+ * @param e - the caught error to evaluate
1140
1152
  */ function EXPECT_ERROR_DEFAULT_HANDLER(e) {
1141
1153
  if (_instanceof(e, ExpectedFailError)) ; else {
1142
1154
  throw e;
@@ -1156,7 +1168,13 @@ function _ts_generator(thisArg, body) {
1156
1168
  }
1157
1169
  };
1158
1170
  }
1159
- function expectFail(errorFn, assertFailType) {
1171
+ /**
1172
+ * Function that expects any failure to be thrown, then throws an ExpectedFailError.
1173
+ *
1174
+ * @param errorFn - function expected to throw an error (sync or async)
1175
+ * @param assertFailType - optional assertion to validate the type or content of the thrown error
1176
+ * @returns a promise that resolves when the expected failure is verified
1177
+ */ function expectFail(errorFn, assertFailType) {
1160
1178
  function handleError(e) {
1161
1179
  if (_instanceof(e, UnexpectedSuccessFailureError)) {
1162
1180
  throw e;
@@ -1178,6 +1196,7 @@ function expectFail(errorFn, assertFailType) {
1178
1196
  } catch (e) {
1179
1197
  handleError(e);
1180
1198
  }
1199
+ return Promise.resolve();
1181
1200
  }
1182
1201
  function expectSuccessfulFail(errorFn) {
1183
1202
  var handleError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : EXPECT_ERROR_DEFAULT_HANDLER;
@@ -1268,6 +1287,8 @@ function itShouldFail(describeOrFn, fn) {
1268
1287
  *
1269
1288
  * Calling the returned function with no arguments resolves the promise;
1270
1289
  * calling it with an error (or calling `.fail()`) rejects the promise.
1290
+ *
1291
+ * @returns a new {@link FakeDoneHandler} backed by a promise reference
1271
1292
  */ function fakeDoneHandler() {
1272
1293
  var promiseRef = util.promiseReference();
1273
1294
  var doneHandler = promiseRef.resolve;
@@ -1472,6 +1493,8 @@ function _is_native_reflect_construct() {
1472
1493
  }(ExpectedErrorOfSpecificTypeError);
1473
1494
  /**
1474
1495
  * @deprecated Use failWithTestDoneCallback with failDueToSuccessError from shared instead. This is kept for backwards compatibility.
1496
+ *
1497
+ * @param done - the test done callback to invoke with the failure error
1475
1498
  */ function failWithDoneDueToSuccess(done) {
1476
1499
  failWithTestDoneCallback(done, failDueToSuccessError());
1477
1500
  }
package/test/index.esm.js CHANGED
@@ -216,6 +216,7 @@ function _ts_generator$2(thisArg, body) {
216
216
  }
217
217
  /**
218
218
  * Passes the error to the TestDoneCallback.
219
+ *
219
220
  * @param done - the test framework's done callback to signal completion or failure
220
221
  * @param e - the error to pass to the callback; defaults to a generic error
221
222
  */ function failWithTestDoneCallback(done) {
@@ -230,6 +231,8 @@ function _ts_generator$2(thisArg, body) {
230
231
  * Creates a new TestDoneCallbackRef.
231
232
  *
232
233
  * Used to create a promise reference that can be used to assert that a test function was called.
234
+ *
235
+ * @returns a new {@link TestDoneCallbackRef} with a done callback and underlying promise
233
236
  */ function testDoneCallbackRef() {
234
237
  var _promise = promiseReference();
235
238
  var done = function done(e) {
@@ -264,6 +267,9 @@ function _ts_generator$2(thisArg, body) {
264
267
  * // async test code
265
268
  * done();
266
269
  * }));
270
+ *
271
+ * @param testFn - the callback-based test function that receives a done callback
272
+ * @returns a Promise-based wrapper function suitable for Vitest or other async test runners
267
273
  */ function callbackTest(testFn) {
268
274
  return function() {
269
275
  return _async_to_generator$2(function() {
@@ -695,6 +701,7 @@ function _ts_generator$1(thisArg, body) {
695
701
  /**
696
702
  * Wraps the input TestContextFactory to emit another type of Fixture for tests.
697
703
  *
704
+ * @param config - configuration specifying how to wrap fixtures and optional setup/teardown hooks
698
705
  * @returns a function that transforms a {@link TestContextFactory} of type `F` into one of type `W`
699
706
  */ function wrapTestContextFactory(config) {
700
707
  return function(factory) {
@@ -703,7 +710,8 @@ function _ts_generator$1(thisArg, body) {
703
710
  var wrap = config.wrapFixture(inputFixture);
704
711
  var effect;
705
712
  // add before each
706
- if (config.setupWrap != null) {
713
+ var setupWrap = config.setupWrap, teardownWrap = config.teardownWrap;
714
+ if (setupWrap != null) {
707
715
  beforeEach(function() {
708
716
  return _async_to_generator$1(function() {
709
717
  return _ts_generator$1(this, function(_state) {
@@ -711,7 +719,7 @@ function _ts_generator$1(thisArg, body) {
711
719
  case 0:
712
720
  return [
713
721
  4,
714
- config.setupWrap(wrap)
722
+ setupWrap(wrap)
715
723
  ];
716
724
  case 1:
717
725
  effect = _state.sent();
@@ -726,7 +734,7 @@ function _ts_generator$1(thisArg, body) {
726
734
  // add tests
727
735
  buildTests(wrap);
728
736
  // add after each
729
- if (config.teardownWrap != null) {
737
+ if (teardownWrap != null) {
730
738
  afterEach(function() {
731
739
  return _async_to_generator$1(function() {
732
740
  return _ts_generator$1(this, function(_state) {
@@ -734,7 +742,7 @@ function _ts_generator$1(thisArg, body) {
734
742
  case 0:
735
743
  return [
736
744
  4,
737
- config.teardownWrap(wrap, effect)
745
+ teardownWrap(wrap, effect)
738
746
  ];
739
747
  case 1:
740
748
  _state.sent();
@@ -799,7 +807,7 @@ function _ts_generator$1(thisArg, body) {
799
807
  return _ts_generator$1(this, function(_state) {
800
808
  switch(_state.label){
801
809
  case 0:
802
- deleteInstanceEffect === null || deleteInstanceEffect === void 0 ? void 0 : deleteInstanceEffect();
810
+ deleteInstanceEffect();
803
811
  if (!config.teardownInstance) return [
804
812
  3,
805
813
  2
@@ -1072,6 +1080,7 @@ function _ts_generator(thisArg, body) {
1072
1080
  * Creates an {@link ExpectedFailError} without throwing it, for use in deferred error handling.
1073
1081
  *
1074
1082
  * @param message - optional error message
1083
+ * @returns a new {@link ExpectedFailError} instance
1075
1084
  */ function failSuccessfullyError(message) {
1076
1085
  return new ExpectedFailError(message);
1077
1086
  }
@@ -1099,6 +1108,7 @@ function _ts_generator(thisArg, body) {
1099
1108
  * Creates an {@link UnexpectedSuccessFailureError} without throwing it.
1100
1109
  *
1101
1110
  * @param message - optional error message; defaults to a standard "expected an error" message
1111
+ * @returns a new {@link UnexpectedSuccessFailureError} instance
1102
1112
  */ function failDueToSuccessError(message) {
1103
1113
  return new UnexpectedSuccessFailureError(message !== null && message !== void 0 ? message : 'expected an error to occur but was successful instead');
1104
1114
  }
@@ -1135,6 +1145,8 @@ function _ts_generator(thisArg, body) {
1135
1145
  /**
1136
1146
  * Default error handler for {@link expectSuccessfulFail} that passes through {@link ExpectedFailError}
1137
1147
  * instances and re-throws all other errors.
1148
+ *
1149
+ * @param e - the caught error to evaluate
1138
1150
  */ function EXPECT_ERROR_DEFAULT_HANDLER(e) {
1139
1151
  if (_instanceof(e, ExpectedFailError)) ; else {
1140
1152
  throw e;
@@ -1154,7 +1166,13 @@ function _ts_generator(thisArg, body) {
1154
1166
  }
1155
1167
  };
1156
1168
  }
1157
- function expectFail(errorFn, assertFailType) {
1169
+ /**
1170
+ * Function that expects any failure to be thrown, then throws an ExpectedFailError.
1171
+ *
1172
+ * @param errorFn - function expected to throw an error (sync or async)
1173
+ * @param assertFailType - optional assertion to validate the type or content of the thrown error
1174
+ * @returns a promise that resolves when the expected failure is verified
1175
+ */ function expectFail(errorFn, assertFailType) {
1158
1176
  function handleError(e) {
1159
1177
  if (_instanceof(e, UnexpectedSuccessFailureError)) {
1160
1178
  throw e;
@@ -1176,6 +1194,7 @@ function expectFail(errorFn, assertFailType) {
1176
1194
  } catch (e) {
1177
1195
  handleError(e);
1178
1196
  }
1197
+ return Promise.resolve();
1179
1198
  }
1180
1199
  function expectSuccessfulFail(errorFn) {
1181
1200
  var handleError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : EXPECT_ERROR_DEFAULT_HANDLER;
@@ -1266,6 +1285,8 @@ function itShouldFail(describeOrFn, fn) {
1266
1285
  *
1267
1286
  * Calling the returned function with no arguments resolves the promise;
1268
1287
  * calling it with an error (or calling `.fail()`) rejects the promise.
1288
+ *
1289
+ * @returns a new {@link FakeDoneHandler} backed by a promise reference
1269
1290
  */ function fakeDoneHandler() {
1270
1291
  var promiseRef = promiseReference();
1271
1292
  var doneHandler = promiseRef.resolve;
@@ -1470,6 +1491,8 @@ function _is_native_reflect_construct() {
1470
1491
  }(ExpectedErrorOfSpecificTypeError);
1471
1492
  /**
1472
1493
  * @deprecated Use failWithTestDoneCallback with failDueToSuccessError from shared instead. This is kept for backwards compatibility.
1494
+ *
1495
+ * @param done - the test done callback to invoke with the failure error
1473
1496
  */ function failWithDoneDueToSuccess(done) {
1474
1497
  failWithTestDoneCallback(done, failDueToSuccessError());
1475
1498
  }
package/test/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@dereekb/util/test",
3
- "version": "13.4.0",
3
+ "version": "13.4.1",
4
4
  "peerDependencies": {
5
- "@dereekb/util": "13.4.0",
5
+ "@dereekb/util": "13.4.1",
6
6
  "make-error": "^1.3.0"
7
7
  },
8
8
  "exports": {
@@ -4,7 +4,7 @@
4
4
  * Since fail() was silently removed, we redefine it.
5
5
  */
6
6
  import { type TestDoneCallback, failWithTestDoneCallback, type TestProvidesCallbackWithDone, type TestProvidesCallback } from '../shared';
7
- import { ExpectedFailError, failSuccessfullyError, failSuccessfully, UnexpectedSuccessFailureError, failDueToSuccessError, ExpectedErrorOfSpecificTypeError, failTest, failDueToSuccess, EXPECT_ERROR_DEFAULT_HANDLER, type ExpectFailAssertionFunction, expectFailAssertErrorType, expectFail, expectSuccessfulFail, type ShouldFailDoneCallback, type ShouldFailProvidesCallbackWithDone, type ShouldFailProvidesCallbackWithResult, type ShouldFailProvidesCallback, type FakeDoneHandler } from '../shared/shared.fail';
7
+ import { ExpectedFailError, UnexpectedSuccessFailureError, ExpectedErrorOfSpecificTypeError, type ExpectFailAssertionFunction, expectFailAssertErrorType, type ShouldFailDoneCallback, type ShouldFailProvidesCallbackWithDone, type ShouldFailProvidesCallbackWithResult, type ShouldFailProvidesCallback, type FakeDoneHandler } from '../shared/shared.fail';
8
8
  /**
9
9
  * @deprecated Use TestDoneCallback from shared instead. This is kept for backwards compatibility.
10
10
  */
@@ -38,9 +38,10 @@ export declare class JestExpectedErrorOfSpecificTypeError extends ExpectedErrorO
38
38
  }
39
39
  /**
40
40
  * @deprecated Use failWithTestDoneCallback with failDueToSuccessError from shared instead. This is kept for backwards compatibility.
41
+ *
42
+ * @param done - the test done callback to invoke with the failure error
41
43
  */
42
44
  export declare function failWithDoneDueToSuccess(done: TestDoneCallback): void;
43
- export { failSuccessfullyError, failSuccessfully, failDueToSuccessError, failTest, failDueToSuccess, EXPECT_ERROR_DEFAULT_HANDLER };
44
45
  /**
45
46
  * @deprecated Use ExpectFailAssertionFunction from shared instead. This is kept for backwards compatibility.
46
47
  */
@@ -49,7 +50,6 @@ export type JestExpectFailAssertionFunction = ExpectFailAssertionFunction;
49
50
  * @deprecated Use expectFailAssertErrorType from shared instead. This is kept for backwards compatibility.
50
51
  */
51
52
  export declare const jestExpectFailAssertErrorType: typeof expectFailAssertErrorType;
52
- export { expectFail, expectSuccessfulFail };
53
53
  /**
54
54
  * @deprecated Use ShouldFailDoneCallback from shared instead. This is kept for backwards compatibility.
55
55
  */
@@ -10,12 +10,13 @@ export type TestDoneCallback = ((...args: any[]) => any) & {
10
10
  *
11
11
  * @param error
12
12
  */
13
- fail(error?: string | {
13
+ fail?(error?: string | {
14
14
  message: string;
15
15
  }): any;
16
16
  };
17
17
  /**
18
18
  * Passes the error to the TestDoneCallback.
19
+ *
19
20
  * @param done - the test framework's done callback to signal completion or failure
20
21
  * @param e - the error to pass to the callback; defaults to a generic error
21
22
  */
@@ -40,6 +41,8 @@ export type TestDoneCallbackRef = Omit<TestDoneCallback, 'fail'> & {
40
41
  * Creates a new TestDoneCallbackRef.
41
42
  *
42
43
  * Used to create a promise reference that can be used to assert that a test function was called.
44
+ *
45
+ * @returns a new {@link TestDoneCallbackRef} with a done callback and underlying promise
43
46
  */
44
47
  export declare function testDoneCallbackRef(): TestDoneCallbackRef;
45
48
  /**
@@ -61,6 +64,9 @@ export declare function testDoneCallbackRef(): TestDoneCallbackRef;
61
64
  * // async test code
62
65
  * done();
63
66
  * }));
67
+ *
68
+ * @param testFn - the callback-based test function that receives a done callback
69
+ * @returns a Promise-based wrapper function suitable for Vitest or other async test runners
64
70
  */
65
71
  export declare function callbackTest(testFn: TestProvidesCallbackWithDone | ((cb: TestDoneCallback) => PromiseOrValue<void | undefined>)): () => Promise<void>;
66
72
  /**
@@ -13,6 +13,7 @@ export declare class ExpectedFailError extends BaseError {
13
13
  * Creates an {@link ExpectedFailError} without throwing it, for use in deferred error handling.
14
14
  *
15
15
  * @param message - optional error message
16
+ * @returns a new {@link ExpectedFailError} instance
16
17
  */
17
18
  export declare function failSuccessfullyError(message?: string): ExpectedFailError;
18
19
  /**
@@ -33,6 +34,7 @@ export declare class UnexpectedSuccessFailureError extends BaseError {
33
34
  * Creates an {@link UnexpectedSuccessFailureError} without throwing it.
34
35
  *
35
36
  * @param message - optional error message; defaults to a standard "expected an error" message
37
+ * @returns a new {@link UnexpectedSuccessFailureError} instance
36
38
  */
37
39
  export declare function failDueToSuccessError(message?: string): UnexpectedSuccessFailureError;
38
40
  /**
@@ -58,6 +60,8 @@ export declare function failDueToSuccess(): never;
58
60
  /**
59
61
  * Default error handler for {@link expectSuccessfulFail} that passes through {@link ExpectedFailError}
60
62
  * instances and re-throws all other errors.
63
+ *
64
+ * @param e - the caught error to evaluate
61
65
  */
62
66
  export declare function EXPECT_ERROR_DEFAULT_HANDLER(e: unknown): void;
63
67
  /**
@@ -80,9 +84,9 @@ export declare function expectFailAssertErrorType(expectedType: ClassType | Clas
80
84
  *
81
85
  * @param errorFn - function expected to throw an error (sync or async)
82
86
  * @param assertFailType - optional assertion to validate the type or content of the thrown error
87
+ * @returns a promise that resolves when the expected failure is verified
83
88
  */
84
- export declare function expectFail(errorFn: () => void, assertFailType?: ExpectFailAssertionFunction): void;
85
- export declare function expectFail(errorFn: () => Promise<void>, assertFailType?: ExpectFailAssertionFunction): Promise<void>;
89
+ export declare function expectFail(errorFn: () => PromiseOrValue<any>, assertFailType?: ExpectFailAssertionFunction): Promise<void>;
86
90
  /**
87
91
  * Function that expects an ExpectedFailError to be thrown.
88
92
  *
@@ -142,5 +146,7 @@ export interface FakeDoneHandler extends TestDoneCallback, PromiseReference {
142
146
  *
143
147
  * Calling the returned function with no arguments resolves the promise;
144
148
  * calling it with an error (or calling `.fail()`) rejects the promise.
149
+ *
150
+ * @returns a new {@link FakeDoneHandler} backed by a promise reference
145
151
  */
146
152
  export declare function fakeDoneHandler(): FakeDoneHandler;
@@ -47,6 +47,7 @@ export interface WrapTestContextConfig<W, F, E = any> {
47
47
  /**
48
48
  * Wraps the input TestContextFactory to emit another type of Fixture for tests.
49
49
  *
50
+ * @param config - configuration specifying how to wrap fixtures and optional setup/teardown hooks
50
51
  * @returns a function that transforms a {@link TestContextFactory} of type `F` into one of type `W`
51
52
  */
52
53
  export declare function wrapTestContextFactory<W, F, E = any>(config: WrapTestContextConfig<W, F, E>): (factory: TestContextFactory<F>) => TestContextFactory<W>;