@fliwright/vitest 0.0.0-stage → 0.1.0
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/LICENSE +21 -0
- package/README.md +14 -2
- package/dist/AttemptContext.d.ts +73 -0
- package/dist/AttemptContext.js +296 -0
- package/dist/FinalizationBudget.d.ts +15 -0
- package/dist/FinalizationBudget.js +57 -0
- package/dist/RecoveryReporter.d.ts +6 -0
- package/dist/RecoveryReporter.js +15 -0
- package/dist/TaskEndpointLease.d.ts +8 -0
- package/dist/TaskEndpointLease.js +28 -0
- package/dist/TestRegistration.d.ts +8 -0
- package/dist/TestRegistration.js +52 -0
- package/dist/index.d.ts +96 -0
- package/dist/index.js +658 -0
- package/dist/preset.d.ts +17 -0
- package/dist/preset.js +28 -0
- package/dist/reporter.d.ts +5 -0
- package/dist/reporter.js +20 -0
- package/dist/runner.d.ts +24 -0
- package/dist/runner.js +322 -0
- package/dist/setup.d.ts +7 -0
- package/dist/setup.js +15 -0
- package/package.json +58 -3
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { afterAll, beforeAll, describe } from 'vitest';
|
|
2
|
+
import { AgentRuntime, AssertRuntime, AiRuntime, Assertion, FliwrightDriver, FlowRuntime, MockRuntime, TimelineArtifactStore } from '@fliwright/core';
|
|
3
|
+
import type { AiRuntimeConfig, AgentPolicy, FliwrightLogger, FliwrightLogLevel, FliwrightPlugin, FliwrightRecordingConfig, Locator, Page, ScenarioExecutionMode, TestScenario, TimelineRunMode, TimelineRecorder } from '@fliwright/core';
|
|
4
|
+
import type { TestAPI } from 'vitest';
|
|
5
|
+
export { FliwrightRunner, createFliwrightRunner } from './runner.js';
|
|
6
|
+
export type { FliwrightRunnerOptions, FliwrightRunnerConstructor } from './runner.js';
|
|
7
|
+
export { fliwrightPreset } from './preset.js';
|
|
8
|
+
export { FliwrightRecoveryReporter } from './RecoveryReporter.js';
|
|
9
|
+
export type { FliwrightVitestPresetOptions } from './preset.js';
|
|
10
|
+
export type FliwrightLogFormat = 'pretty' | 'compact' | 'jsonl' | 'silent';
|
|
11
|
+
export type FliwrightLogOutput = 'stderr' | 'stdout' | 'file' | 'jsonl-file';
|
|
12
|
+
export interface FliwrightLogConfig {
|
|
13
|
+
level?: FliwrightLogLevel;
|
|
14
|
+
format?: FliwrightLogFormat;
|
|
15
|
+
outputs?: FliwrightLogOutput[];
|
|
16
|
+
filePath?: string;
|
|
17
|
+
jsonlPath?: string;
|
|
18
|
+
}
|
|
19
|
+
export interface FliwrightConfig {
|
|
20
|
+
vmServiceUrl: string;
|
|
21
|
+
plugins?: FliwrightPlugin[];
|
|
22
|
+
timeout?: number;
|
|
23
|
+
screenshot?: 'file' | 'base64' | 'off';
|
|
24
|
+
ai?: AiRuntimeConfig;
|
|
25
|
+
mode?: TimelineRunMode;
|
|
26
|
+
requireAssertions?: boolean;
|
|
27
|
+
agentPolicy?: AgentPolicy;
|
|
28
|
+
timelineDir?: string;
|
|
29
|
+
runsRoot?: string;
|
|
30
|
+
cacheRoot?: string;
|
|
31
|
+
projectRoot?: string;
|
|
32
|
+
log?: FliwrightLogConfig;
|
|
33
|
+
/** Named, composable environment declarations used by `test.scenario(name)`. */
|
|
34
|
+
scenarios?: Record<string, TestScenario>;
|
|
35
|
+
/** Attach to an already running app, or prepare a waiting test-only app before its first frame. */
|
|
36
|
+
scenarioMode?: ScenarioExecutionMode;
|
|
37
|
+
defaultScenario?: string;
|
|
38
|
+
recording?: Partial<FliwrightRecordingConfig>;
|
|
39
|
+
}
|
|
40
|
+
export declare function defineConfig(overrides: Partial<FliwrightConfig> & {
|
|
41
|
+
vmServiceUrl: string;
|
|
42
|
+
}): FliwrightConfig;
|
|
43
|
+
/**
|
|
44
|
+
* Decide where run artifacts go for a fliwright test run.
|
|
45
|
+
* Precedence is implemented by @fliwright/core:
|
|
46
|
+
* explicit config.runsRoot > FLIWRIGHT_RUNS_ROOT env > project-local root.
|
|
47
|
+
*/
|
|
48
|
+
export declare function resolveRunsRoot(config: {
|
|
49
|
+
runsRoot?: string;
|
|
50
|
+
projectRoot?: string;
|
|
51
|
+
}): string;
|
|
52
|
+
type FliwrightHookContext = {
|
|
53
|
+
page: Page;
|
|
54
|
+
};
|
|
55
|
+
type FliwrightHook = (context: FliwrightHookContext, suite: unknown) => unknown | Promise<unknown>;
|
|
56
|
+
interface FliwrightTimelineContext {
|
|
57
|
+
recorder: TimelineRecorder;
|
|
58
|
+
driver?: FliwrightDriver;
|
|
59
|
+
artifactStore: TimelineArtifactStore;
|
|
60
|
+
runId: string;
|
|
61
|
+
logger: FliwrightLogger;
|
|
62
|
+
timelinePath?: string;
|
|
63
|
+
runSession?: import('@fliwright/core').RunSession;
|
|
64
|
+
}
|
|
65
|
+
export interface FliwrightFixtures {
|
|
66
|
+
driver: FliwrightDriver;
|
|
67
|
+
page: Page;
|
|
68
|
+
aiRuntime: AiRuntime;
|
|
69
|
+
flow: FlowRuntime;
|
|
70
|
+
mock: MockRuntime;
|
|
71
|
+
agent: AgentRuntime;
|
|
72
|
+
assert: AssertRuntime;
|
|
73
|
+
timeline: FliwrightTimelineContext;
|
|
74
|
+
logger: FliwrightLogger;
|
|
75
|
+
}
|
|
76
|
+
export type FliwrightTest = TestAPI<FliwrightFixtures>;
|
|
77
|
+
export type ScenarioTest<TFixtures extends FliwrightFixtures = FliwrightFixtures> = (name: string, handler: (fixtures: TFixtures) => unknown | Promise<unknown>, timeout?: number) => void;
|
|
78
|
+
export interface ScenarioEnabledFliwrightTest<TFixtures extends FliwrightFixtures = FliwrightFixtures> extends TestAPI<TFixtures> {
|
|
79
|
+
scenario(name: string): ScenarioTest<TFixtures>;
|
|
80
|
+
}
|
|
81
|
+
export type FliwrightProjectFixtures = Record<string, (fixtures: FliwrightFixtures, use: (value: unknown) => Promise<void>) => Promise<void>>;
|
|
82
|
+
export interface CreateFliwrightTestOptions {
|
|
83
|
+
/** When set, fixtures use this driver instead of the worker's endpoint-specific cache. */
|
|
84
|
+
driverProvider?: () => Promise<FliwrightDriver>;
|
|
85
|
+
}
|
|
86
|
+
export declare function createFliwrightTest(config: FliwrightConfig, options?: CreateFliwrightTestOptions): ScenarioEnabledFliwrightTest;
|
|
87
|
+
export declare function extendFliwrightTest<TProjectFixtures extends Record<string, unknown>, TBaseFixtures extends FliwrightFixtures = FliwrightFixtures>(base: TestAPI<TBaseFixtures>, fixtures: {
|
|
88
|
+
[K in keyof TProjectFixtures]: (fixtures: Omit<TProjectFixtures, K> & TBaseFixtures, use: (value: TProjectFixtures[K]) => Promise<void>) => Promise<void>;
|
|
89
|
+
}): ScenarioEnabledFliwrightTest<TBaseFixtures & TProjectFixtures>;
|
|
90
|
+
export declare function createFliwrightScript(config: FliwrightConfig): ScenarioEnabledFliwrightTest<FliwrightFixtures>;
|
|
91
|
+
export declare const test: ScenarioEnabledFliwrightTest<FliwrightFixtures>;
|
|
92
|
+
export declare const script: ScenarioEnabledFliwrightTest<FliwrightFixtures>;
|
|
93
|
+
export declare function beforeEach(hook: FliwrightHook, timeout?: number): void;
|
|
94
|
+
export declare function afterEach(hook: FliwrightHook, timeout?: number): void;
|
|
95
|
+
export { afterAll, beforeAll, describe };
|
|
96
|
+
export declare function expect(locator: Locator, title?: string): Assertion;
|