@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 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:
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../createTestVariants-DlP_jc3m.js");exports.createTestVariants=e.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;
@@ -1,4 +1,5 @@
1
- import { c as r } from "../createTestVariants-DxolnPmm.mjs";
1
+ import { T as e, c as t } from "../createTestVariants-DGrAba6p.mjs";
2
2
  export {
3
- r as createTestVariants
3
+ e as TimeoutError,
4
+ t as createTestVariants
4
5
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../createTestVariants-DlP_jc3m.js");exports.createTestVariants=e.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;
@@ -1,4 +1,5 @@
1
- import { c as r } from "../createTestVariants-DxolnPmm.mjs";
1
+ import { T as e, c as t } from "../createTestVariants-DGrAba6p.mjs";
2
2
  export {
3
- r as createTestVariants
3
+ e as TimeoutError,
4
+ t as createTestVariants
4
5
  };
@@ -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/async-utils';
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/async-utils';
2
- import { Obj } from '@flemist/simple-utils';
1
+ import { Obj, PromiseOrValue } from '@flemist/simple-utils';
3
2
  import { ArgsWithSeed } from '../types';
4
3
  import { RunContext } from './RunContext';
5
4
  /**
@@ -1,5 +1,4 @@
1
- import { PromiseOrValue } from '@flemist/async-utils';
2
- import { Obj } from '@flemist/simple-utils';
1
+ import { Obj, PromiseOrValue } from '@flemist/simple-utils';
3
2
  import { RunContext } from './RunContext';
4
3
  /**
5
4
  * Main iteration loop with sync mode optimization.
@@ -1,5 +1,4 @@
1
- import { PromiseOrValue } from '@flemist/async-utils';
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/async-utils';
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
+ }