import { AbstractProfiler } from './abstract-profiler'; import { TestStepType } from '../models'; export interface NetworkProfilerOptions { skipDomains?: string[] | undefined; trackOnFail?: boolean | undefined; } export declare class NetworkProfiler extends AbstractProfiler { private readonly skipDomains; private readonly _trackOnFail; /** * Fallback accumulator for steps captured outside any run() context. * Used by frameworks where test bodies cannot be wrapped in run() (Jest, Vitest, WDIO). * Public so interceptors can push to it via ProfilerRef. */ readonly fallbackSteps: TestStepType[]; private httpInterceptor; private fetchInterceptor; constructor(options?: NetworkProfilerOptions); get trackOnFail(): boolean; shouldSkip(url: string): boolean; /** * Install HTTP/HTTPS monkey-patches and subscribe to undici diagnostics_channel * so that outgoing requests inside a `run()` context are captured as REQUEST steps. */ enable(): void; /** * No-op per v1.3 design decision (flag-based activation model). * Satisfies the AbstractProfiler contract. */ disable(): void; /** * Uninstall HTTP/HTTPS monkey-patches and unsubscribe from undici diagnostics_channel — * permanently removes interception. */ restore(): void; /** * Wraps `fn` in an AsyncLocalStorage context so that any HTTP requests * made inside `fn` are attributed to the step accumulator for this call. * * Returns `{ result, steps }` where `result` is the return value of `fn` * and `steps` is the array of REQUEST steps captured during execution. */ run(fn: () => Promise): Promise<{ result: T; steps: TestStepType[]; }>; /** * Returns the current ALS store when called inside a `run()` context. * Returns an empty array when called outside (no active context). */ getSteps(): TestStepType[]; /** * Returns a copy of steps accumulated outside any run() context (fallback accumulator). * Used by frameworks where test bodies cannot be wrapped in run() (Jest, Vitest, WDIO). */ getAllSteps(): TestStepType[]; /** * Clears the fallback step accumulator. Call after collecting steps per test. */ clearSteps(): void; }