@flemist/test-variants 5.0.6 → 5.0.7

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.
@@ -1,2 +1,2 @@
1
- export { type ErrorEvent, type GenerateErrorVariantFilePathOptions, type GetSeedParams, type LimitArgOnError, type LimitArgOnErrorOptions, type ModeChangeEvent, type ModeConfig, type OnErrorCallback, type OnModeChangeCallback, type ParallelOptions, type SaveErrorVariantsOptions, type TestVariantsBestError, type FindBestErrorOptions, type TestVariantsLogOptions, type TestVariantsRunOptions, type TestVariantsResult, type TestOptions, type TestVariantsTestResult, } from './test-variants/types';
1
+ export { type ErrorEvent, type GenerateErrorVariantFilePathOptions, type GetSeedParams, type LimitArgOnError, type LimitArgOnErrorOptions, type ModeChangeEvent, type ModeConfig, type OnErrorCallback, type OnModeChangeCallback, type ParallelOptions, type SaveErrorVariantsOptions, type TestVariantsBestError, type FindBestErrorOptions, type TestVariantsLogOptions, type TestVariantsRunOptions, type TestVariantsResult, type TestVariantsState, type TestVariantsTestResult, } from './test-variants/types';
2
2
  export { createTestVariants } from './test-variants/createTestVariants';
@@ -85,7 +85,7 @@ export type TestVariantsTemplateFunc<Args extends Obj, Value> = (args: Args) =>
85
85
  export type TestVariantsTemplate<Args extends Obj, Value> = TestVariantsTemplateValues<Value> | TestVariantsTemplateFunc<Args, Value>;
86
86
  export type ArgName<Args extends Obj> = Extract<keyof Args, string>;
87
87
  export type TestVariantsTemplates<Args extends Obj> = {
88
- [key in ArgName<Args>]: TestVariantsTemplate<Args, Args[key]>;
88
+ [key in keyof Args]: TestVariantsTemplate<Args, Args[key]>;
89
89
  };
90
90
  export type TestVariantsTemplatesExtra<Args extends Obj> = {
91
91
  [key in ArgName<Args>]?: Mutable<TestVariantsTemplateValues<Args[key]>>;
@@ -109,5 +109,8 @@ export type VariantNavigationState<Args extends Obj> = {
109
109
  };
110
110
  /** Extended templates type that allows additional args beyond the base Args type */
111
111
  export type TestVariantsTemplatesExt<Args extends Obj, ArgsExtra extends Obj> = TestVariantsTemplates<{
112
- [key in ArgName<Args | ArgsExtra>]: key extends ArgName<Args> ? Args[key] : key extends ArgName<ArgsExtra> ? ArgsExtra[key] : never;
113
- }>;
112
+ [key in keyof Args | keyof ArgsExtra]: key extends keyof Args ? Args[key] : key extends keyof ArgsExtra ? ArgsExtra[key] : never;
113
+ }> & {
114
+ /** Use getSeed option instead */
115
+ seed?: never;
116
+ };
@@ -2,7 +2,7 @@ import { IAbortSignalFast, IAbortControllerFast } from '@flemist/abort-controlle
2
2
  import { Obj } from '@flemist/simple-utils';
3
3
  import { IPool } from '@flemist/time-limits';
4
4
  import { VariantsIterator } from '../iterator/types';
5
- import { TestOptions } from '../types';
5
+ import { TestVariantsState } from '../types';
6
6
  import { RunState } from './createRunState';
7
7
  import { RunOptionsResolved } from './resolveRunOptions';
8
8
  import { TestVariantsTestRun } from './types';
@@ -11,8 +11,8 @@ export type RunContext<Args extends Obj> = {
11
11
  options: RunOptionsResolved<Args>;
12
12
  testRun: TestVariantsTestRun<Args>;
13
13
  variantsIterator: VariantsIterator<Args>;
14
- testOptions: TestOptions;
15
- testOptionsParallel: TestOptions;
14
+ testOptions: TestVariantsState;
15
+ testOptionsParallel: TestVariantsState;
16
16
  abortControllerGlobal: IAbortControllerFast;
17
17
  abortControllerParallel: IAbortControllerFast;
18
18
  abortSignal: IAbortSignalFast;
@@ -1,18 +1,18 @@
1
1
  import { PromiseOrValue } from '@flemist/async-utils';
2
2
  import { Obj, RequiredNonNullable } from '@flemist/simple-utils';
3
3
  import { TestVariantsTemplatesExt, VariantsIterator } from '../iterator/types';
4
- import { ArgsWithSeed, OnErrorCallback, SaveErrorVariantsOptions, TestOptions, TestVariantsLogOptions, TestVariantsResult, TestVariantsRunOptions } from '../types';
4
+ import { ArgsWithSeed, OnErrorCallback, SaveErrorVariantsOptions, TestVariantsState, TestVariantsLogOptions, TestVariantsResult, TestVariantsRunOptions } from '../types';
5
5
  /** Result of test run (internal format with separate sync/async counts) */
6
6
  export type TestFuncResult = void | {
7
7
  iterationsAsync: number;
8
8
  iterationsSync: number;
9
9
  };
10
10
  /** Test run function (internal - wraps user's test with error handling) */
11
- export type TestVariantsTestRun<Args extends Obj> = (args: ArgsWithSeed<Args>, tests: number, options: TestOptions) => PromiseOrValue<TestFuncResult>;
11
+ export type TestVariantsTestRun<Args extends Obj> = (args: ArgsWithSeed<Args>, tests: number, options: TestVariantsState) => PromiseOrValue<TestFuncResult>;
12
12
  /** Result of user's test function (number treated as iterationsSync) */
13
13
  export type TestVariantsTestResult = number | void | TestFuncResult;
14
14
  /** User's test function */
15
- export type TestVariantsTest<Args extends Obj> = (args: ArgsWithSeed<Args>, options: TestOptions) => PromiseOrValue<TestVariantsTestResult>;
15
+ export type TestVariantsTest<Args extends Obj> = (args: ArgsWithSeed<Args>, options: TestVariantsState) => PromiseOrValue<TestVariantsTestResult>;
16
16
  /**
17
17
  * Store for saving and loading error-causing parameter combinations.
18
18
  * Node.js implementation uses file system. Browser returns null (not supported).
@@ -38,7 +38,7 @@ export type SaveErrorVariantsStoreReplayOptions<Args extends Obj> = {
38
38
  /** Iterator to add limits to */
39
39
  variantsIterator: VariantsIterator<Args>;
40
40
  /** Options passed to test function */
41
- testOptions: TestOptions;
41
+ testOptions: TestVariantsState;
42
42
  /** Whether findBestError is enabled */
43
43
  findBestErrorEnabled?: null | boolean;
44
44
  };
@@ -56,4 +56,4 @@ export type TestVariantsCreateTestRunOptions<Args extends Obj> = {
56
56
  pauseDebuggerOnError?: null | boolean;
57
57
  };
58
58
  export type TestVariantsCall<Args extends Obj> = <SavedArgs = Args>(options?: null | TestVariantsRunOptionsInternal<Args, SavedArgs>) => PromiseOrValue<TestVariantsResult<Args>>;
59
- export type TestVariantsSetArgs<Args extends Obj> = <ArgsExtra extends Obj>(args: TestVariantsTemplatesExt<Omit<Args, 'seed'>, Omit<ArgsExtra, 'seed'>>) => TestVariantsCall<Args>;
59
+ export type TestVariantsSetArgs<Args extends Obj> = <ArgsExtra extends Obj>(args: TestVariantsTemplatesExt<Omit<Args, 'seed'>, ArgsExtra>) => TestVariantsCall<Args>;
@@ -99,7 +99,7 @@ export type SaveErrorVariantsOptions<Args extends Obj, SavedArgs = Args> = {
99
99
  extendTemplates?: null | boolean;
100
100
  };
101
101
  /** Options passed to test function */
102
- export type TestOptions = {
102
+ export type TestVariantsState = {
103
103
  abortSignal: IAbortSignalFast;
104
104
  timeController: ITimeController;
105
105
  };
@@ -1,7 +1,7 @@
1
1
  import { Obj } from '@flemist/simple-utils';
2
2
  import { TestVariantsSetArgs } from '../common/test-variants/types';
3
3
  import { TestVariantsTest } from '../common/test-variants/run/types';
4
- export { type ErrorEvent, type GenerateErrorVariantFilePathOptions, type GetSeedParams, type LimitArgOnError, type LimitArgOnErrorOptions, type ModeChangeEvent, type ModeConfig, type OnErrorCallback, type OnModeChangeCallback, type SaveErrorVariantsOptions, type TestVariantsBestError, type FindBestErrorOptions, type TestVariantsLogOptions, type TestVariantsRunOptions, type TestVariantsResult, type TestOptions, type TestVariantsTestResult, } from '../common';
4
+ export { type ErrorEvent, type GenerateErrorVariantFilePathOptions, type GetSeedParams, type LimitArgOnError, type LimitArgOnErrorOptions, type ModeChangeEvent, type ModeConfig, type OnErrorCallback, type OnModeChangeCallback, type SaveErrorVariantsOptions, type TestVariantsBestError, type FindBestErrorOptions, type TestVariantsLogOptions, type TestVariantsRunOptions, type TestVariantsResult, type TestVariantsState, type TestVariantsTestResult, } from '../common';
5
5
  export type { TestVariantsSetArgs } from '../common/test-variants/types';
6
6
  export type { TestVariantsCall } from '../common/test-variants/types';
7
7
  export type { TestVariantsTemplatesExt } from '../common/test-variants/types';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@flemist/test-variants",
3
- "version": "5.0.6",
3
+ "version": "5.0.7",
4
4
  "description": "Runs a test function with all possible combinations of its parameters.",
5
5
  "sideEffects": false,
6
6
  "types": "build/common/index.d.ts",
@@ -42,6 +42,7 @@
42
42
  "default": "./src/common/index.ts"
43
43
  }
44
44
  },
45
+ "packageManager": "pnpm@10.18.3",
45
46
  "engines": {
46
47
  "node": ">=20"
47
48
  },
@@ -76,6 +77,38 @@
76
77
  "publishConfig": {
77
78
  "access": "public"
78
79
  },
80
+ "scripts": {
81
+ "========================= install =========================": "",
82
+ "_prepublishOnly": "run-p audit lint build test:all && npm login",
83
+ "prepare": "node .husky/install.mjs",
84
+ "install:playwright": "pnpm exec playwright install --with-deps",
85
+ "========================= deploy =========================": "",
86
+ "build": "vite build",
87
+ "========================= lint =========================": "",
88
+ "audit": "pnpm audit --prod",
89
+ "lint:es": "eslint .",
90
+ "lint:es:fix": "eslint --fix .",
91
+ "lint": "run-p lint:es",
92
+ "lint:fix": "run-s lint:es:fix",
93
+ "lint-staged": "lint-staged",
94
+ "check:types": "tsc --noEmit",
95
+ "check": "run-p audit check:types lint",
96
+ "========================= test =========================": "",
97
+ "test:node": "vitest --run --config vite.projects.ts --project node --bail 3",
98
+ "test:browser": "vitest --run --config vite.projects.ts --project browser --bail 3",
99
+ "test:chrome": "vitest --run --config vite.projects.ts --project browser --browser chromium --bail 3",
100
+ "test:all": "vitest --run --config vite.projects.ts --bail 3",
101
+ "test": "run-s test:node test:browser",
102
+ "========================= dev =========================": "",
103
+ "kill-node": "taskkill /F /IM node.exe",
104
+ "kill-java": "taskkill /F /IM java.exe",
105
+ "kill-chrome": "taskkill /F /IM chrome.exe",
106
+ "========================= mcp =========================": "",
107
+ "mcp:playwright": "mcp-server-playwright --port 8002 --host local.host --isolated",
108
+ "========================= other =========================": "",
109
+ "mcp:tools": "mcp-project-tools",
110
+ "dep:fix": "tsx tools/dep-fix.ts"
111
+ },
79
112
  "devDependencies": {
80
113
  "@eslint/compat": "1.2.4",
81
114
  "@eslint/eslintrc": "3.2.0",
@@ -115,35 +148,5 @@
115
148
  "@flemist/time-controller": "^1.0.4",
116
149
  "@flemist/time-limits": "^2.0.4",
117
150
  "tslib": ">=2.8.1"
118
- },
119
- "scripts": {
120
- "========================= install =========================": "",
121
- "install:playwright": "pnpm exec playwright install --with-deps",
122
- "========================= deploy =========================": "",
123
- "build": "vite build",
124
- "========================= lint =========================": "",
125
- "audit": "pnpm audit --prod",
126
- "lint:es": "eslint .",
127
- "lint:es:fix": "eslint --fix .",
128
- "lint": "run-p lint:es",
129
- "lint:fix": "run-s lint:es:fix",
130
- "lint-staged": "lint-staged",
131
- "check:types": "tsc --noEmit",
132
- "check": "run-p audit check:types lint",
133
- "========================= test =========================": "",
134
- "test:node": "vitest --run --config vite.projects.ts --project node --bail 3",
135
- "test:browser": "vitest --run --config vite.projects.ts --project browser --bail 3",
136
- "test:chrome": "vitest --run --config vite.projects.ts --project browser --browser chromium --bail 3",
137
- "test:all": "vitest --run --config vite.projects.ts --bail 3",
138
- "test": "run-s test:node test:browser",
139
- "========================= dev =========================": "",
140
- "kill-node": "taskkill /F /IM node.exe",
141
- "kill-java": "taskkill /F /IM java.exe",
142
- "kill-chrome": "taskkill /F /IM chrome.exe",
143
- "========================= mcp =========================": "",
144
- "mcp:playwright": "mcp-server-playwright --port 8002 --host local.host --isolated",
145
- "========================= other =========================": "",
146
- "mcp:tools": "mcp-project-tools",
147
- "dep:fix": "tsx tools/dep-fix.ts"
148
151
  }
149
- }
152
+ }