@dereekb/util 13.11.14 → 13.11.15
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.
- package/eslint/index.cjs.js +10008 -394
- package/eslint/index.esm.js +9982 -392
- package/eslint/package.json +4 -4
- package/eslint/src/lib/comments.d.ts +14 -3
- package/eslint/src/lib/dbx-tag-families.d.ts +280 -0
- package/eslint/src/lib/index.d.ts +26 -3
- package/eslint/src/lib/jsdoc-parser.d.ts +116 -0
- package/eslint/src/lib/no-inline-string-empty-object-intersection.rule.d.ts +44 -0
- package/eslint/src/lib/no-inline-type-import.rule.d.ts +38 -0
- package/eslint/src/lib/no-sister-re-export.rule.d.ts +69 -0
- package/eslint/src/lib/plugin.d.ts +52 -1
- package/eslint/src/lib/prefer-canonical-jsdoc.rule.d.ts +68 -0
- package/eslint/src/lib/prefer-config-object.rule.d.ts +61 -0
- package/eslint/src/lib/prefer-maybe-type.rule.d.ts +72 -0
- package/eslint/src/lib/prefer-no-side-effects-in-jsdoc.rule.d.ts +1 -1
- package/eslint/src/lib/prefer-suggested-string.rule.d.ts +51 -0
- package/eslint/src/lib/require-constant-naming.rule.d.ts +63 -0
- package/eslint/src/lib/require-dbx-action-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-auth-companion-tags.rule.d.ts +45 -0
- package/eslint/src/lib/require-dbx-docs-ui-example-companion-tags.rule.d.ts +42 -0
- package/eslint/src/lib/require-dbx-filter-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-form-field-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-companion-tags.rule.d.ts +46 -0
- package/eslint/src/lib/require-dbx-model-firebase-index-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-model-snapshot-field-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-pipe-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-dbx-rule-companion-tags.rule.d.ts +44 -0
- package/eslint/src/lib/require-dbx-util-companion-tags.rule.d.ts +74 -0
- package/eslint/src/lib/require-dbx-web-companion-tags.rule.d.ts +43 -0
- package/eslint/src/lib/require-default-prefix-naming.rule.d.ts +60 -0
- package/eslint/src/lib/require-deprecated-alias-placement.rule.d.ts +75 -0
- package/eslint/src/lib/require-exported-jsdoc-example.rule.d.ts +61 -0
- package/eslint/src/lib/require-no-side-effects.rule.d.ts +1 -1
- package/eslint/src/lib/require-readonly-config-params.rule.d.ts +57 -0
- package/eslint/src/lib/require-single-return.rule.d.ts +42 -0
- package/fetch/index.cjs.js +95 -80
- package/fetch/index.esm.js +95 -80
- package/fetch/package.json +2 -2
- package/fetch/src/lib/error.d.ts +2 -2
- package/fetch/src/lib/fetch.d.ts +15 -15
- package/fetch/src/lib/fetch.file.d.ts +5 -5
- package/fetch/src/lib/fetch.limit.d.ts +2 -2
- package/fetch/src/lib/fetch.page.d.ts +1 -1
- package/fetch/src/lib/fetch.page.iterate.d.ts +4 -4
- package/fetch/src/lib/fetch.type.d.ts +3 -2
- package/fetch/src/lib/fetch.url.d.ts +13 -13
- package/fetch/src/lib/json.d.ts +12 -12
- package/fetch/src/lib/timeout.d.ts +2 -2
- package/fetch/src/lib/url.d.ts +11 -11
- package/index.cjs.js +2592 -2329
- package/index.esm.js +2590 -2327
- package/package.json +1 -1
- package/src/lib/array/array.boolean.d.ts +20 -20
- package/src/lib/array/array.d.ts +73 -72
- package/src/lib/array/array.factory.d.ts +8 -5
- package/src/lib/array/array.filter.d.ts +23 -20
- package/src/lib/array/array.find.d.ts +9 -8
- package/src/lib/array/array.index.d.ts +15 -14
- package/src/lib/array/array.indexed.d.ts +22 -19
- package/src/lib/array/array.make.d.ts +3 -2
- package/src/lib/array/array.map.d.ts +5 -5
- package/src/lib/array/array.number.d.ts +27 -27
- package/src/lib/array/array.random.d.ts +11 -10
- package/src/lib/array/array.set.d.ts +14 -14
- package/src/lib/array/array.string.d.ts +31 -31
- package/src/lib/array/array.unique.d.ts +22 -20
- package/src/lib/array/array.value.d.ts +3 -2
- package/src/lib/assertion/assert.error.d.ts +8 -8
- package/src/lib/assertion/assertion.d.ts +5 -5
- package/src/lib/assertion/assertion.generic.d.ts +3 -3
- package/src/lib/assertion/assertion.number.d.ts +6 -6
- package/src/lib/auth/auth.role.claims.d.ts +12 -11
- package/src/lib/auth/auth.role.d.ts +3 -3
- package/src/lib/auth/pkce.d.ts +2 -2
- package/src/lib/boolean.d.ts +11 -11
- package/src/lib/cache/cache.memoize.d.ts +6 -6
- package/src/lib/contact/domain.d.ts +9 -9
- package/src/lib/contact/email.d.ts +11 -11
- package/src/lib/contact/phone.d.ts +12 -12
- package/src/lib/contact/random.d.ts +11 -9
- package/src/lib/date/date.d.ts +60 -59
- package/src/lib/date/date.time.d.ts +2 -2
- package/src/lib/date/date.unix.d.ts +8 -8
- package/src/lib/date/duration.d.ts +17 -17
- package/src/lib/date/expires.d.ts +29 -27
- package/src/lib/date/hour.d.ts +23 -23
- package/src/lib/date/minute.d.ts +6 -6
- package/src/lib/date/time.d.ts +10 -9
- package/src/lib/date/week.d.ts +32 -31
- package/src/lib/encryption/encryption.object.d.ts +3 -3
- package/src/lib/error/error.d.ts +13 -12
- package/src/lib/error/error.server.d.ts +4 -4
- package/src/lib/file/pdf.d.ts +4 -4
- package/src/lib/filter/filter.d.ts +3 -2
- package/src/lib/function/function.boolean.d.ts +4 -3
- package/src/lib/function/function.forward.d.ts +6 -4
- package/src/lib/getter/getter.d.ts +24 -19
- package/src/lib/getter/getter.map.d.ts +6 -5
- package/src/lib/getter/getter.util.d.ts +3 -2
- package/src/lib/grouping.d.ts +25 -24
- package/src/lib/hash.d.ts +11 -10
- package/src/lib/iterable/iterable.d.ts +39 -39
- package/src/lib/iterable/iterable.map.d.ts +3 -3
- package/src/lib/key.d.ts +16 -16
- package/src/lib/map/map.d.ts +12 -12
- package/src/lib/map/map.intersection.d.ts +3 -3
- package/src/lib/map/map.key.d.ts +16 -14
- package/src/lib/misc/host.d.ts +2 -2
- package/src/lib/model/id.batch.d.ts +4 -3
- package/src/lib/model/id.factory.d.ts +4 -3
- package/src/lib/model/model.conversion.d.ts +19 -14
- package/src/lib/model/model.conversion.field.d.ts +2 -2
- package/src/lib/model/model.copy.d.ts +5 -4
- package/src/lib/model/model.d.ts +48 -46
- package/src/lib/model/model.modify.d.ts +10 -8
- package/src/lib/nodejs/stream.d.ts +6 -5
- package/src/lib/number/bitwise.dencoder.d.ts +12 -12
- package/src/lib/number/bound.d.ts +16 -13
- package/src/lib/number/dollar.d.ts +6 -5
- package/src/lib/number/encoded.d.ts +7 -7
- package/src/lib/number/factory.d.ts +4 -3
- package/src/lib/number/number.d.ts +37 -37
- package/src/lib/number/random.d.ts +11 -10
- package/src/lib/number/round.d.ts +34 -30
- package/src/lib/number/sort.d.ts +3 -2
- package/src/lib/number/transform.d.ts +5 -4
- package/src/lib/object/object.array.d.ts +6 -6
- package/src/lib/object/object.array.delta.d.ts +3 -2
- package/src/lib/object/object.d.ts +12 -12
- package/src/lib/object/object.empty.d.ts +3 -3
- package/src/lib/object/object.equal.d.ts +11 -10
- package/src/lib/object/object.filter.pojo.d.ts +74 -74
- package/src/lib/object/object.filter.tuple.d.ts +26 -26
- package/src/lib/object/object.flatten.d.ts +4 -4
- package/src/lib/object/object.key.d.ts +6 -4
- package/src/lib/object/object.map.d.ts +15 -13
- package/src/lib/page/page.d.ts +5 -5
- package/src/lib/page/page.filter.d.ts +8 -8
- package/src/lib/path/path.d.ts +98 -88
- package/src/lib/promise/callback.d.ts +2 -2
- package/src/lib/promise/is.d.ts +6 -6
- package/src/lib/promise/poll.d.ts +9 -9
- package/src/lib/promise/promise.d.ts +33 -30
- package/src/lib/promise/promise.factory.d.ts +4 -3
- package/src/lib/promise/promise.loop.d.ts +11 -11
- package/src/lib/promise/promise.task.d.ts +6 -5
- package/src/lib/promise/promise.type.d.ts +3 -3
- package/src/lib/promise/use.d.ts +3 -3
- package/src/lib/relation/relation.d.ts +15 -15
- package/src/lib/service/handler.config.d.ts +20 -16
- package/src/lib/service/handler.d.ts +3 -2
- package/src/lib/service/typed.service.d.ts +2 -2
- package/src/lib/set/set.d.ts +62 -59
- package/src/lib/set/set.delta.d.ts +5 -4
- package/src/lib/set/set.hashset.d.ts +5 -5
- package/src/lib/set/set.selection.d.ts +5 -4
- package/src/lib/sort.d.ts +11 -11
- package/src/lib/storage/storage.d.ts +2 -1
- package/src/lib/storage/storage.error.d.ts +4 -4
- package/src/lib/storage/storage.memory.d.ts +7 -7
- package/src/lib/storage/storage.object.d.ts +5 -5
- package/src/lib/string/case.d.ts +6 -6
- package/src/lib/string/char.d.ts +30 -29
- package/src/lib/string/dencoder.d.ts +25 -20
- package/src/lib/string/factory.d.ts +11 -8
- package/src/lib/string/html.d.ts +19 -19
- package/src/lib/string/mimetype.d.ts +9 -8
- package/src/lib/string/prefix.d.ts +8 -8
- package/src/lib/string/replace.d.ts +45 -39
- package/src/lib/string/search.d.ts +5 -4
- package/src/lib/string/sort.d.ts +13 -4
- package/src/lib/string/string.d.ts +44 -43
- package/src/lib/string/transform.d.ts +32 -23
- package/src/lib/string/tree.d.ts +5 -4
- package/src/lib/string/url.d.ts +5 -4
- package/src/lib/tree/tree.array.d.ts +5 -4
- package/src/lib/tree/tree.expand.d.ts +6 -6
- package/src/lib/tree/tree.explore.d.ts +13 -10
- package/src/lib/tree/tree.flatten.d.ts +10 -10
- package/src/lib/type.d.ts +42 -12
- package/src/lib/value/address.d.ts +7 -7
- package/src/lib/value/bound.d.ts +70 -66
- package/src/lib/value/build.d.ts +6 -6
- package/src/lib/value/comparator.d.ts +19 -17
- package/src/lib/value/cron.d.ts +2 -2
- package/src/lib/value/decision.d.ts +6 -5
- package/src/lib/value/equal.d.ts +11 -9
- package/src/lib/value/indexed.d.ts +101 -85
- package/src/lib/value/label.d.ts +2 -2
- package/src/lib/value/map.d.ts +20 -16
- package/src/lib/value/maybe.d.ts +36 -36
- package/src/lib/value/modifier.d.ts +24 -23
- package/src/lib/value/point.d.ts +85 -77
- package/src/lib/value/url.d.ts +2 -2
- package/src/lib/value/use.d.ts +36 -33
- package/src/lib/value/vector.d.ts +15 -14
- package/test/index.cjs.js +41 -36
- package/test/index.esm.js +41 -36
- package/test/package.json +2 -2
- package/test/src/lib/jest/jest.fail.d.ts +2 -2
- package/test/src/lib/shared/shared.d.ts +20 -20
- package/test/src/lib/shared/shared.fail.d.ts +21 -16
- package/test/src/lib/shared/shared.function.d.ts +4 -4
- package/test/src/lib/shared/shared.wrap.d.ts +10 -10
package/test/index.cjs.js
CHANGED
|
@@ -219,8 +219,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
219
219
|
/**
|
|
220
220
|
* Passes the error to the TestDoneCallback.
|
|
221
221
|
*
|
|
222
|
-
* @param done -
|
|
223
|
-
* @param e -
|
|
222
|
+
* @param done - The test framework's done callback to signal completion or failure.
|
|
223
|
+
* @param e - The error to pass to the callback; defaults to a generic error.
|
|
224
224
|
*/ function failWithTestDoneCallback(done) {
|
|
225
225
|
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Error('failed test');
|
|
226
226
|
if (done.fail != null) {
|
|
@@ -234,7 +234,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
234
234
|
*
|
|
235
235
|
* Used to create a promise reference that can be used to assert that a test function was called.
|
|
236
236
|
*
|
|
237
|
-
* @returns
|
|
237
|
+
* @returns A new {@link TestDoneCallbackRef} with a done callback and underlying promise.
|
|
238
238
|
*/ function testDoneCallbackRef() {
|
|
239
239
|
var _promise = util.promiseReference();
|
|
240
240
|
var done = function done(e) {
|
|
@@ -256,22 +256,22 @@ function _ts_generator$2(thisArg, body) {
|
|
|
256
256
|
*
|
|
257
257
|
* This also supports calling the input test with async, but still only returns when done is called.
|
|
258
258
|
*
|
|
259
|
-
* @
|
|
259
|
+
* @param testFn - The callback-based test function that receives a done callback.
|
|
260
|
+
* @returns Promise-based wrapper function suitable for Vitest or other async test runners.
|
|
260
261
|
*
|
|
262
|
+
* @example
|
|
263
|
+
* ```ts
|
|
261
264
|
* // Before (Jasmine/Jest style):
|
|
262
265
|
* it('test name', (done) => {
|
|
263
266
|
* // async test code
|
|
264
267
|
* done();
|
|
265
268
|
* });
|
|
266
|
-
*
|
|
267
269
|
* // After (Vitest compatible):
|
|
268
270
|
* it('test name', callbackTest((done) => {
|
|
269
271
|
* // async test code
|
|
270
272
|
* done();
|
|
271
273
|
* }));
|
|
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
|
|
274
|
+
* ```
|
|
275
275
|
*/ function callbackTest(testFn) {
|
|
276
276
|
return function() {
|
|
277
277
|
return _async_to_generator$2(function() {
|
|
@@ -341,8 +341,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
341
341
|
/**
|
|
342
342
|
* Creates a TestContextBuilderFunction given the input builder.
|
|
343
343
|
*
|
|
344
|
-
* @param builder -
|
|
345
|
-
* @returns
|
|
344
|
+
* @param builder - Configuration defining how to build configs, fixtures, and manage instance lifecycle.
|
|
345
|
+
* @returns A builder function that accepts optional partial config and produces a {@link TestContextFactory}
|
|
346
346
|
*/ function testContextBuilder(builder) {
|
|
347
347
|
return function(inputConfig) {
|
|
348
348
|
var config = builder.buildConfig(inputConfig);
|
|
@@ -380,7 +380,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
380
380
|
* Before each test, a new instance is created and set on the fixture. After each test, the instance
|
|
381
381
|
* is cleared and optionally destroyed. Test declarations happen synchronously between the hooks.
|
|
382
382
|
*
|
|
383
|
-
* @param config -
|
|
383
|
+
* @param config - Fixture, test builder, and instance lifecycle functions.
|
|
384
384
|
*/ function useTestContextFixture(config) {
|
|
385
385
|
var buildTests = config.buildTests, fixture = config.fixture, initInstance = config.initInstance, destroyInstance = config.destroyInstance;
|
|
386
386
|
var clearInstance = null;
|
|
@@ -703,8 +703,8 @@ function _ts_generator$1(thisArg, body) {
|
|
|
703
703
|
/**
|
|
704
704
|
* Wraps the input TestContextFactory to emit another type of Fixture for tests.
|
|
705
705
|
*
|
|
706
|
-
* @param config -
|
|
707
|
-
* @returns
|
|
706
|
+
* @param config - Configuration specifying how to wrap fixtures and optional setup/teardown hooks.
|
|
707
|
+
* @returns Transforms a {@link TestContextFactory} of type `F` into one of type `W`
|
|
708
708
|
*/ function wrapTestContextFactory(config) {
|
|
709
709
|
return function(factory) {
|
|
710
710
|
return function(buildTests) {
|
|
@@ -766,8 +766,8 @@ function _ts_generator$1(thisArg, body) {
|
|
|
766
766
|
* Built on top of {@link wrapTestContextFactory}, this variant automatically creates, sets, and tears down
|
|
767
767
|
* an instance on the wrapped fixture for each test, using the provided {@link InstanceWrapTestContextConfig}.
|
|
768
768
|
*
|
|
769
|
-
* @param config -
|
|
770
|
-
* @returns
|
|
769
|
+
* @param config - Configuration for wrapping the fixture and managing instance lifecycle.
|
|
770
|
+
* @returns Transforms a {@link TestContextFactory} of type `F` into one of type `W`
|
|
771
771
|
*/ function instanceWrapTestContextFactory(config) {
|
|
772
772
|
return wrapTestContextFactory({
|
|
773
773
|
wrapFixture: config.wrapFixture,
|
|
@@ -838,8 +838,8 @@ function _ts_generator$1(thisArg, body) {
|
|
|
838
838
|
* The forwarded function delegates to the getter at call time, so the underlying implementation
|
|
839
839
|
* can change between tests while test declarations remain stable.
|
|
840
840
|
*
|
|
841
|
-
* @param config -
|
|
842
|
-
* @param buildTests -
|
|
841
|
+
* @param config - Provides the getter for the function under test.
|
|
842
|
+
* @param buildTests - Declares test cases using the forwarded function.
|
|
843
843
|
*/ function useTestFunctionFixture(config, buildTests) {
|
|
844
844
|
var fn = config.fn;
|
|
845
845
|
var forward = util.forwardFunction(fn);
|
|
@@ -851,8 +851,8 @@ function _ts_generator$1(thisArg, body) {
|
|
|
851
851
|
* Similar to {@link useTestFunctionFixture} but operates on a map of functions, allowing tests
|
|
852
852
|
* to be declared against multiple related function implementations at once.
|
|
853
853
|
*
|
|
854
|
-
* @param config -
|
|
855
|
-
* @param buildTests -
|
|
854
|
+
* @param config - Provides getters for each named function under test.
|
|
855
|
+
* @param buildTests - Declares test cases using the map of forwarded functions.
|
|
856
856
|
*/ function useTestFunctionMapFixture(config, buildTests) {
|
|
857
857
|
var forwardedFunctions = util.mapObjectMap(config.fns, function(fn) {
|
|
858
858
|
return util.forwardFunction(fn);
|
|
@@ -1082,8 +1082,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1082
1082
|
/**
|
|
1083
1083
|
* Creates an {@link ExpectedFailError} without throwing it, for use in deferred error handling.
|
|
1084
1084
|
*
|
|
1085
|
-
* @param message -
|
|
1086
|
-
* @returns
|
|
1085
|
+
* @param message - Optional error message.
|
|
1086
|
+
* @returns A new {@link ExpectedFailError} instance.
|
|
1087
1087
|
*/ function failSuccessfullyError(message) {
|
|
1088
1088
|
return new ExpectedFailError(message);
|
|
1089
1089
|
}
|
|
@@ -1094,7 +1094,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1094
1094
|
* which catch `ExpectedFailError` and convert it into a passing test. Calling it inside a plain
|
|
1095
1095
|
* `it()` block causes the test to fail because the error propagates uncaught.
|
|
1096
1096
|
*
|
|
1097
|
-
* @param message -
|
|
1097
|
+
* @param message - Optional error message.
|
|
1098
|
+
* @throws {ExpectedFailError} Always; never returns normally.
|
|
1098
1099
|
*/ function failSuccessfully(message) {
|
|
1099
1100
|
throw failSuccessfullyError(message);
|
|
1100
1101
|
}
|
|
@@ -1111,8 +1112,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1111
1112
|
/**
|
|
1112
1113
|
* Creates an {@link UnexpectedSuccessFailureError} without throwing it.
|
|
1113
1114
|
*
|
|
1114
|
-
* @param message -
|
|
1115
|
-
* @returns
|
|
1115
|
+
* @param message - Optional error message; defaults to a standard "expected an error" message.
|
|
1116
|
+
* @returns A new {@link UnexpectedSuccessFailureError} instance.
|
|
1116
1117
|
*/ function failDueToSuccessError(message) {
|
|
1117
1118
|
return new UnexpectedSuccessFailureError(message !== null && message !== void 0 ? message : 'expected an error to occur but was successful instead');
|
|
1118
1119
|
}
|
|
@@ -1136,13 +1137,16 @@ function _ts_generator(thisArg, body) {
|
|
|
1136
1137
|
* Fails the current test by throwing an {@link UnexpectedSuccessFailureError}.
|
|
1137
1138
|
* Use when a code path should not have been reached.
|
|
1138
1139
|
*
|
|
1139
|
-
* @param message -
|
|
1140
|
+
* @param message - Optional error message.
|
|
1141
|
+
* @throws {UnexpectedSuccessFailureError} Always; never returns normally.
|
|
1140
1142
|
*/ function failTest(message) {
|
|
1141
1143
|
throw failDueToSuccessError(message);
|
|
1142
1144
|
}
|
|
1143
1145
|
/**
|
|
1144
1146
|
* Throws an {@link UnexpectedSuccessFailureError} with a default message.
|
|
1145
1147
|
* Typically called when an operation succeeds but was expected to throw.
|
|
1148
|
+
*
|
|
1149
|
+
* @throws {UnexpectedSuccessFailureError} Always; never returns normally.
|
|
1146
1150
|
*/ function failDueToSuccess() {
|
|
1147
1151
|
throw failDueToSuccessError();
|
|
1148
1152
|
}
|
|
@@ -1150,7 +1154,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1150
1154
|
* Default error handler for {@link expectSuccessfulFail} that passes through {@link ExpectedFailError}
|
|
1151
1155
|
* instances and re-throws all other errors.
|
|
1152
1156
|
*
|
|
1153
|
-
* @param e -
|
|
1157
|
+
* @param e - The caught error to evaluate.
|
|
1158
|
+
* @throws {unknown} Re-throws the supplied error when it is not an {@link ExpectedFailError}.
|
|
1154
1159
|
*/ function EXPECT_ERROR_DEFAULT_HANDLER(e) {
|
|
1155
1160
|
if (_instanceof(e, ExpectedFailError)) ; else {
|
|
1156
1161
|
throw e;
|
|
@@ -1161,8 +1166,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1161
1166
|
*
|
|
1162
1167
|
* Throws an ExpectedErrorOfSpecificTypeError on failures.
|
|
1163
1168
|
*
|
|
1164
|
-
* @param expectedType -
|
|
1165
|
-
* @returns
|
|
1169
|
+
* @param expectedType - The class or constructor function that the error should be an instance of.
|
|
1170
|
+
* @returns An assertion function that validates the error type via instanceof.
|
|
1166
1171
|
*/ function expectFailAssertErrorType(expectedType) {
|
|
1167
1172
|
return function(error) {
|
|
1168
1173
|
if (!_instanceof(error, expectedType)) {
|
|
@@ -1178,9 +1183,9 @@ function _ts_generator(thisArg, body) {
|
|
|
1178
1183
|
* the thrown `ExpectedFailError` propagates and fails the test even though `errorFn` rejected
|
|
1179
1184
|
* as expected — for that case use vitest's `await expect(...).rejects.toThrow(...)` instead.
|
|
1180
1185
|
*
|
|
1181
|
-
* @param errorFn -
|
|
1182
|
-
* @param assertFailType -
|
|
1183
|
-
* @returns
|
|
1186
|
+
* @param errorFn - Function expected to throw an error (sync or async)
|
|
1187
|
+
* @param assertFailType - Optional assertion to validate the type or content of the thrown error.
|
|
1188
|
+
* @returns Rejects with {@link ExpectedFailError} when the expected failure is verified, or with {@link UnexpectedSuccessFailureError} when `errorFn` resolves successfully.
|
|
1184
1189
|
*
|
|
1185
1190
|
* @example
|
|
1186
1191
|
* ```ts
|
|
@@ -1237,8 +1242,8 @@ function expectSuccessfulFail(errorFn) {
|
|
|
1237
1242
|
*
|
|
1238
1243
|
* This is typically used in conjunction with failSuccessfully(), expectSuccessfulFail(), or expectFail().
|
|
1239
1244
|
*
|
|
1240
|
-
* @param fn -
|
|
1241
|
-
* @returns
|
|
1245
|
+
* @param fn - The test function that is expected to throw an {@link ExpectedFailError}
|
|
1246
|
+
* @returns An async test function suitable for use with `it()`
|
|
1242
1247
|
*/ function shouldFail(fn) {
|
|
1243
1248
|
var usesDoneCallback = fn.length > 0;
|
|
1244
1249
|
// Return a function that checks arguments at runtime to avoid done callback deprecation warning
|
|
@@ -1309,7 +1314,7 @@ function itShouldFail(describeOrFn, fn) {
|
|
|
1309
1314
|
* Calling the returned function with no arguments resolves the promise;
|
|
1310
1315
|
* calling it with an error (or calling `.fail()`) rejects the promise.
|
|
1311
1316
|
*
|
|
1312
|
-
* @returns
|
|
1317
|
+
* @returns A new {@link FakeDoneHandler} backed by a promise reference.
|
|
1313
1318
|
*/ function fakeDoneHandler() {
|
|
1314
1319
|
var promiseRef = util.promiseReference();
|
|
1315
1320
|
var doneHandler = promiseRef.resolve;
|
|
@@ -1513,9 +1518,9 @@ function _is_native_reflect_construct() {
|
|
|
1513
1518
|
return JestExpectedErrorOfSpecificTypeError;
|
|
1514
1519
|
}(ExpectedErrorOfSpecificTypeError);
|
|
1515
1520
|
/**
|
|
1516
|
-
* @
|
|
1521
|
+
* @param done - The test done callback to invoke with the failure error.
|
|
1517
1522
|
*
|
|
1518
|
-
* @
|
|
1523
|
+
* @deprecated Use failWithTestDoneCallback with failDueToSuccessError from shared instead. This is kept for backwards compatibility.
|
|
1519
1524
|
*/ function failWithDoneDueToSuccess(done) {
|
|
1520
1525
|
failWithTestDoneCallback(done, failDueToSuccessError());
|
|
1521
1526
|
}
|
package/test/index.esm.js
CHANGED
|
@@ -217,8 +217,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
217
217
|
/**
|
|
218
218
|
* Passes the error to the TestDoneCallback.
|
|
219
219
|
*
|
|
220
|
-
* @param done -
|
|
221
|
-
* @param e -
|
|
220
|
+
* @param done - The test framework's done callback to signal completion or failure.
|
|
221
|
+
* @param e - The error to pass to the callback; defaults to a generic error.
|
|
222
222
|
*/ function failWithTestDoneCallback(done) {
|
|
223
223
|
var e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new Error('failed test');
|
|
224
224
|
if (done.fail != null) {
|
|
@@ -232,7 +232,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
232
232
|
*
|
|
233
233
|
* Used to create a promise reference that can be used to assert that a test function was called.
|
|
234
234
|
*
|
|
235
|
-
* @returns
|
|
235
|
+
* @returns A new {@link TestDoneCallbackRef} with a done callback and underlying promise.
|
|
236
236
|
*/ function testDoneCallbackRef() {
|
|
237
237
|
var _promise = promiseReference();
|
|
238
238
|
var done = function done(e) {
|
|
@@ -254,22 +254,22 @@ function _ts_generator$2(thisArg, body) {
|
|
|
254
254
|
*
|
|
255
255
|
* This also supports calling the input test with async, but still only returns when done is called.
|
|
256
256
|
*
|
|
257
|
-
* @
|
|
257
|
+
* @param testFn - The callback-based test function that receives a done callback.
|
|
258
|
+
* @returns Promise-based wrapper function suitable for Vitest or other async test runners.
|
|
258
259
|
*
|
|
260
|
+
* @example
|
|
261
|
+
* ```ts
|
|
259
262
|
* // Before (Jasmine/Jest style):
|
|
260
263
|
* it('test name', (done) => {
|
|
261
264
|
* // async test code
|
|
262
265
|
* done();
|
|
263
266
|
* });
|
|
264
|
-
*
|
|
265
267
|
* // After (Vitest compatible):
|
|
266
268
|
* it('test name', callbackTest((done) => {
|
|
267
269
|
* // async test code
|
|
268
270
|
* done();
|
|
269
271
|
* }));
|
|
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
|
|
272
|
+
* ```
|
|
273
273
|
*/ function callbackTest(testFn) {
|
|
274
274
|
return function() {
|
|
275
275
|
return _async_to_generator$2(function() {
|
|
@@ -339,8 +339,8 @@ function _ts_generator$2(thisArg, body) {
|
|
|
339
339
|
/**
|
|
340
340
|
* Creates a TestContextBuilderFunction given the input builder.
|
|
341
341
|
*
|
|
342
|
-
* @param builder -
|
|
343
|
-
* @returns
|
|
342
|
+
* @param builder - Configuration defining how to build configs, fixtures, and manage instance lifecycle.
|
|
343
|
+
* @returns A builder function that accepts optional partial config and produces a {@link TestContextFactory}
|
|
344
344
|
*/ function testContextBuilder(builder) {
|
|
345
345
|
return function(inputConfig) {
|
|
346
346
|
var config = builder.buildConfig(inputConfig);
|
|
@@ -378,7 +378,7 @@ function _ts_generator$2(thisArg, body) {
|
|
|
378
378
|
* Before each test, a new instance is created and set on the fixture. After each test, the instance
|
|
379
379
|
* is cleared and optionally destroyed. Test declarations happen synchronously between the hooks.
|
|
380
380
|
*
|
|
381
|
-
* @param config -
|
|
381
|
+
* @param config - Fixture, test builder, and instance lifecycle functions.
|
|
382
382
|
*/ function useTestContextFixture(config) {
|
|
383
383
|
var buildTests = config.buildTests, fixture = config.fixture, initInstance = config.initInstance, destroyInstance = config.destroyInstance;
|
|
384
384
|
var clearInstance = null;
|
|
@@ -701,8 +701,8 @@ function _ts_generator$1(thisArg, body) {
|
|
|
701
701
|
/**
|
|
702
702
|
* Wraps the input TestContextFactory to emit another type of Fixture for tests.
|
|
703
703
|
*
|
|
704
|
-
* @param config -
|
|
705
|
-
* @returns
|
|
704
|
+
* @param config - Configuration specifying how to wrap fixtures and optional setup/teardown hooks.
|
|
705
|
+
* @returns Transforms a {@link TestContextFactory} of type `F` into one of type `W`
|
|
706
706
|
*/ function wrapTestContextFactory(config) {
|
|
707
707
|
return function(factory) {
|
|
708
708
|
return function(buildTests) {
|
|
@@ -764,8 +764,8 @@ function _ts_generator$1(thisArg, body) {
|
|
|
764
764
|
* Built on top of {@link wrapTestContextFactory}, this variant automatically creates, sets, and tears down
|
|
765
765
|
* an instance on the wrapped fixture for each test, using the provided {@link InstanceWrapTestContextConfig}.
|
|
766
766
|
*
|
|
767
|
-
* @param config -
|
|
768
|
-
* @returns
|
|
767
|
+
* @param config - Configuration for wrapping the fixture and managing instance lifecycle.
|
|
768
|
+
* @returns Transforms a {@link TestContextFactory} of type `F` into one of type `W`
|
|
769
769
|
*/ function instanceWrapTestContextFactory(config) {
|
|
770
770
|
return wrapTestContextFactory({
|
|
771
771
|
wrapFixture: config.wrapFixture,
|
|
@@ -836,8 +836,8 @@ function _ts_generator$1(thisArg, body) {
|
|
|
836
836
|
* The forwarded function delegates to the getter at call time, so the underlying implementation
|
|
837
837
|
* can change between tests while test declarations remain stable.
|
|
838
838
|
*
|
|
839
|
-
* @param config -
|
|
840
|
-
* @param buildTests -
|
|
839
|
+
* @param config - Provides the getter for the function under test.
|
|
840
|
+
* @param buildTests - Declares test cases using the forwarded function.
|
|
841
841
|
*/ function useTestFunctionFixture(config, buildTests) {
|
|
842
842
|
var fn = config.fn;
|
|
843
843
|
var forward = forwardFunction(fn);
|
|
@@ -849,8 +849,8 @@ function _ts_generator$1(thisArg, body) {
|
|
|
849
849
|
* Similar to {@link useTestFunctionFixture} but operates on a map of functions, allowing tests
|
|
850
850
|
* to be declared against multiple related function implementations at once.
|
|
851
851
|
*
|
|
852
|
-
* @param config -
|
|
853
|
-
* @param buildTests -
|
|
852
|
+
* @param config - Provides getters for each named function under test.
|
|
853
|
+
* @param buildTests - Declares test cases using the map of forwarded functions.
|
|
854
854
|
*/ function useTestFunctionMapFixture(config, buildTests) {
|
|
855
855
|
var forwardedFunctions = mapObjectMap(config.fns, function(fn) {
|
|
856
856
|
return forwardFunction(fn);
|
|
@@ -1080,8 +1080,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1080
1080
|
/**
|
|
1081
1081
|
* Creates an {@link ExpectedFailError} without throwing it, for use in deferred error handling.
|
|
1082
1082
|
*
|
|
1083
|
-
* @param message -
|
|
1084
|
-
* @returns
|
|
1083
|
+
* @param message - Optional error message.
|
|
1084
|
+
* @returns A new {@link ExpectedFailError} instance.
|
|
1085
1085
|
*/ function failSuccessfullyError(message) {
|
|
1086
1086
|
return new ExpectedFailError(message);
|
|
1087
1087
|
}
|
|
@@ -1092,7 +1092,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1092
1092
|
* which catch `ExpectedFailError` and convert it into a passing test. Calling it inside a plain
|
|
1093
1093
|
* `it()` block causes the test to fail because the error propagates uncaught.
|
|
1094
1094
|
*
|
|
1095
|
-
* @param message -
|
|
1095
|
+
* @param message - Optional error message.
|
|
1096
|
+
* @throws {ExpectedFailError} Always; never returns normally.
|
|
1096
1097
|
*/ function failSuccessfully(message) {
|
|
1097
1098
|
throw failSuccessfullyError(message);
|
|
1098
1099
|
}
|
|
@@ -1109,8 +1110,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1109
1110
|
/**
|
|
1110
1111
|
* Creates an {@link UnexpectedSuccessFailureError} without throwing it.
|
|
1111
1112
|
*
|
|
1112
|
-
* @param message -
|
|
1113
|
-
* @returns
|
|
1113
|
+
* @param message - Optional error message; defaults to a standard "expected an error" message.
|
|
1114
|
+
* @returns A new {@link UnexpectedSuccessFailureError} instance.
|
|
1114
1115
|
*/ function failDueToSuccessError(message) {
|
|
1115
1116
|
return new UnexpectedSuccessFailureError(message !== null && message !== void 0 ? message : 'expected an error to occur but was successful instead');
|
|
1116
1117
|
}
|
|
@@ -1134,13 +1135,16 @@ function _ts_generator(thisArg, body) {
|
|
|
1134
1135
|
* Fails the current test by throwing an {@link UnexpectedSuccessFailureError}.
|
|
1135
1136
|
* Use when a code path should not have been reached.
|
|
1136
1137
|
*
|
|
1137
|
-
* @param message -
|
|
1138
|
+
* @param message - Optional error message.
|
|
1139
|
+
* @throws {UnexpectedSuccessFailureError} Always; never returns normally.
|
|
1138
1140
|
*/ function failTest(message) {
|
|
1139
1141
|
throw failDueToSuccessError(message);
|
|
1140
1142
|
}
|
|
1141
1143
|
/**
|
|
1142
1144
|
* Throws an {@link UnexpectedSuccessFailureError} with a default message.
|
|
1143
1145
|
* Typically called when an operation succeeds but was expected to throw.
|
|
1146
|
+
*
|
|
1147
|
+
* @throws {UnexpectedSuccessFailureError} Always; never returns normally.
|
|
1144
1148
|
*/ function failDueToSuccess() {
|
|
1145
1149
|
throw failDueToSuccessError();
|
|
1146
1150
|
}
|
|
@@ -1148,7 +1152,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1148
1152
|
* Default error handler for {@link expectSuccessfulFail} that passes through {@link ExpectedFailError}
|
|
1149
1153
|
* instances and re-throws all other errors.
|
|
1150
1154
|
*
|
|
1151
|
-
* @param e -
|
|
1155
|
+
* @param e - The caught error to evaluate.
|
|
1156
|
+
* @throws {unknown} Re-throws the supplied error when it is not an {@link ExpectedFailError}.
|
|
1152
1157
|
*/ function EXPECT_ERROR_DEFAULT_HANDLER(e) {
|
|
1153
1158
|
if (_instanceof(e, ExpectedFailError)) ; else {
|
|
1154
1159
|
throw e;
|
|
@@ -1159,8 +1164,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1159
1164
|
*
|
|
1160
1165
|
* Throws an ExpectedErrorOfSpecificTypeError on failures.
|
|
1161
1166
|
*
|
|
1162
|
-
* @param expectedType -
|
|
1163
|
-
* @returns
|
|
1167
|
+
* @param expectedType - The class or constructor function that the error should be an instance of.
|
|
1168
|
+
* @returns An assertion function that validates the error type via instanceof.
|
|
1164
1169
|
*/ function expectFailAssertErrorType(expectedType) {
|
|
1165
1170
|
return function(error) {
|
|
1166
1171
|
if (!_instanceof(error, expectedType)) {
|
|
@@ -1176,9 +1181,9 @@ function _ts_generator(thisArg, body) {
|
|
|
1176
1181
|
* the thrown `ExpectedFailError` propagates and fails the test even though `errorFn` rejected
|
|
1177
1182
|
* as expected — for that case use vitest's `await expect(...).rejects.toThrow(...)` instead.
|
|
1178
1183
|
*
|
|
1179
|
-
* @param errorFn -
|
|
1180
|
-
* @param assertFailType -
|
|
1181
|
-
* @returns
|
|
1184
|
+
* @param errorFn - Function expected to throw an error (sync or async)
|
|
1185
|
+
* @param assertFailType - Optional assertion to validate the type or content of the thrown error.
|
|
1186
|
+
* @returns Rejects with {@link ExpectedFailError} when the expected failure is verified, or with {@link UnexpectedSuccessFailureError} when `errorFn` resolves successfully.
|
|
1182
1187
|
*
|
|
1183
1188
|
* @example
|
|
1184
1189
|
* ```ts
|
|
@@ -1235,8 +1240,8 @@ function expectSuccessfulFail(errorFn) {
|
|
|
1235
1240
|
*
|
|
1236
1241
|
* This is typically used in conjunction with failSuccessfully(), expectSuccessfulFail(), or expectFail().
|
|
1237
1242
|
*
|
|
1238
|
-
* @param fn -
|
|
1239
|
-
* @returns
|
|
1243
|
+
* @param fn - The test function that is expected to throw an {@link ExpectedFailError}
|
|
1244
|
+
* @returns An async test function suitable for use with `it()`
|
|
1240
1245
|
*/ function shouldFail(fn) {
|
|
1241
1246
|
var usesDoneCallback = fn.length > 0;
|
|
1242
1247
|
// Return a function that checks arguments at runtime to avoid done callback deprecation warning
|
|
@@ -1307,7 +1312,7 @@ function itShouldFail(describeOrFn, fn) {
|
|
|
1307
1312
|
* Calling the returned function with no arguments resolves the promise;
|
|
1308
1313
|
* calling it with an error (or calling `.fail()`) rejects the promise.
|
|
1309
1314
|
*
|
|
1310
|
-
* @returns
|
|
1315
|
+
* @returns A new {@link FakeDoneHandler} backed by a promise reference.
|
|
1311
1316
|
*/ function fakeDoneHandler() {
|
|
1312
1317
|
var promiseRef = promiseReference();
|
|
1313
1318
|
var doneHandler = promiseRef.resolve;
|
|
@@ -1511,9 +1516,9 @@ function _is_native_reflect_construct() {
|
|
|
1511
1516
|
return JestExpectedErrorOfSpecificTypeError;
|
|
1512
1517
|
}(ExpectedErrorOfSpecificTypeError);
|
|
1513
1518
|
/**
|
|
1514
|
-
* @
|
|
1519
|
+
* @param done - The test done callback to invoke with the failure error.
|
|
1515
1520
|
*
|
|
1516
|
-
* @
|
|
1521
|
+
* @deprecated Use failWithTestDoneCallback with failDueToSuccessError from shared instead. This is kept for backwards compatibility.
|
|
1517
1522
|
*/ function failWithDoneDueToSuccess(done) {
|
|
1518
1523
|
failWithTestDoneCallback(done, failDueToSuccessError());
|
|
1519
1524
|
}
|
package/test/package.json
CHANGED
|
@@ -37,9 +37,9 @@ export declare class JestUnexpectedSuccessFailureError extends UnexpectedSuccess
|
|
|
37
37
|
export declare class JestExpectedErrorOfSpecificTypeError extends ExpectedErrorOfSpecificTypeError {
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
|
-
* @
|
|
40
|
+
* @param done - The test done callback to invoke with the failure error.
|
|
41
41
|
*
|
|
42
|
-
* @
|
|
42
|
+
* @deprecated Use failWithTestDoneCallback with failDueToSuccessError from shared instead. This is kept for backwards compatibility.
|
|
43
43
|
*/
|
|
44
44
|
export declare function failWithDoneDueToSuccess(done: TestDoneCallback): void;
|
|
45
45
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type PromiseOrValue, type PromiseReference } from '@dereekb/util';
|
|
1
|
+
import { type Maybe, type PromiseOrValue, type PromiseReference } from '@dereekb/util';
|
|
2
2
|
/**
|
|
3
3
|
* A done callback function used by test frameworks to signal that a test has completed.
|
|
4
4
|
*
|
|
@@ -17,14 +17,14 @@ export type TestDoneCallback = ((...args: any[]) => any) & {
|
|
|
17
17
|
/**
|
|
18
18
|
* Passes the error to the TestDoneCallback.
|
|
19
19
|
*
|
|
20
|
-
* @param done -
|
|
21
|
-
* @param e -
|
|
20
|
+
* @param done - The test framework's done callback to signal completion or failure.
|
|
21
|
+
* @param e - The error to pass to the callback; defaults to a generic error.
|
|
22
22
|
*/
|
|
23
23
|
export declare function failWithTestDoneCallback(done: TestDoneCallback, e?: unknown): void;
|
|
24
24
|
/**
|
|
25
25
|
* A test function that receives a done callback to signal completion.
|
|
26
26
|
*/
|
|
27
|
-
export type TestProvidesCallbackWithDone = (cb: TestDoneCallback) => void
|
|
27
|
+
export type TestProvidesCallbackWithDone = (cb: TestDoneCallback) => Maybe<void>;
|
|
28
28
|
/**
|
|
29
29
|
* A test function that either uses a done callback or returns a promise to signal completion.
|
|
30
30
|
*/
|
|
@@ -42,7 +42,7 @@ export type TestDoneCallbackRef = Omit<TestDoneCallback, 'fail'> & {
|
|
|
42
42
|
*
|
|
43
43
|
* Used to create a promise reference that can be used to assert that a test function was called.
|
|
44
44
|
*
|
|
45
|
-
* @returns
|
|
45
|
+
* @returns A new {@link TestDoneCallbackRef} with a done callback and underlying promise.
|
|
46
46
|
*/
|
|
47
47
|
export declare function testDoneCallbackRef(): TestDoneCallbackRef;
|
|
48
48
|
/**
|
|
@@ -51,24 +51,24 @@ export declare function testDoneCallbackRef(): TestDoneCallbackRef;
|
|
|
51
51
|
*
|
|
52
52
|
* This also supports calling the input test with async, but still only returns when done is called.
|
|
53
53
|
*
|
|
54
|
-
* @
|
|
54
|
+
* @param testFn - The callback-based test function that receives a done callback.
|
|
55
|
+
* @returns Promise-based wrapper function suitable for Vitest or other async test runners.
|
|
55
56
|
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```ts
|
|
56
59
|
* // Before (Jasmine/Jest style):
|
|
57
60
|
* it('test name', (done) => {
|
|
58
61
|
* // async test code
|
|
59
62
|
* done();
|
|
60
63
|
* });
|
|
61
|
-
*
|
|
62
64
|
* // After (Vitest compatible):
|
|
63
65
|
* it('test name', callbackTest((done) => {
|
|
64
66
|
* // async test code
|
|
65
67
|
* done();
|
|
66
68
|
* }));
|
|
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
|
|
69
|
+
* ```
|
|
70
70
|
*/
|
|
71
|
-
export declare function callbackTest(testFn: TestProvidesCallbackWithDone | ((cb: TestDoneCallback) => PromiseOrValue<void
|
|
71
|
+
export declare function callbackTest(testFn: TestProvidesCallbackWithDone | ((cb: TestDoneCallback) => PromiseOrValue<Maybe<void>>)): () => Promise<void>;
|
|
72
72
|
/**
|
|
73
73
|
* A fixture instance that is generated new for each test run.
|
|
74
74
|
*/
|
|
@@ -134,35 +134,35 @@ export interface TestContextBuilderConfig<I, F extends TestContextFixture<I>, C>
|
|
|
134
134
|
/**
|
|
135
135
|
* Builds a config given the optional, partial input config. This is used across all tests.
|
|
136
136
|
*/
|
|
137
|
-
buildConfig: (config?: Partial<C>) => C;
|
|
137
|
+
readonly buildConfig: (config?: Partial<C>) => C;
|
|
138
138
|
/**
|
|
139
139
|
* Builds a new fixture to use across all encapsulated tests.
|
|
140
140
|
*/
|
|
141
|
-
buildFixture: (config: C) => F;
|
|
141
|
+
readonly buildFixture: (config: C) => F;
|
|
142
142
|
/**
|
|
143
143
|
* Arbitrary before each function, called before the instance is setup.
|
|
144
144
|
*/
|
|
145
|
-
beforeEach?: () => Promise<void>;
|
|
145
|
+
readonly beforeEach?: () => Promise<void>;
|
|
146
146
|
/**
|
|
147
147
|
* Use for building an instance.
|
|
148
148
|
*
|
|
149
149
|
* When the promise resolves it should be ready to be used by the test being executed.
|
|
150
150
|
*/
|
|
151
|
-
setupInstance: (config: C) => Promise<I>;
|
|
151
|
+
readonly setupInstance: (config: C) => Promise<I>;
|
|
152
152
|
/**
|
|
153
153
|
* Use for cleaning up the instance before the next test.
|
|
154
154
|
*/
|
|
155
|
-
teardownInstance: (instance: I, config: C) => Promise<void>;
|
|
155
|
+
readonly teardownInstance: (instance: I, config: C) => Promise<void>;
|
|
156
156
|
/**
|
|
157
157
|
* Arbitrary after each function.
|
|
158
158
|
*/
|
|
159
|
-
afterEach?: () => Promise<void>;
|
|
159
|
+
readonly afterEach?: () => Promise<void>;
|
|
160
160
|
}
|
|
161
161
|
/**
|
|
162
162
|
* Creates a TestContextBuilderFunction given the input builder.
|
|
163
163
|
*
|
|
164
|
-
* @param builder -
|
|
165
|
-
* @returns
|
|
164
|
+
* @param builder - Configuration defining how to build configs, fixtures, and manage instance lifecycle.
|
|
165
|
+
* @returns A builder function that accepts optional partial config and produces a {@link TestContextFactory}
|
|
166
166
|
*/
|
|
167
167
|
export declare function testContextBuilder<I, F extends TestContextFixture<I>, C>(builder: TestContextBuilderConfig<I, F, C>): TestContextBuilderFunction<I, F, C>;
|
|
168
168
|
/**
|
|
@@ -181,6 +181,6 @@ export interface UseContextFixture<C extends TestContextFixture<I>, I> {
|
|
|
181
181
|
* Before each test, a new instance is created and set on the fixture. After each test, the instance
|
|
182
182
|
* is cleared and optionally destroyed. Test declarations happen synchronously between the hooks.
|
|
183
183
|
*
|
|
184
|
-
* @param config -
|
|
184
|
+
* @param config - Fixture, test builder, and instance lifecycle functions.
|
|
185
185
|
*/
|
|
186
186
|
export declare function useTestContextFixture<C extends TestContextFixture<I>, I>(config: UseContextFixture<C, I>): void;
|