import type { Snapshot, TestResult } from '../types.js' export declare class Isolation { private snapshots private suiteSnapshots private activeWorkers constructor() /** * Terminate all active workers. Call this on shutdown. */ terminateAllWorkers(): Promise /** * Improved deepClone: returns primitives, copies common built-ins. */ deepClone(value: T, seen?: WeakMap): T /** * Build a snapshot of the current globalThis. */ buildSnapshot(): Snapshot captureSuiteSnapshot(suiteKey: string): void restoreSuiteSnapshot(suiteKey: string): void /** * Restore properties from a snapshot to globalThis. */ restoreProperties(snapshot: Snapshot): void restoreSnapshotFromMap(snapshotMap: Map, key: string): void captureSnapshot(testKey: string): void restoreSnapshot(testKey: string): void /** * helper to map stringified symbol keys back to Symbol if needed. */ _reviveKeyFromString(keyStr: string): string | symbol /** * shouldCaptureProperty: O(1) lookup using Set.has() */ shouldCaptureProperty(prop: string | symbol): boolean executeSuiteIsolated(suiteKey: string, fn: () => Promise): Promise executeIsolated(testKey: string, fn: () => Promise): Promise /** * Run a test in a worker thread for true isolation */ executeInWorker(options: { testFileUrl: string testIndex: number testPkg: string testParent: string testName: string suiteSnapshot?: Snapshot }): Promise /** * Run multiple tests in a single worker for better performance */ executeBatchInWorker(options: { testFileUrl: string testIndices: number[] testPkg: string testParent: string testNames: string[] suiteSnapshot?: Snapshot }): Promise } /** * Apply a snapshot to the current globalThis context. * Deletes properties not in the snapshot, restores properties from snapshot. * Standalone version for use in worker threads. */ export declare const restoreFromSnapshot: (snapshot: Snapshot | null | undefined) => void export declare const isolation: Isolation