UNPKG

magnitude-test

Version:

A TypeScript client for running automated UI tests through the Magnitude testing platform

64 lines (63 loc) 2.07 kB
import { RegisteredTest, TestOptions } from "@/discovery/types"; import { TestResult, TestState } from "@/runner/state"; import { BrowserOptions, LLMClient } from "magnitude-core"; import EventEmitter from "node:events"; import { TestFunction } from "@/discovery/types"; declare global { var __magnitudeTestFunctions: Map<string, TestFunction> | undefined; var __magnitudeMessageEmitter: EventEmitter | undefined; var __magnitudeTestHooks: TestHooks | undefined; var __magnitudeTestPromptStack: Record<string, string[]> | undefined; var __magnitudeTestRegistry: Map<string, TestMetadata> | undefined; } export declare const testFunctions: Map<string, TestFunction>; export declare const messageEmitter: EventEmitter<[never]>; export type TestHooks = Record<'beforeAll' | 'afterAll' | 'beforeEach' | 'afterEach', (() => void | Promise<void>)[]>; export type TestMetadata = { title: string; url: string; filepath: string; group?: string; }; export declare const hooks: TestHooks; export declare const testPromptStack: Record<string, string[]>; export declare const testRegistry: Map<string, TestMetadata>; export type TestWorkerIncomingMessage = { type: "execute"; testId: string; } | { type: "graceful_shutdown"; }; export type TestWorkerOutgoingMessage = { type: "load_complete"; } | { type: "load_error"; error: string; } | { type: "registered"; test: RegisteredTest; } | { type: "test_result"; testId: string; result: TestResult; } | { type: "test_error"; testId: string; error: string; } | { type: "test_state_change"; testId: string; state: TestState; } | { type: "graceful_shutdown_complete"; }; export declare function postToParent(message: TestWorkerOutgoingMessage): void; export type TestWorkerData = { absoluteFilePath: string; options: TestOptions; relativeFilePath: string; browserOptions?: BrowserOptions; llm?: LLMClient | LLMClient[]; telemetry?: boolean; }; export declare function getTestWorkerData(): TestWorkerData;