interface ScriptLoaderOptions { cacheBusting?: boolean; timeout?: number; } interface IScriptLoader { loadScript(scriptPath: string, options?: ScriptLoaderOptions): Promise; loadScripts(scriptPaths: string[], options?: ScriptLoaderOptions): Promise; } type SessionEventType = 'session:created' | 'session:started' | 'session:completed' | 'session:failed' | 'session:execution-started' | 'session:execution-completed' | 'session:creation-failed' | 'session:deleted' | 'test:pass' | 'test:fail' | 'script:loading' | 'script:loaded' | 'script:failed'; interface SessionEvent { type: SessionEventType; sessionLabel?: string; timestamp: string | Date; data?: any; source?: string; } interface IEventEmitter { emit(event: SessionEvent): void; on(eventType: SessionEventType, callback: (event: SessionEvent) => void): void; off(eventType: SessionEventType, callback: (event: SessionEvent) => void): void; onAny(callback: (event: SessionEvent) => void): void; offAny?(callback: (event: SessionEvent) => void): void; } interface TestSessionStats { tests: number; passes: number; pending: number; failures: number; } interface TestSessionOptions { timeout?: number; retries?: number; metadata?: Record; } interface ITestSession { readonly id: string; readonly label: string; readonly options: TestSessionOptions; readonly completed: boolean; readonly error?: Error; markCompleted(): void; setError(error: Error): void; } interface ISessionExecutionResult { sessionId: string; sessionLabel: string; stats: TestSessionStats; success: boolean; error?: Error; duration: number; } interface SessionExecutionResult extends ISessionExecutionResult { label: string; passes: number; failures: number; tests: number; } interface SessionResult { label: string; result: SessionExecutionResult | null; error?: string; } type SessionSetupFunction = () => Promise | void; interface IMochaRunner { on(event: 'pass' | 'fail' | 'end' | 'start', callback: (...args: any[]) => void): void; stats?: TestSessionStats; } interface IMochaInstance { suite: any; stats?: TestSessionStats; run(): IMochaRunner; reporterOptions?: Record; } interface ITestEnvironment { createMochaInstance(sessionLabel: string): IMochaInstance; injectGlobals(mochaInstance: IMochaInstance): void; } declare class ScriptLoader implements IScriptLoader { private static defaultOptions; loadScript(scriptPath: string, options?: ScriptLoaderOptions): Promise; loadScripts(scriptPaths: string[], options?: ScriptLoaderOptions): Promise; } interface SessionExecutionOptions { timeout?: number; retries?: number; onProgress?: (event: SessionEvent) => void; } interface SessionConfig { label: string; setupFn: SessionSetupFunction; options?: Partial; } interface BatchExecutionOptions { parallel?: boolean; stopOnError?: boolean; filter?: (session: ITestSession) => boolean; } interface SessionManagerStats { total: number; completed: number; pending: number; failed: number; } interface SessionManagerOptions { autoCleanup?: boolean; defaultSessionOptions?: Partial; eventLogging?: boolean; } declare const testSessionSetup: (config: Partial) => void; declare const getTestEnvironment: () => ITestEnvironment; declare const testSession: (label: string, setupFn: SessionSetupFunction, options?: Partial) => Promise; declare const runSession: (label: string) => Promise; declare const runAllSessions: () => Promise; declare const getSession: (label: string) => ITestSession | null; declare const getAllSessions: () => ITestSession[]; declare const onSessionEvent: (eventType: SessionEventType, callback: (event: SessionEvent) => void) => void; declare const onAnySessionEvent: (callback: (event: SessionEvent) => void) => void; declare const offSessionEvent: (eventType: SessionEventType, callback: (event: SessionEvent) => void) => void; declare const getEventEmitter: () => IEventEmitter; declare class SessionManager { private container; constructor(options?: any); createSession(label: string, setupFn: any, options?: any): Promise; createSessions(configs: Array<{ label: string; setupFn: any; options?: any; }>): Promise; getSession(label: string): ManagedSession | null; getAllSessions(): ManagedSession[]; runAll(options?: { parallel?: boolean; }): Promise; getStats(): { total: number; completed: number; pending: number; failed: number; }; } declare class ManagedSession { readonly label: string; constructor(label: string); get exists(): boolean; get completed(): boolean; get failed(): boolean; get error(): Error | undefined; get id(): string | undefined; get options(): TestSessionOptions | undefined; run(options?: any): Promise<{ label: string; passes: number; failures: number; tests: number; sessionId: string; sessionLabel: string; stats: TestSessionStats; success: boolean; error?: Error; duration: number; }>; runWithTimeout(timeoutMs: number): Promise; onEvent(eventType: string, callback: any): () => void; onAnyEvent(callback: any): () => void; } declare class SessionBuilder { private sessionManager; private label; private setupFunctions; private sessionOptions; private scripts; private testSuites; private scriptLoader; constructor(sessionManager: SessionManager); withLabel(label: string): this; withOptions(options: any): this; withTimeout(timeoutMs: number): this; withRetries(retries: number): this; withMetadata(key: string, value: any): this; loadScript(scriptPath: string): this; loadScripts(scriptPaths: string[]): this; addTestSuite(suiteFn: () => void): this; addAsyncSetup(setupFn: () => Promise): this; addSetup(setupFn: () => void): this; describe(description: string, testFn: () => void): this; it(description: string, testFn: () => void): this; build(): Promise; buildAndRun(): Promise; } declare class LegacyAPI { private scriptLoader; runSession(label: string, resultKey: string, testFiles: string[], reportContainerId?: string | null, options?: any): Promise; runMultipleSessions(sessions: Array<{ label: string; resultKey: string; testFiles: string[]; }>, containerId: string, options?: any): Promise; } declare const legacyRunSession: (label: string, resultKey: string, testFiles: string[], reportContainerId?: string | null, options?: any) => Promise; declare const legacyRunMultipleSessions: (sessions: Array<{ label: string; resultKey: string; testFiles: string[]; }>, containerId: string, options?: any) => Promise; declare const loadScript: (scriptPath: string, options?: ScriptLoaderOptions) => Promise; declare const loadScripts: (scriptPaths: string[], options?: ScriptLoaderOptions) => Promise; declare const MochaMultipleSessions: { testSessionSetup: (config: Partial) => void; getTestEnvironment: () => ITestEnvironment; testSession: (label: string, setupFn: SessionSetupFunction, options?: Partial) => Promise; runSession: (label: string) => Promise; runAllSessions: () => Promise; getSession: (label: string) => ITestSession | null; getAllSessions: () => ITestSession[]; onSessionEvent: (eventType: SessionEventType, callback: (event: SessionEvent) => void) => void; onAnySessionEvent: (callback: (event: SessionEvent) => void) => void; offSessionEvent: (eventType: SessionEventType, callback: (event: SessionEvent) => void) => void; getEventEmitter: () => IEventEmitter; loadScript: (scriptPath: string, options?: ScriptLoaderOptions) => Promise; loadScripts: (scriptPaths: string[], options?: ScriptLoaderOptions) => Promise; legacyRunSession: (label: string, resultKey: string, testFiles: string[], reportContainerId?: string | null, options?: any) => Promise; legacyRunMultipleSessions: (sessions: Array<{ label: string; resultKey: string; testFiles: string[]; }>, containerId: string, options?: any) => Promise; }; export { LegacyAPI, ManagedSession, ScriptLoader, SessionBuilder, SessionManager, MochaMultipleSessions as default, getAllSessions, getEventEmitter, getSession, getTestEnvironment, legacyRunMultipleSessions, legacyRunSession, loadScript, loadScripts, offSessionEvent, onAnySessionEvent, onSessionEvent, runAllSessions, runSession, testSession, testSessionSetup }; export type { BatchExecutionOptions, IEventEmitter, IMochaInstance, ISessionExecutionResult, ITestEnvironment, ITestSession, ScriptLoaderOptions, SessionConfig, SessionEvent, SessionEventType, SessionExecutionOptions, SessionExecutionResult, SessionManagerOptions, SessionManagerStats, SessionResult, SessionSetupFunction, TestSessionOptions, TestSessionStats };