@flemist/test-variants 5.0.12 → 5.0.14
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/README.md +5 -0
- package/build/browser/index.cjs +1 -1
- package/build/browser/index.mjs +3 -2
- package/build/common/index.cjs +1 -1
- package/build/common/index.mjs +3 -2
- package/build/common/test-variants/-test/helpers/CallController.d.ts +1 -1
- package/build/common/test-variants/NowObservable.d.ts +13 -0
- package/build/common/test-variants/run/errorHandlers.d.ts +1 -2
- package/build/common/test-variants/run/runIterationLoop.d.ts +1 -2
- package/build/common/test-variants/run/types.d.ts +3 -2
- package/build/common/test-variants/types.d.ts +5 -2
- package/build/createTestVariants-DGrAba6p.mjs +1102 -0
- package/build/createTestVariants-DHZ0gEE2.js +4 -0
- package/build/node/index.cjs +1 -1
- package/build/node/index.mjs +7 -8
- package/package.json +3 -4
- package/build/createTestVariants-DlP_jc3m.js +0 -4
- package/build/createTestVariants-DxolnPmm.mjs +0 -1042
package/README.md
CHANGED
|
@@ -275,6 +275,11 @@ const result = await testVariants({
|
|
|
275
275
|
// Used inside testVariants instead of direct setTimeout, Date.now calls, etc
|
|
276
276
|
// Intended only for testing and debugging the test-variants library itself
|
|
277
277
|
timeController: ITimeController, // default: null - use timeControllerDefault
|
|
278
|
+
|
|
279
|
+
// Maximum duration for a single test run (milliseconds)
|
|
280
|
+
// Throws TimeoutError if exceeded
|
|
281
|
+
// Function form returns timeout per variant; null/undefined disables for that variant
|
|
282
|
+
timeout: number | ((args: Args) => number | null | undefined), // default: null - no timeout
|
|
278
283
|
})
|
|
279
284
|
|
|
280
285
|
// Result:
|
package/build/browser/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../createTestVariants-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../createTestVariants-DHZ0gEE2.js");exports.TimeoutError=e.TimeoutError;exports.createTestVariants=e.createTestVariants;
|
package/build/browser/index.mjs
CHANGED
package/build/common/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../createTestVariants-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../createTestVariants-DHZ0gEE2.js");exports.TimeoutError=e.TimeoutError;exports.createTestVariants=e.createTestVariants;
|
package/build/common/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAbortSignalFast } from '@flemist/abort-controller-fast';
|
|
2
2
|
import { TimeControllerMock } from '@flemist/time-controller';
|
|
3
|
-
import { PromiseOrValue } from '@flemist/
|
|
3
|
+
import { PromiseOrValue } from '@flemist/simple-utils';
|
|
4
4
|
import { TestFuncResult } from '../../run/types';
|
|
5
5
|
/**
|
|
6
6
|
* Emulates test function call with sync/async behavior
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { IObservable } from '@flemist/simple-utils';
|
|
2
|
+
import { ITimeController } from '@flemist/time-controller';
|
|
3
|
+
export declare class NowObservable implements IObservable<number> {
|
|
4
|
+
private readonly _timeController;
|
|
5
|
+
private readonly _subject;
|
|
6
|
+
private _interval;
|
|
7
|
+
private _timer;
|
|
8
|
+
constructor(interval: number, timeController?: null | ITimeController);
|
|
9
|
+
private update;
|
|
10
|
+
get interval(): number;
|
|
11
|
+
set interval(value: number);
|
|
12
|
+
subscribe(callback: (value: number) => void): () => void;
|
|
13
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { PromiseOrValue } from '@flemist/
|
|
2
|
-
import { Obj, RequiredNonNullable } from '@flemist/simple-utils';
|
|
1
|
+
import { Obj, PromiseOrValue, RequiredNonNullable } from '@flemist/simple-utils';
|
|
3
2
|
import { TestVariantsTemplatesExt, VariantsIterator } from '../iterator/types';
|
|
4
3
|
import { ArgsWithSeed, OnErrorCallback, OnTestEndCallback, OnTestStartCallback, SaveErrorVariantsOptions, TestVariantsState, TestVariantsLogOptions, TestVariantsResult, TestVariantsRunOptions } from '../types';
|
|
5
4
|
/** Result of test run (internal format with separate sync/async counts) */
|
|
@@ -56,6 +55,8 @@ export type TestVariantsCreateTestRunOptions<Args extends Obj> = {
|
|
|
56
55
|
log: RequiredNonNullable<TestVariantsLogOptions>;
|
|
57
56
|
/** Pause debugger on error */
|
|
58
57
|
pauseDebuggerOnError?: null | boolean;
|
|
58
|
+
/** Throws TimeoutError if single test run exceeds this timeout. Minimum is 100ms */
|
|
59
|
+
timeout?: null | number | ((args: Args) => number | null | undefined);
|
|
59
60
|
};
|
|
60
61
|
export type TestVariantsCall<Args extends Obj> = <SavedArgs = Args>(options?: null | TestVariantsRunOptionsInternal<Args, SavedArgs>) => PromiseOrValue<TestVariantsResult<Args>>;
|
|
61
62
|
export type TestVariantsSetArgs<Args extends Obj> = <ArgsExtra extends Obj>(args: TestVariantsTemplatesExt<Omit<Args, 'seed'>, ArgsExtra>) => TestVariantsCall<Args>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IAbortSignalFast } from '@flemist/abort-controller-fast';
|
|
2
|
-
import { PromiseOrValue } from '@flemist/
|
|
3
|
-
import { Obj } from '@flemist/simple-utils';
|
|
2
|
+
import { Obj, PromiseOrValue } from '@flemist/simple-utils';
|
|
4
3
|
import { ITimeController } from '@flemist/time-controller';
|
|
5
4
|
import { TestFuncResult } from './run/types';
|
|
6
5
|
export type { TestVariantsTemplatesExt } from './iterator/types';
|
|
@@ -213,4 +212,8 @@ export type TestVariantsRunOptions<Args extends Obj = Obj, SavedArgs = Args> = {
|
|
|
213
212
|
limitTime?: null | number;
|
|
214
213
|
/** Time controller for testable time-dependent operations; null uses timeControllerDefault */
|
|
215
214
|
timeController?: null | ITimeController;
|
|
215
|
+
/** Throws TimeoutError if single test run exceeds this timeout. Minimum is 100ms */
|
|
216
|
+
timeout?: null | number | ((args: Args) => number | null | undefined);
|
|
216
217
|
};
|
|
218
|
+
export declare class TimeoutError extends Error {
|
|
219
|
+
}
|