declare global {
  namespace jest {
    interface Matchers<R, T = {}> {}
  }
}
import type { assert as assert_2 } from 'chai';
import type { config } from 'chai';
import { Formatter } from 'tinyrainbow';
import { MockInstance as MockInstance_2 } from '@vitest/spy';
import type { RsbuildConfig } from '@rsbuild/core';
import type { Writable } from 'node:stream';

/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

declare function addSerializer(plugin: Plugin_2): void;

export declare const afterAll: Rstest['afterAll'];

declare type AfterAllListener = (ctx: SuiteContext) => MaybePromise<void>;

export declare const afterEach: Rstest['afterEach'];

declare type AfterEachListener<ExtraContext = object> = (ctx: TestContext & ExtraContext) => MaybePromise<void>;

declare type AnimationFrameCallback = (timestamp: number) => any;

export declare const assert: Rstest['assert'];

declare interface AssertDomainOptions extends Omit<AssertOptions, "received"> {
    	received: unknown;
    	adapter: DomainSnapshotAdapter<any, any>;
}

declare interface AssertDomainPollOptions extends Omit<AssertDomainOptions, "received"> {
    	poll: () => Promise<unknown> | unknown;
    	timeout?: number;
    	interval?: number;
}

export declare interface Assertion<T = any> extends Assertion_2<T> {
    not: Assertion<T>;
    // Vitest types these against @vitest/spy, but Rstest matchers accept rs.fn()
    // and rs.spyOn() mocks without requiring structural compatibility.
    toHaveBeenCalledBefore: (mock: CallOrderMock, failIfNoFirstInvocation?: boolean) => void;
    toHaveBeenCalledAfter: (mock: CallOrderMock, failIfNoFirstInvocation?: boolean) => void;
    // Snapshots are extended in @vitest/snapshot and are not part of @vitest/expect
    matchSnapshot: SnapshotMatcher<T>;
    toMatchSnapshot: SnapshotMatcher<T>;
    toMatchInlineSnapshot: InlineSnapshotMatcher<T>;
    /**
     * Checks that an error thrown by a function matches a previously recorded snapshot.
     *
     * @param message - Optional custom error message.
     *
     * @example
     * expect(functionWithError).toThrowErrorMatchingSnapshot();
     */ toThrowErrorMatchingSnapshot: (message?: string) => void;
    /**
     * Checks that an error thrown by a function matches an inline snapshot within the test file.
     * Useful for keeping snapshots close to the test code.
     *
     * @param snapshot - Optional inline snapshot string to match.
     * @param message - Optional custom error message.
     *
     * @example
     * const throwError = () => { throw new Error('Error occurred') };
     * expect(throwError).toThrowErrorMatchingInlineSnapshot(`"Error occurred"`);
     */ toThrowErrorMatchingInlineSnapshot: (snapshot?: string, message?: string) => void;
    /**
     * Compares the received value to a snapshot saved in a specified file.
     * Useful for cases where snapshot content is large or needs to be shared across tests.
     *
     * @param filepath - Path to the snapshot file.
     * @param message - Optional custom error message.
     *
     * @example
     * await expect(largeData).toMatchFileSnapshot('path/to/snapshot.json');
     */ toMatchFileSnapshot: (filepath: string, message?: string) => Promise<void>;
    /**
     * Verifies that a promise resolves.
     *
     * @example
     * await expect(someAsyncFunc).resolves.toBe(42);
     */ resolves: PromisifyAssertion_2<T>;
    /**
     * Verifies that a promise rejects.
     *
     * @example
     * await expect(someAsyncFunc).rejects.toThrow('error');
     */ rejects: PromisifyAssertion_2<T>;
}

declare interface Assertion_2<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<T>, ChaiMockAssertion, Matchers<T> {
    	/**
     	* Ensures a value is of a specific type.
     	*
     	* @example
     	* expect(value).toBeTypeOf('string');
     	* expect(number).toBeTypeOf('number');
     	*/
    	toBeTypeOf: (expected: "bigint" | "boolean" | "function" | "number" | "object" | "string" | "symbol" | "undefined") => void;
    	/**
     	* Asserts that a mock function was called exactly once.
     	*
     	* @example
     	* expect(mockFunc).toHaveBeenCalledOnce();
     	*/
    	toHaveBeenCalledOnce: () => void;
    	/**
     	* Ensure that a mock function is called with specific arguments and called
     	* exactly once.
     	*
     	* @example
     	* expect(mockFunc).toHaveBeenCalledExactlyOnceWith('arg1', 42);
     	*/
    	toHaveBeenCalledExactlyOnceWith: <E extends any[]>(...args: E) => void;
    	/**
     	* This assertion checks if a `Mock` was called before another `Mock`.
     	* @param mock - A mock function created by `vi.spyOn` or `vi.fn`
     	* @param failIfNoFirstInvocation - Fail if the first mock was never called
     	* @example
     	* const mock1 = vi.fn()
     	* const mock2 = vi.fn()
     	*
     	* mock1()
     	* mock2()
     	* mock1()
     	*
     	* expect(mock1).toHaveBeenCalledBefore(mock2)
     	*/
    	toHaveBeenCalledBefore: (mock: MockInstance_2, failIfNoFirstInvocation?: boolean) => void;
    	/**
     	* This assertion checks if a `Mock` was called after another `Mock`.
     	* @param mock - A mock function created by `vi.spyOn` or `vi.fn`
     	* @param failIfNoFirstInvocation - Fail if the first mock was never called
     	* @example
     	* const mock1 = vi.fn()
     	* const mock2 = vi.fn()
     	*
     	* mock2()
     	* mock1()
     	* mock2()
     	*
     	* expect(mock1).toHaveBeenCalledAfter(mock2)
     	*/
    	toHaveBeenCalledAfter: (mock: MockInstance_2, failIfNoFirstInvocation?: boolean) => void;
    	/**
     	* Checks that a promise resolves successfully at least once.
     	*
     	* @example
     	* await expect(promise).toHaveResolved();
     	*/
    	toHaveResolved: () => void;
    	/**
     	* Checks that a promise resolves to a specific value.
     	*
     	* @example
     	* await expect(promise).toHaveResolvedWith('success');
     	*/
    	toHaveResolvedWith: <E>(value: E) => void;
    	/**
     	* Ensures a promise resolves a specific number of times.
     	*
     	* @example
     	* expect(mockAsyncFunc).toHaveResolvedTimes(3);
     	*/
    	toHaveResolvedTimes: (times: number) => void;
    	/**
     	* Asserts that the last resolved value of a promise matches an expected value.
     	*
     	* @example
     	* await expect(mockAsyncFunc).toHaveLastResolvedWith('finalResult');
     	*/
    	toHaveLastResolvedWith: <E>(value: E) => void;
    	/**
     	* Ensures a specific value was returned by a promise on the nth resolution.
     	*
     	* @example
     	* await expect(mockAsyncFunc).toHaveNthResolvedWith(2, 'secondResult');
     	*/
    	toHaveNthResolvedWith: <E>(nthCall: number, value: E) => void;
    	/**
     	* Verifies that a promise resolves.
     	*
     	* @example
     	* await expect(someAsyncFunc).resolves.toBe(42);
     	*/
    	resolves: PromisifyAssertion<T>;
    	/**
     	* Verifies that a promise rejects.
     	*
     	* @example
     	* await expect(someAsyncFunc).rejects.toThrow('error');
     	*/
    	rejects: PromisifyAssertion<T>;
}

declare interface AssertOptions {
    	received: unknown;
    	filepath: string;
    	name: string;
    	/**
     	* Not required but needed for `SnapshotClient.clearTest` to implement test-retry behavior.
     	* @default name
     	*/
    	testId?: string;
    	message?: string;
    	isInline?: boolean;
    	properties?: object;
    	inlineSnapshot?: string;
    	error?: Error;
    	errorMessage?: string;
    	rawSnapshot?: RawSnapshotInfo;
    	assertionName?: string;
}

declare abstract class AsymmetricMatcher<
	T,
	State extends MatcherState = MatcherState
> implements AsymmetricMatcherInterface {
    	protected sample: T;
    	protected inverse: boolean;
    	$$typeof: symbol;
    	constructor(sample: T, inverse?: boolean);
    	protected getMatcherContext(expect?: Chai.ExpectStatic): State;
    	abstract asymmetricMatch(other: unknown, customTesters?: Array<Tester>): boolean;
    	abstract toString(): string;
    	getExpectedType?(): string;
    	toAsymmetricMatcher?(): string;
}

declare interface AsymmetricMatcherInterface {
    	asymmetricMatch: (other: unknown, customTesters?: Array<Tester>) => boolean;
    	toString: () => string;
    	getExpectedType?: () => string;
    	toAsymmetricMatcher?: () => string;
}

declare interface AsymmetricMatchersContaining extends CustomMatcher {
    	/**
     	* Matches if the received string contains the expected substring.
     	*
     	* @example
     	* expect('I have an apple').toEqual(expect.stringContaining('apple'));
     	* expect({ a: 'test string' }).toEqual({ a: expect.stringContaining('test') });
     	*/
    	stringContaining: (expected: string) => any;
    	/**
     	* Matches if the received object contains all properties of the expected object.
     	*
     	* @example
     	* expect({ a: '1', b: 2 }).toEqual(expect.objectContaining({ a: '1' }))
     	*/
    	objectContaining: <T = any>(expected: DeeplyAllowMatchers<T>) => any;
    	/**
     	* Matches if the received array contains all elements in the expected array.
     	*
     	* @example
     	* expect(['a', 'b', 'c']).toEqual(expect.arrayContaining(['b', 'a']));
     	*/
    	arrayContaining: <T = unknown>(expected: Array<DeeplyAllowMatchers<T>>) => any;
    	/**
     	* Matches if the received string or regex matches the expected pattern.
     	*
     	* @example
     	* expect('hello world').toEqual(expect.stringMatching(/^hello/));
     	* expect('hello world').toEqual(expect.stringMatching('hello'));
     	*/
    	stringMatching: (expected: string | RegExp) => any;
    	/**
     	* Matches if the received number is within a certain precision of the expected number.
     	*
     	* @example
     	* expect(10.45).toEqual(expect.closeTo(10.5, 1));
     	* expect(5.11).toEqual(expect.closeTo(5.12)); // with default precision
     	*/
    	closeTo: (expected: number, precision?: number) => any;
    	/**
     	* Matches if the received value validates against a Standard Schema.
     	*
     	* @param schema - A Standard Schema V1 compatible schema object
     	*
     	* @example
     	* expect(user).toEqual(expect.schemaMatching(z.object({ name: z.string() })))
     	* expect(['hello', 'world']).toEqual([expect.schemaMatching(z.string()), expect.schemaMatching(z.string())])
     	*/
    	schemaMatching: (schema: unknown) => any;
}

declare type AsyncExpectationResult = Promise<SyncExpectationResult>;

export declare const beforeAll: Rstest['beforeAll'];

declare type BeforeAllListener = (ctx: SuiteContext) => MaybePromise<void | AfterAllListener>;

export declare const beforeEach: Rstest['beforeEach'];

declare type BeforeEachListener<ExtraContext = object> = (ctx: TestContext & ExtraContext) => MaybePromise<void | AfterEachListener<ExtraContext>>;

declare type BlobReporterOptions = {
    /**
     * Directory to store blob report files.
     * @default '.rstest-reports'
     */ outputDir?: string;
};

declare interface BranchMapping {
    loc: Range_2;
    type: string;
    locations: Range_2[];
    line: number;
}

/**
 * Single source of truth for the built-in browser provider identifiers.
 *
 * Core owns this list because the peer-dependency direction is one-way
 * (`@rstest/browser` depends on `@rstest/core`, never the reverse), so the CLI
 * `init` templates here cannot import the registry from `@rstest/browser`.
 * `@rstest/browser` re-exports {@link BrowserProvider} and keys its provider
 * registry by it (`Record<BrowserProvider, …>`), so adding a provider here
 * forces a matching implementation there — a missing key is a compile error.
 */
declare const BROWSER_PROVIDERS: readonly ['playwright'];

declare type BrowserModeConfig = {
    /**
     * Enable browser mode when running tests.
     *
     * @default false
     */ enabled?: boolean;
    /**
     * Browser provider to use for running tests.
     *
     * Currently only 'playwright' is supported.
     */ provider: BrowserProvider;
    /**
     * Which browser to use for testing.
     *
     * @default 'chromium'
     */ browser?: BrowserName;
    /**
     * Run browser in headless mode.
     *
     * @default Inferred from CI environment. `true` in CI, `false` otherwise.
     */ headless?: boolean;
    /**
     * Port for the browser mode dev server.
     *
     * If not specified, a random available port will be used.
     */ port?: number;
    /**
     * Default runner iframe viewport.
     *
     * When not specified, the browser UI fills the preview panel.
     */ viewport?: BrowserViewport;
    /**
     * Whether to exit if the specified port is already in use.
     *
     * @default false
     */ strictPort?: boolean;
    /**
     * Provider-specific config passed through to the selected browser provider.
     *
     * Use provider-owned types or helpers in user config when you want richer
     * IntelliSense for this field.
     */ providerOptions?: Record<string, unknown>;
};

/**
 * Supported browser types for browser mode testing.
 *
 * - `chromium` - Google Chrome, Microsoft Edge
 * - `firefox` - Mozilla Firefox
 * - `webkit` - Safari
 */ declare type BrowserName = 'chromium' | 'firefox' | 'webkit';

declare type BrowserProvider = (typeof BROWSER_PROVIDERS)[number];

/**
 * The browser-mode wire projection of {@link RuntimeConfig}. Node-only fields
 * the browser client never reads are stripped so they cannot ship unrouted
 * (the #1389 class):
 * - `testEnvironment`: the client hardcodes `environment: 'browser'`.
 * - `coverage`: browser coverage is host-wired, not client-read.
 * - `logHeapUsage` / `detectAsyncLeaks`: node process mechanisms.
 *
 * These fields stay REQUIRED on `RuntimeConfig` (node worker consumers
 * destructure them unconditionally); only the browser wire narrows.
 */ export declare type BrowserRuntimeConfig = Omit<RuntimeConfig, 'testEnvironment' | 'detectAsyncLeaks' | 'logHeapUsage' | 'coverage' | 'federation'>;

declare type BrowserViewport = {
    width: number;
    height: number;
} | DevicePreset;

declare type BuiltInReporterNames = 'default' | 'dot' | 'verbose' | 'md' | 'github-actions' | 'junit' | 'json' | 'blob';

declare type BuiltinReporterOptions = {
    default: DefaultReporterOptions;
    dot: Pick<DefaultReporterOptions, 'logger' | 'summary'>;
    verbose: VerboseReporterOptions;
    md: MdReporterOptions;
    'github-actions': GithubActionsReporterOptions;
    junit: Record<string, unknown>;
    json: JsonReporterOptions;
    blob: BlobReporterOptions;
};

declare type BundleDependencyPattern = string | RegExp;

declare type CallOrderMock = MockInstance | Parameters<Assertion_2['toHaveBeenCalledBefore']>[0];

declare type CancelAnimationFrame = (id: TimerId) => void;

declare type CancelIdleCallback = (id: TimerId) => void;

declare type ChaiConfig = Partial<Pick<typeof config, 'showDiff' | 'truncateThreshold'>>;

/**
 * Chai-style assertions for spy/mock testing.
 * These provide sinon-chai compatible assertion names that delegate to Jest-style implementations.
 */
declare interface ChaiMockAssertion {
    	/**
     	* Checks that a spy was called at least once.
     	* Chai-style equivalent of `toHaveBeenCalled`.
     	*
     	* @example
     	* expect(spy).to.have.been.called
     	*/
    	readonly called: Assertion_2;
    	/**
     	* Checks that a spy was called a specific number of times.
     	* Chai-style equivalent of `toHaveBeenCalledTimes`.
     	*
     	* @example
     	* expect(spy).to.have.callCount(3)
     	*/
    	callCount: (count: number) => void;
    	/**
     	* Checks that a spy was called with specific arguments at least once.
     	* Chai-style equivalent of `toHaveBeenCalledWith`.
     	*
     	* @example
     	* expect(spy).to.have.been.calledWith('arg1', 'arg2')
     	*/
    	calledWith: <E extends any[]>(...args: E) => void;
    	/**
     	* Checks that a spy was called exactly once.
     	* Chai-style equivalent of `toHaveBeenCalledOnce`.
     	*
     	* @example
     	* expect(spy).to.have.been.calledOnce
     	*/
    	readonly calledOnce: Assertion_2;
    	/**
     	* Checks that a spy was called exactly once with specific arguments.
     	* Chai-style equivalent of `toHaveBeenCalledExactlyOnceWith`.
     	*
     	* @example
     	* expect(spy).to.have.been.calledOnceWith('arg1', 'arg2')
     	*/
    	calledOnceWith: <E extends any[]>(...args: E) => void;
    	/**
     	* Checks that the last call to a spy was made with specific arguments.
     	* Chai-style equivalent of `toHaveBeenLastCalledWith`.
     	*
     	* @example
     	* expect(spy).to.have.been.lastCalledWith('arg1', 'arg2')
     	*/
    	lastCalledWith: <E extends any[]>(...args: E) => void;
    	/**
     	* Checks that the nth call to a spy was made with specific arguments.
     	* Chai-style equivalent of `toHaveBeenNthCalledWith`.
     	*
     	* @example
     	* expect(spy).to.have.been.nthCalledWith(2, 'arg1', 'arg2')
     	*/
    	nthCalledWith: <E extends any[]>(n: number, ...args: E) => void;
    	/**
     	* Checks that a spy returned a specific value at least once.
     	* Chai-style equivalent of `toHaveReturnedWith`.
     	*
     	* @example
     	* expect(spy).to.have.returned('value')
     	*/
    	returned: <E>(value: E) => void;
    	/**
     	* Checks that a spy returned a specific value at least once.
     	* Chai-style equivalent of `toHaveReturnedWith`.
     	*
     	* @example
     	* expect(spy).to.have.returnedWith('value')
     	*/
    	returnedWith: <E>(value: E) => void;
    	/**
     	* Checks that a spy returned successfully a specific number of times.
     	* Chai-style equivalent of `toHaveReturnedTimes`.
     	*
     	* @example
     	* expect(spy).to.have.returnedTimes(3)
     	*/
    	returnedTimes: (count: number) => void;
    	/**
     	* Checks that the last return value of a spy matches the expected value.
     	* Chai-style equivalent of `toHaveLastReturnedWith`.
     	*
     	* @example
     	* expect(spy).to.have.lastReturnedWith('value')
     	*/
    	lastReturnedWith: <E>(value: E) => void;
    	/**
     	* Checks that the nth return value of a spy matches the expected value.
     	* Chai-style equivalent of `toHaveNthReturnedWith`.
     	*
     	* @example
     	* expect(spy).to.have.nthReturnedWith(2, 'value')
     	*/
    	nthReturnedWith: <E>(n: number, value: E) => void;
    	/**
     	* Checks that a spy was called before another spy.
     	* Chai-style equivalent of `toHaveBeenCalledBefore`.
     	*
     	* @example
     	* expect(spy1).to.have.been.calledBefore(spy2)
     	*/
    	calledBefore: (mock: MockInstance_2, failIfNoFirstInvocation?: boolean) => void;
    	/**
     	* Checks that a spy was called after another spy.
     	* Chai-style equivalent of `toHaveBeenCalledAfter`.
     	*
     	* @example
     	* expect(spy1).to.have.been.calledAfter(spy2)
     	*/
    	calledAfter: (mock: MockInstance_2, failIfNoFirstInvocation?: boolean) => void;
    	/**
     	* Checks that a spy was called exactly twice.
     	* Chai-style equivalent of `toHaveBeenCalledTimes(2)`.
     	*
     	* @example
     	* expect(spy).to.have.been.calledTwice
     	*/
    	readonly calledTwice: Assertion_2;
    	/**
     	* Checks that a spy was called exactly three times.
     	* Chai-style equivalent of `toHaveBeenCalledTimes(3)`.
     	*
     	* @example
     	* expect(spy).to.have.been.calledThrice
     	*/
    	readonly calledThrice: Assertion_2;
}

declare type ClearImmediate = (id: NodeImmediate) => void;

declare type ClearInterval = (id?: TimerId) => void;

declare type ClearTimeout = (id?: TimerId) => void;

declare type Clock = {
    now: number;
    Date: typeof Date & {
        clock?: Clock;
        isFake?: boolean;
        toSource?: () => string;
    };
    loopLimit: number;
    requestIdleCallback: RequestIdleCallback;
    cancelIdleCallback: CancelIdleCallback;
    setTimeout: SetTimeout;
    clearTimeout: ClearTimeout;
    nextTick: NextTick;
    queueMicrotask: QueueMicrotask;
    setInterval: SetInterval;
    clearInterval: ClearInterval;
    setImmediate: SetImmediate;
    clearImmediate: ClearImmediate;
    countTimers: CountTimers;
    requestAnimationFrame: RequestAnimationFrame;
    cancelAnimationFrame: CancelAnimationFrame;
    runMicrotasks: RunMicrotasks;
    tick: Tick;
    tickAsync: TickAsync;
    next: Next;
    nextAsync: NextAsync;
    runAll: RunAll;
    runToFrame: RunToFrame;
    runAllAsync: RunAllAsync;
    runToLast: RunToLast;
    runToLastAsync: RunToLastAsync;
    reset: Reset;
    setSystemTime: SetSystemTime;
    jump: Jump;
    performance: any;
    hrtime: Hrtime;
    uninstall: Uninstall;
    methods: string[];
    shouldClearNativeTimers?: boolean;
    timersModuleMethods: {
        methodName: string;
        original: unknown;
    }[] | undefined;
    timersPromisesModuleMethods: {
        methodName: string;
        original: unknown;
    }[] | undefined;
    abortListenerMap: Map<VoidVarArgsFunc, AbortSignal>;
    setTickMode: SetTickMode;
    timers?: Map<number, Timer>;
    timerHeap?: TimerHeap;
    duringTick?: boolean;
    isNearInfiniteLimit: boolean;
    attachedInterval?: TimerId;
    tickMode?: ClockTickMode;
    jobs?: Timer[];
    Intl?: IntlWithClock;
    Temporal?: any;
};

declare type ClockTickMode = {
    mode: TickMode;
    counter: number;
    delta?: number;
};

declare interface CloverOptions extends FileOptions, ProjectOptions {}

declare interface CoberturaOptions extends FileOptions, ProjectOptions {}

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */
declare interface Colors {
    	comment: {
        		close: string;
        		open: string;
        	};
    	content: {
        		close: string;
        		open: string;
        	};
    	prop: {
        		close: string;
        		open: string;
        	};
    	tag: {
        		close: string;
        		open: string;
        	};
    	value: {
        		close: string;
        		open: string;
        	};
}

/**
 * compare function used when sorting object keys, `null` can be used to skip over sorting.
 */
declare type CompareKeys = ((a: string, b: string) => number) | null | undefined;

declare interface Config {
    	callToJSON: boolean;
    	compareKeys: CompareKeys;
    	colors: Colors;
    	escapeRegex: boolean;
    	escapeString: boolean;
    	indent: string;
    	maxDepth: number;
    	maxWidth: number;
    	min: boolean;
    	plugins: Plugins;
    	printBasicPrototype: boolean;
    	printFunctionName: boolean;
    	printShadowRoot: boolean;
    	spacingInner: string;
    	spacingOuter: string;
    	maxOutputLength: number;
}

declare type Config_2 = {
    now?: number | Date | TemporalTimelike;
    toFake?: FakeMethod[];
    toNotFake?: FakeMethod[];
    loopLimit?: number;
    shouldAdvanceTime?: boolean;
    advanceTimeDelta?: number;
    shouldClearNativeTimers?: boolean;
    ignoreMissingTimers?: boolean;
    target?: GlobalObject;
};

/** The stdio stream a console log was written to */ declare type ConsoleStreamType = 'stdout' | 'stderr';

declare type Constructor<T = any> = new(...args: any[]) => T;

declare type ConstructSignature<T> = [T] extends [new(...args: infer A) => infer R] ? new(...args: A) => R : unknown;

/**
 * Base class for writing content
 */
declare class ContentWriter {
    /**
     * returns the colorized version of a string. Typically,
     * content writers that write to files will return the
     * same string and ones writing to a tty will wrap it in
     * appropriate escape sequences.
     */
    colorize(str: string, clazz?: string): string;
    /**
     * writes a string appended with a newline to the destination
     */
    println(str: string): void;
    /**
     * closes this content writer. Should be called after all writes are complete.
     */
    close(): void;
}

declare interface Context {
    data: any;
    dir: string;
    sourceFinder(filepath: string): string;
    watermarks: Watermarks;
    writer: FileWriter;
    /**
     * returns the coverage class given a coverage
     * types and a percentage value.
     */
    classForPercent(type: keyof Watermarks, value: number): string;
    /**
     * returns the source code for the specified file path or throws if
     * the source could not be found.
     */
    getSource(filepath: string): string;
    getTree(summarizer?: Summarizers): Tree;
    /**
     * returns a full visitor given a partial one.
     */
    getVisitor<N extends Node_2 = Node_2>(visitor: Partial<Visitor<N>>): Visitor<N>;
    /**
     * returns a FileWriter implementation for reporting use. Also available
     * as the `writer` property on the context.
     */
    getWriter(): FileWriter;
    /**
     * returns an XML writer for the supplied content writer
     */
    getXmlWriter(contentWriter: ContentWriter): XmlWriter;
}

declare class CounterMap<K> extends DefaultMap<K, number> {
    	constructor();
    	_total: number | undefined;
    	valueOf(): number;
    	increment(key: K): void;
    	total(): number;
}

declare type CountTimers = () => number;

declare interface Coverage {
    covered: number;
    total: number;
    coverage: number;
}

export declare interface CoverageMapData {
    [key: string]: FileCoverage | FileCoverageData;
}

declare type CoverageOptions = {
    /**
     * Enable coverage collection.
     * @default false
     */ enabled?: boolean;
    /**
     * A list of glob patterns that should be included for coverage collection.
     * Only collect coverage for tested files by default.
     *
     * @default undefined
     */ include?: string[];
    /**
     * Collect coverage only for files changed since a specified commit or branch.
     * When enabled from `--changed`, it inherits the changed files collected by `--changed`.
     *
     * @default undefined
     */ changed?: boolean | string;
    /**
     * A list of glob patterns that should be excluded from coverage collection.
     *
     * This option accepts an array of wax(https://crates.io/crates/wax)-compatible glob patterns
     *
     * @default ['**\/node_modules/**',
     *           '**\/__tests__/**',
     *           '**\/__mocks__/**',
     *           '**\/*.d.ts',
     *           '**\/*.{test,spec}.[jt]s',
     *           '**\/*.{test,spec}.[cm][jt]s',
     *           '**\/*.{test,spec}.[jt]sx',
     *           '**\/*.{test,spec}.[cm][jt]sx'
     * ]
     */ exclude?: string[];
    /**
     * The provider to use for coverage collection.
     * @default 'istanbul'
     */ provider?: 'istanbul' | 'v8';
    /**
     * The reporters to use for coverage collection.
     * Supports built-in istanbul reporters and custom reporters (e.g., '@canyonjs/report-html').
     * @default ['text', 'html', 'clover', 'json']
     * @example
     * // Built-in reporters
     * reporters: ['text', 'html', ['json', { file: 'coverage.json' }]]
     *
     * // Custom reporters
     * reporters: ['@canyonjs/report-html', ['custom-reporter', { outputDir: './reports' }]]
     *
     * // Mixed usage
     * reporters: ['text', '@canyonjs/report-html', ['html', { subdir: 'html-report' }]]
     */ reporters?: SupportedReporter[];
    /**
     * The directory to store coverage reports.
     * @default './coverage'
     */ reportsDirectory?: string;
    /**
     * Whether to clean the coverage directory before running tests.
     * @default true
     */ clean?: boolean;
    /**
     * Coverage thresholds
     *
     * @default undefined
     */ thresholds?: CoverageThresholds;
    /**
     * Whether to report coverage when tests fail.
     * @default false
     */ reportOnFailure?: boolean;
    /**
     * Whether to collect coverage for source files outside the project root directory.
     * This is useful in monorepo setups where tests import modules from sibling packages.
     * @default false
     */ allowExternal?: boolean;
};

declare class CoverageSummary {
    constructor(data: CoverageSummary | CoverageSummaryData);
    merge(obj: CoverageSummary): CoverageSummary;
    toJSON(): CoverageSummaryData;
    isEmpty(): boolean;
    data: CoverageSummaryData;
    lines: Totals;
    statements: Totals;
    branches: Totals;
    functions: Totals;
}

declare interface CoverageSummaryData {
    lines: Totals;
    statements: Totals;
    branches: Totals;
    functions: Totals;
}

declare type CoverageThreshold = {
    /** Threshold for statements */ statements?: number;
    /** Threshold for functions */ functions?: number;
    /** Threshold for branches */ branches?: number;
    /** Threshold for lines */ lines?: number;
};

declare type CoverageThresholds = CoverageThreshold | (CoverageThreshold & ThresholdGlobRecord);

export declare const createBrowserTaskContext: () => TaskContext;

/**
 * Live per-file API binding under `isolate: false` (the canonical contract).
 *
 * One worker runs many files: `@rstest/core`'s runtime is re-prepared per file
 * (#1373) but user modules persist, so any context-bound API value-copied into
 * a shared helper (`export const test = base.extend({})`, `{ ...rstest }`, a
 * snapshotted `expect.poll`) must not freeze to the first file's torn-down
 * context. ONE mechanism covers the whole surface: every injected member is
 * built once per worker with a stable identity and resolves the running file's
 * `FileContext` (`../fileContext`) at call time — never closing over a
 * per-file instance. `createRunner` republishes the context per file, and
 * per-file state is reset, not rebuilt:
 *
 *   - test / it / describe / hooks   → `runtimeAPI`            (runner/runtime.ts)
 *   - onTestFinished / onTestFailed  → `runnerAPI`             (runner/index.ts)
 *   - expect (incl. `.poll`/`.soft`) → `createFileExpect`      (./expect)
 *   - rstest / rs                    → `createRstestUtilities` (./utilities)
 *
 * The one intentional exception is the per-test local expect
 * (`context.expect`): created inside the running test, it can never be stale
 * and stays pinned to keep `test.concurrent` isolation.
 *
 * See https://github.com/web-infra-dev/rstest/issues/1376.
 */
export declare const createRstestRuntime: (workerState: WorkerState, { taskContext }: {
    taskContext: TaskContext;
}) => Promise<{
    runner: {
        runTests: (testPath: string, hooks: RunnerHooks, api: Rstest) => Promise<TestFileResult>;
        collectTests: () => Promise<TestInfo[]>;
        getCurrentTest: () => TestCase | undefined;
    };
    api: Rstest;
}>;

export declare type CurrentTaskInfo = Pick<UserConsoleLog, 'taskId' | 'taskName' | 'taskParentNames' | 'taskType' | 'testPath'>;

declare interface CustomMatcher {
    	/**
     	* Checks that a value satisfies a custom matcher function.
     	*
     	* @param matcher - A function returning a boolean based on the custom condition
     	* @param message - Optional custom error message on failure
     	*
     	* @example
     	* expect(age).toSatisfy(val => val >= 18, 'Age must be at least 18');
     	* expect(age).toEqual(expect.toSatisfy(val => val >= 18, 'Age must be at least 18'));
     	*/
    	toSatisfy: (matcher: (value: any) => boolean, message?: string) => any;
    	/**
     	* Matches if the received value is one of the values in the expected array or set.
     	*
     	* @example
     	* expect(1).toBeOneOf([1, 2, 3])
     	* expect('foo').toBeOneOf([expect.any(String)])
     	* expect({ a: 1 }).toEqual({ a: expect.toBeOneOf(['1', '2', '3']) })
     	*/
    	toBeOneOf: <T>(sample: Array<T> | Set<T>) => any;
}

/** Custom reporter configuration for non-istanbul reporters */ declare type CustomReporter = string | [string, Record<string, unknown>];

declare interface DecodedSourceMap extends SourceMapV3 {
    mappings: SourceMapSegment[][];
}

declare type DecodedSourceMapXInput = DecodedSourceMap & XInput;

declare type DeeplyAllowMatchers<T> = T extends Array<infer Element> ? WithAsymmetricMatcher<T> | DeeplyAllowMatchers<Element>[] : T extends object ? WithAsymmetricMatcher<T> | { [K in keyof T] : DeeplyAllowMatchers<T[K]> } : WithAsymmetricMatcher<T>;

/**
 * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

declare class DefaultMap<
	K,
	V
> extends Map<K, V> {
    	private defaultFn;
    	constructor(defaultFn: (key: K) => V, entries?: Iterable<readonly [K, V]>);
    	get(key: K): V;
}

declare type DefaultReporterOptions = {
    /**
     * prints out summary of all tests
     * @default true
     */ summary?: boolean;
    /**
     * logger which write messages to
     * @default process.stdout/process.stderr
     */ logger?: Options['logger'];
    /**
     * prints out project name in test file title
     * show project name by default when running multiple projects
     */ showProjectName?: boolean;
};

export declare const describe: Rstest['describe'];

declare type DescribeAPI = DescribeFn & {
    each: DescribeEachFn;
    for: DescribeForFn;
    only: DescribeAPI;
    skip: DescribeAPI;
    runIf: (condition: boolean) => DescribeAPI;
    skipIf: (condition: boolean) => DescribeAPI;
    todo: DescribeAPI;
    concurrent: DescribeAPI;
    sequential: DescribeAPI;
};

/**
 * The two accepted call shapes for `describe` and the functions returned by
 * `describe.each` / `describe.for`, mirroring `TestCall`:
 * - `(name, fn, timeout?)` — suite function second, optional numeric timeout last.
 * - `(name, options, fn?)` — `TestOptions` object as the second argument.
 *
 * Suite-level options propagate to descendant cases as inheritable defaults.
 */ declare type DescribeCall<Fn> = {
    (description: string, fn?: Fn, timeout?: number) : void;
    (description: string, options: TestOptions, fn?: Fn) : void;
};

declare interface DescribeEachFn {
    <T extends Record<string, unknown>>(cases: readonly T[]) : DescribeCall<(param: T) => MaybePromise<void>>;
    <T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]) : DescribeCall<(...args: [...T]) => MaybePromise<void>>;
    <T>(cases: readonly T[]) : DescribeCall<(param: T) => MaybePromise<void>>;
    <T extends Record<string, unknown>>(strings: TemplateStringsArray, ...expressions: unknown[]) : DescribeCall<(param: T) => MaybePromise<void>>;
}

declare type DescribeFn = DescribeCall<() => MaybePromise<void>>;

declare interface DescribeForFn {
    <T>(cases: readonly T[]) : DescribeCall<(param: T) => MaybePromise<void>>;
    <T extends Record<string, unknown>>(strings: TemplateStringsArray, ...expressions: unknown[]) : DescribeCall<(param: T) => MaybePromise<void>>;
}

/**
 * Device presets aligned with Chrome DevTools device toolbar.
 *
 * These values are stable identifiers (not user-facing labels).
 *
 * IMPORTANT: Keep this union in sync with
 * `@rstest/browser` preset runtime source:
 * `packages/browser/src/viewportPresets.ts`.
 *
 * `@rstest/core` owns `defineConfig` typing, while `@rstest/browser` owns
 * runtime validation and resolution for preset ids.
 */ declare type DevicePreset = 'iPhoneSE' | 'iPhoneXR' | 'iPhone12Pro' | 'iPhone14ProMax' | 'Pixel7' | 'SamsungGalaxyS8Plus' | 'SamsungGalaxyS20Ultra' | 'iPadMini' | 'iPadAir' | 'iPadPro' | 'SurfacePro7' | 'SurfaceDuo' | 'GalaxyZFold5' | 'AsusZenbookFold' | 'SamsungGalaxyA51A71' | 'NestHub' | 'NestHubMax';

/**
 * @param a Expected value
 * @param b Received value
 * @param options Diff options
 * @returns {string | null} a string diff
 */
declare function diff(a: any, b: any, options?: DiffOptions, memorize?: Memorize): string | undefined;

declare interface DiffOptions {
    	aAnnotation?: string;
    	aColor?: DiffOptionsColor;
    	aIndicator?: string;
    	bAnnotation?: string;
    	bColor?: DiffOptionsColor;
    	bIndicator?: string;
    	changeColor?: DiffOptionsColor;
    	changeLineTrailingSpaceColor?: DiffOptionsColor;
    	commonColor?: DiffOptionsColor;
    	commonIndicator?: string;
    	commonLineTrailingSpaceColor?: DiffOptionsColor;
    	contextLines?: number;
    	emptyFirstOrLastLinePlaceholder?: string;
    	expand?: boolean;
    	includeChangeCounts?: boolean;
    	omitAnnotationLines?: boolean;
    	patchColor?: DiffOptionsColor;
    	printBasicPrototype?: boolean;
    	maxDepth?: number;
    	compareKeys?: CompareKeys;
    	truncateThreshold?: number;
    	truncateAnnotation?: string;
    	truncateAnnotationColor?: DiffOptionsColor;
}

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

declare type DiffOptionsColor = (arg: string) => string;

declare type DisposableRstestUtilities = RstestUtilities & {
    /**
     * Restores the resource created by the current utility call when it leaves a `using` scope.
     */ [Symbol.dispose](): void;
};

/** The test file output path */ declare type DistPath = string;

declare interface DomainMatchResult {
    	pass: boolean;
    	message?: string;
    	/**
     	* The captured value viewed through the template's lens.
     	*
     	* Where the template uses patterns (e.g. regexes) or omits details,
     	* the resolved string adopts those patterns. Where the template doesn't
     	* match, the resolved string uses literal captured values instead.
     	*
     	* Used for two purposes:
     	* - **Diff display** (actual side): compared against `expected`
     	*   so the diff highlights only genuine mismatches, not pattern-vs-literal noise.
     	* - **Snapshot update** (`--update`): written as the new snapshot content,
     	*   preserving user-edited patterns from matched regions while incorporating
     	*   actual values for mismatched regions.
     	*
     	* When omitted, falls back to `render(capture(received))` (the raw rendered value).
     	*/
    	resolved?: string;
    	/**
     	* The stored template re-rendered as a string, representing what the user
     	* originally wrote or last saved.
     	*
     	* Used as the expected side in diff display.
     	*
     	* When omitted, falls back to the raw snapshot string from the snap file
     	* or inline snapshot.
     	*/
    	expected?: string;
}

declare interface DomainSnapshotAdapter<
	Captured = unknown,
	Expected = unknown
> {
    	name: string;
    	capture: (received: unknown) => Captured;
    	render: (captured: Captured) => string;
    	parseExpected: (input: string) => Expected;
    	match: (captured: Captured, expected: Expected) => DomainMatchResult;
}

declare type Duration = {
    totalTime: number;
    buildTime: number;
    testTime: number;
};

declare interface EncodedSourceMap extends SourceMapV3 {
    mappings: string;
}

declare type EncodedSourceMapXInput = EncodedSourceMap & XInput;

declare type EnvironmentName = 'node' | 'jsdom' | 'happy-dom';

declare type EnvironmentWithOptions = {
    name: EnvironmentName;
    options?: Record<string, any>;
};

export declare const expect: Rstest['expect'];

declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;

declare interface ExpectedSnapshot {
    	key: string;
    	count: number;
    	data?: string;
    	markAsChecked: () => void;
}

declare interface ExpectPollOptions {
    /**
     * @default 50
     */ interval?: number;
    /**
     * @default 1000
     */ timeout?: number;
    message?: string;
}

declare interface ExpectStatic extends VitestExpectProperties {
    <T>(actual: T, message?: string) : Assertion<T>;
    unreachable: (message?: string) => never;
    soft: <T>(actual: T, message?: string) => Assertion<T>;
    poll: <T>(actual: () => T, options?: ExpectPollOptions) => Omit<PromisifyAssertion_2<Awaited<T>>, 'rejects' | 'resolves' | 'toThrow' | 'toThrowError' | 'throw' | 'throws' | 'matchSnapshot' | 'toMatchSnapshot' | 'toMatchInlineSnapshot' | 'toThrowErrorMatchingSnapshot' | 'toThrowErrorMatchingInlineSnapshot'>;
    addEqualityTesters: (testers: Tester[]) => void;
    assertions: (expected: number) => void;
    hasAssertions: () => void;
    addSnapshotSerializer: typeof addSerializer;
    getState: () => MatcherState_2;
    setState: (state: Partial<MatcherState_2>) => void;
}

declare interface ExpectStatic_2 extends Chai.ExpectStatic, Matchers, AsymmetricMatchersContaining {
    	<T>(actual: T, message?: string): Assertion_2<T>;
    	extend: (expects: MatchersObject) => void;
    	anything: () => any;
    	any: (constructor: unknown) => any;
    	getState: () => MatcherState;
    	setState: (state: Partial<MatcherState>) => void;
    	not: AsymmetricMatchersContaining;
}

declare type ExtendConfig = Omit<LooseRstestConfig, 'projects'>;

declare type ExtendConfigFn = (userConfig: Readonly<LooseRstestConfig>) => MaybePromise<ExtendConfig>;

declare type FakeMethod = "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback" | "performance" | "queueMicrotask" | "Intl" | "Temporal";

declare type FakeTimerSystemTime = Parameters<Clock['setSystemTime']>[0];

declare type FakeTimerTickMode = Parameters<Clock['setTickMode']>[0];

declare type FakeTimerTickTime = Parameters<Clock['tick']>[0];

declare type Falsy = false | 0 | 0n | '' | null | undefined;

declare class FileCoverage implements FileCoverageData {
    constructor(data: string | FileCoverage | FileCoverageData);
    merge(other: FileCoverageData): void;
    getBranchCoverageByLine(): { [line: number]: Coverage };
    getLineCoverage(): { [line: number]: number };
    getUncoveredLines(): number[];
    resetHits(): void;
    computeBranchTotals(): Totals;
    computeSimpleTotals(): Totals;
    toSummary(): CoverageSummary;
    toJSON(): object;

    data: FileCoverageData;
    path: string;
    statementMap: { [key: string]: Range_2 };
    fnMap: { [key: string]: FunctionMapping };
    branchMap: { [key: string]: BranchMapping };
    s: { [key: string]: number };
    f: { [key: string]: number };
    b: { [key: string]: number[] };
}

declare interface FileCoverageData {
    path: string;
    statementMap: { [key: string]: Range_2 };
    fnMap: { [key: string]: FunctionMapping };
    branchMap: { [key: string]: BranchMapping };
    s: { [key: string]: number };
    f: { [key: string]: number };
    b: { [key: string]: number[] };
}

declare type FileFilterMode = 'fuzzy' | 'exact';

declare interface FileOptions {
    file: string;
}

/**
 * utility for writing files under a specific directory
 */
declare class FileWriter {
    constructor(baseDir: string);
    static startCapture(): void;
    static stopCapture(): void;
    static getOutput(): string;
    static resetOutput(): void;
    /**
     * returns a FileWriter that is rooted at the supplied subdirectory
     */
    writeForDir(subdir: string): FileWriter;
    /**
     * copies a file from a source directory to a destination name
     */
    copyFile(source: string, dest: string, header?: string): void;
    /**
     * returns a content writer for writing content to the supplied file.
     */
    writeFile(file: string | null): ContentWriter;
}

declare type Fixture<T, K extends keyof T, ExtraContext = object> = ((...args: any) => any) extends T[K] ? T[K] extends any ? FixtureFn<T, K, Omit<ExtraContext, Exclude<keyof T, K>>> : never : T[K] | (T[K] extends any ? FixtureFn<T, K, Omit<ExtraContext, Exclude<keyof T, K>>> : never);

declare type FixtureFn<T, K extends keyof T, ExtraContext> = (context: Omit<T, K> & ExtraContext, use: Use<T[K]>) => Promise<void>;

declare interface FixtureOptions {
    /**
     * Whether to automatically set up current fixture, even though it's not being used in tests.
     */ auto?: boolean;
}

declare type Fixtures<T extends Record<string, any> = object, ExtraContext = object> = {
    [K in keyof T]: Fixture<T, K, ExtraContext & TestContext> | [Fixture<T, K, ExtraContext & TestContext>, FixtureOptions?];
};

/**
 * Format console arguments the way the node worker's console does
 * (`node:util.format` semantics), in a browser-safe implementation. Used by
 * the browser client's console relay so both executors forward identical log
 * text. Known divergence from node: collection wrappers print in loupe's form
 * (`Map{ 'k' => 'v' }` instead of node's `Map(1) { 'k' => 'v' }`).
 */
export declare const formatConsoleArgs: (args: unknown[]) => string;

declare type FormattedError = {
    fullStack?: boolean;
    message: string;
    name?: string;
    stack?: string;
    diff?: string;
    expected?: string;
    actual?: string;
    retryCount?: number;
};

declare type FunctionLike = (...args: any) => any;

declare interface FunctionMapping {
    name: string;
    decl: Range_2;
    loc: Range_2;
    line: number;
}

declare type GeneratedColumn = number;

declare function getMatcherUtils(): {
    	EXPECTED_COLOR: Formatter;
    	RECEIVED_COLOR: Formatter;
    	INVERTED_COLOR: Formatter;
    	BOLD_WEIGHT: Formatter;
    	DIM_COLOR: Formatter;
    	diff: typeof diff;
    	matcherHint: typeof matcherHint;
    	printReceived: typeof printReceived;
    	printExpected: typeof printExpected;
    	printDiffOrStringify: typeof printDiffOrStringify;
    	printWithType: typeof printWithType;
};

declare type GetSourcemap = (sourcePath: string) => Promise<SourceMapInput | null>;

declare type GithubActionsReporterOptions = {
    /**
     * Whether to output `::error` annotations for failed tests.
     * @default true
     */ annotations?: boolean;
    /**
     * Whether to append a Markdown summary to `GITHUB_STEP_SUMMARY`.
     * @default true
     */ summary?: boolean;
};

export declare const globalApis: readonly (keyof Rstest)[];

declare type GlobalObject = Record<string, any> & {
    setTimeout?: SetTimeout;
    clearTimeout?: ClearTimeout;
    setInterval?: SetInterval;
    clearInterval?: ClearInterval;
    setImmediate?: SetImmediate;
    clearImmediate?: ClearImmediate;
    queueMicrotask?: QueueMicrotask;
    requestAnimationFrame?: RequestAnimationFrame;
    cancelAnimationFrame?: CancelAnimationFrame;
    requestIdleCallback?: RequestIdleCallback;
    cancelIdleCallback?: CancelIdleCallback;
    process?: any;
    performance?: any;
    Performance?: any;
    Intl?: any;
    Temporal?: any;
    Promise?: typeof Promise;
    Date: typeof Date & {
        isFake?: boolean;
        toSource?: () => string;
        clock?: any;
    };
};

declare type Hrtime = (prev?: Array<number>) => Array<number>;

declare interface HtmlOptions {
    verbose: boolean;
    skipEmpty: boolean;
    subdir: string;
    linkMapper: LinkMapper;
}

declare interface HtmlSpaOptions extends HtmlOptions {
    metricsToShow: Array<"lines" | "branches" | "functions" | "statements">;
}

declare type IdleDeadline_2 = {
    didTimeout: boolean;
    timeRemaining: TimeRemaining;
};

declare type Indent = (arg0: string) => string;

/**
 * A list of glob patterns or files that match your test projects.
 *
 * eg. ['packages/*', 'examples/node/rstest.config.ts']
 */ /**
 * Inline project config must include a name.
 */ declare type InlineProjectConfig = ProjectConfig & {
    name: string;
};

declare interface InlineSnapshotMatcher<T> {
    <U extends {
        [P in keyof T]: any;
    }>(properties: Partial<U>, snapshot?: string, message?: string) : void;
    (message?: string) : void;
}

declare type IntlWithClock = Record<string, any> & {
    clock: Clock;
};

export declare const it: Rstest['it'];

declare interface JestAssertion<T = any> extends jest.Matchers<void, T>, CustomMatcher {
    	/**
     	* Used when you want to check that two objects have the same value.
     	* This matcher recursively checks the equality of all fields, rather than checking for object identity.
     	*
     	* @example
     	* expect(user).toEqual({ name: 'Alice', age: 30 });
     	*/
    	toEqual: <E>(expected: E) => void;
    	/**
     	* Use to test that objects have the same types as well as structure.
     	*
     	* @example
     	* expect(user).toStrictEqual({ name: 'Alice', age: 30 });
     	*/
    	toStrictEqual: <E>(expected: E) => void;
    	/**
     	* Checks that a value is what you expect. It calls `Object.is` to compare values.
     	* Don't use `toBe` with floating-point numbers.
     	*
     	* @example
     	* expect(result).toBe(42);
     	* expect(status).toBe(true);
     	*/
    	toBe: <E>(expected: E) => void;
    	/**
     	* Check that a string matches a regular expression.
     	*
     	* @example
     	* expect(message).toMatch(/hello/);
     	* expect(greeting).toMatch('world');
     	*/
    	toMatch: (expected: string | RegExp) => void;
    	/**
     	* Used to check that a JavaScript object matches a subset of the properties of an object
     	*
     	* @example
     	* expect(user).toMatchObject({
     	*   name: 'Alice',
     	*   address: { city: 'Wonderland' }
     	* });
     	*/
    	toMatchObject: <E extends object | any[]>(expected: E) => void;
    	/**
     	* Used when you want to check that an item is in a list.
     	* For testing the items in the list, this uses `===`, a strict equality check.
     	*
     	* @example
     	* expect(items).toContain('apple');
     	* expect(numbers).toContain(5);
     	*/
    	toContain: <E>(item: E) => void;
    	/**
     	* Used when you want to check that an item is in a list.
     	* For testing the items in the list, this matcher recursively checks the
     	* equality of all fields, rather than checking for object identity.
     	*
     	* @example
     	* expect(items).toContainEqual({ name: 'apple', quantity: 1 });
     	*/
    	toContainEqual: <E>(item: E) => void;
    	/**
     	* Use when you don't care what a value is, you just want to ensure a value
     	* is true in a boolean context. In JavaScript, there are six falsy values:
     	* `false`, `0`, `''`, `null`, `undefined`, and `NaN`. Everything else is truthy.
     	*
     	* @example
     	* expect(user.isActive).toBeTruthy();
     	*/
    	toBeTruthy: () => void;
    	/**
     	* When you don't care what a value is, you just want to
     	* ensure a value is false in a boolean context.
     	*
     	* @example
     	* expect(user.isActive).toBeFalsy();
     	*/
    	toBeFalsy: () => void;
    	/**
     	* For comparing floating point numbers.
     	*
     	* @example
     	* expect(score).toBeGreaterThan(10);
     	*/
    	toBeGreaterThan: (num: number | bigint) => void;
    	/**
     	* For comparing floating point numbers.
     	*
     	* @example
     	* expect(score).toBeGreaterThanOrEqual(10);
     	*/
    	toBeGreaterThanOrEqual: (num: number | bigint) => void;
    	/**
     	* For comparing floating point numbers.
     	*
     	* @example
     	* expect(score).toBeLessThan(10);
     	*/
    	toBeLessThan: (num: number | bigint) => void;
    	/**
     	* For comparing floating point numbers.
     	*
     	* @example
     	* expect(score).toBeLessThanOrEqual(10);
     	*/
    	toBeLessThanOrEqual: (num: number | bigint) => void;
    	/**
     	* Used to check that a variable is NaN.
     	*
     	* @example
     	* expect(value).toBeNaN();
     	*/
    	toBeNaN: () => void;
    	/**
     	* Used to check that a variable is undefined.
     	*
     	* @example
     	* expect(value).toBeUndefined();
     	*/
    	toBeUndefined: () => void;
    	/**
     	* This is the same as `.toBe(null)` but the error messages are a bit nicer.
     	* So use `.toBeNull()` when you want to check that something is null.
     	*
     	* @example
     	* expect(value).toBeNull();
     	*/
    	toBeNull: () => void;
    	/**
     	* Used to check that a variable is nullable (null or undefined).
     	*
     	* @example
     	* expect(value).toBeNullable();
     	*/
    	toBeNullable: () => void;
    	/**
     	* Ensure that a variable is not undefined.
     	*
     	* @example
     	* expect(value).toBeDefined();
     	*/
    	toBeDefined: () => void;
    	/**
     	* Ensure that an object is an instance of a class.
     	* This matcher uses `instanceof` underneath.
     	*
     	* @example
     	* expect(new Date()).toBeInstanceOf(Date);
     	*/
    	toBeInstanceOf: <E>(expected: E) => void;
    	/**
     	* Used to check that an object has a `.length` property
     	* and it is set to a certain numeric value.
     	*
     	* @example
     	* expect([1, 2, 3]).toHaveLength(3);
     	* expect('hello').toHaveLength(5);
     	*/
    	toHaveLength: (length: number) => void;
    	/**
     	* Use to check if a property at the specified path exists on an object.
     	* For checking deeply nested properties, you may use dot notation or an array containing
     	* the path segments for deep references.
     	*
     	* Optionally, you can provide a value to check if it matches the value present at the path
     	* on the target object. This matcher uses 'deep equality' (like `toEqual()`) and recursively checks
     	* the equality of all fields.
     	*
     	* @example
     	* expect(user).toHaveProperty('address.city', 'New York');
     	* expect(config).toHaveProperty(['settings', 'theme'], 'dark');
     	*/
    	toHaveProperty: <E>(property: string | (string | number)[], value?: E) => void;
    	/**
     	* Using exact equality with floating point numbers is a bad idea.
     	* Rounding means that intuitive things fail.
     	* The default for `numDigits` is 2.
     	*
     	* @example
     	* expect(price).toBeCloseTo(9.99, 2);
     	*/
    	toBeCloseTo: (number: number, numDigits?: number) => void;
    	/**
     	* Ensures that a mock function is called an exact number of times.
     	*
     	* Also under the alias `expect.toBeCalledTimes`.
     	*
     	* @example
     	* expect(mockFunc).toHaveBeenCalledTimes(2);
     	*/
    	toHaveBeenCalledTimes: (times: number) => void;
    	/**
     	* Ensures that a mock function is called an exact number of times.
     	*
     	* Alias for `expect.toHaveBeenCalledTimes`.
     	*
     	* @example
     	* expect(mockFunc).toBeCalledTimes(2);
     	* @deprecated Use `toHaveBeenCalledTimes` instead
     	*/
    	toBeCalledTimes: (times: number) => void;
    	/**
     	* Ensures that a mock function is called.
     	*
     	* Also under the alias `expect.toBeCalled`.
     	*
     	* @example
     	* expect(mockFunc).toHaveBeenCalled();
     	*/
    	toHaveBeenCalled: () => void;
    	/**
     	* Ensures that a mock function is called.
     	*
     	* Alias for `expect.toHaveBeenCalled`.
     	*
     	* @example
     	* expect(mockFunc).toBeCalled();
     	* @deprecated Use `toHaveBeenCalled` instead
     	*/
    	toBeCalled: () => void;
    	/**
     	* Ensure that a mock function is called with specific arguments.
     	*
     	* Also under the alias `expect.toBeCalledWith`.
     	*
     	* @example
     	* expect(mockFunc).toHaveBeenCalledWith('arg1', 42);
     	*/
    	toHaveBeenCalledWith: <E extends any[]>(...args: E) => void;
    	/**
     	* Ensure that a mock function is called with specific arguments.
     	*
     	* Alias for `expect.toHaveBeenCalledWith`.
     	*
     	* @example
     	* expect(mockFunc).toBeCalledWith('arg1', 42);
     	* @deprecated Use `toHaveBeenCalledWith` instead
     	*/
    	toBeCalledWith: <E extends any[]>(...args: E) => void;
    	/**
     	* Ensure that a mock function is called with specific arguments on an Nth call.
     	*
     	* Also under the alias `expect.nthCalledWith`.
     	*
     	* @example
     	* expect(mockFunc).toHaveBeenNthCalledWith(2, 'secondArg');
     	*/
    	toHaveBeenNthCalledWith: <E extends any[]>(n: number, ...args: E) => void;
    	/**
     	* If you have a mock function, you can use `.toHaveBeenLastCalledWith`
     	* to test what arguments it was last called with.
     	*
     	* Also under the alias `expect.lastCalledWith`.
     	*
     	* @example
     	* expect(mockFunc).toHaveBeenLastCalledWith('lastArg');
     	*/
    	toHaveBeenLastCalledWith: <E extends any[]>(...args: E) => void;
    	/**
     	* Used to test that a function throws when it is called.
     	*
     	* Also under the alias `expect.toThrowError`.
     	*
     	* @example
     	* expect(() => functionWithError()).toThrow('Error message');
     	* expect(() => parseJSON('invalid')).toThrow(SyntaxError);
     	* expect(() => { throw 42 }).toThrow(42);
     	*/
    	toThrow: (expected?: any) => void;
    	/**
     	* Used to test that a function throws when it is called.
     	*
     	* Alias for `expect.toThrow`.
     	*
     	* @example
     	* expect(() => functionWithError()).toThrowError('Error message');
     	* expect(() => parseJSON('invalid')).toThrowError(SyntaxError);
     	* expect(() => { throw 42 }).toThrowError(42);
     	* @deprecated Use `toThrow` instead
     	*/
    	toThrowError: (expected?: any) => void;
    	/**
     	* Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
     	*
     	* Alias for `expect.toHaveReturned`.
     	*
     	* @example
     	* expect(mockFunc).toReturn();
     	* @deprecated Use `toHaveReturned` instead
     	*/
    	toReturn: () => void;
    	/**
     	* Use to test that the mock function successfully returned (i.e., did not throw an error) at least one time
     	*
     	* Also under the alias `expect.toReturn`.
     	*
     	* @example
     	* expect(mockFunc).toHaveReturned();
     	*/
    	toHaveReturned: () => void;
    	/**
     	* Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
     	* Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
     	*
     	* Alias for `expect.toHaveReturnedTimes`.
     	*
     	* @example
     	* expect(mockFunc).toReturnTimes(3);
     	* @deprecated Use `toHaveReturnedTimes` instead
     	*/
    	toReturnTimes: (times: number) => void;
    	/**
     	* Use to ensure that a mock function returned successfully (i.e., did not throw an error) an exact number of times.
     	* Any calls to the mock function that throw an error are not counted toward the number of times the function returned.
     	*
     	* Also under the alias `expect.toReturnTimes`.
     	*
     	* @example
     	* expect(mockFunc).toHaveReturnedTimes(3);
     	*/
    	toHaveReturnedTimes: (times: number) => void;
    	/**
     	* Use to ensure that a mock function returned a specific value.
     	*
     	* Alias for `expect.toHaveReturnedWith`.
     	*
     	* @example
     	* expect(mockFunc).toReturnWith('returnValue');
     	* @deprecated Use `toHaveReturnedWith` instead
     	*/
    	toReturnWith: <E>(value: E) => void;
    	/**
     	* Use to ensure that a mock function returned a specific value.
     	*
     	* Also under the alias `expect.toReturnWith`.
     	*
     	* @example
     	* expect(mockFunc).toHaveReturnedWith('returnValue');
     	*/
    	toHaveReturnedWith: <E>(value: E) => void;
    	/**
     	* Use to test the specific value that a mock function last returned.
     	* If the last call to the mock function threw an error, then this matcher will fail
     	* no matter what value you provided as the expected return value.
     	*
     	* Also under the alias `expect.lastReturnedWith`.
     	*
     	* @example
     	* expect(mockFunc).toHaveLastReturnedWith('lastValue');
     	*/
    	toHaveLastReturnedWith: <E>(value: E) => void;
    	/**
     	* Use to test the specific value that a mock function returned for the nth call.
     	* If the nth call to the mock function threw an error, then this matcher will fail
     	* no matter what value you provided as the expected return value.
     	*
     	* Also under the alias `expect.nthReturnedWith`.
     	*
     	* @example
     	* expect(mockFunc).toHaveNthReturnedWith(2, 'nthValue');
     	*/
    	toHaveNthReturnedWith: <E>(nthCall: number, value: E) => void;
}

declare type JsonOptions = FileOptions;

declare type JsonReporterOptions = {
    /**
     * Write report JSON to a file instead of stdout.
     */ outputPath?: string;
};

declare type JsonSummaryOptions = FileOptions;

declare type Jump = (tickValue: number | string | TemporalDuration) => number;

declare interface LcovOnlyOptions extends FileOptions, ProjectOptions {}

declare interface LcovOptions extends FileOptions, ProjectOptions {}

declare interface LinkMapper {
    getPath(node: string | Node_2): string;
    relativePath(source: string | Node_2, target: string | Node_2): string;
    assetPath(node: Node_2, name: string): string;
}

declare type Location_2 = {
    line: number;
    column: number;
};

declare interface Location_3 {
    line: number;
    column: number;
}

declare type LooseRstestConfig = Omit<RstestConfig, 'reporters'> & {
    reporters?: any;
};

declare function matcherHint(matcherName: string, received?: string, expected?: string, options?: MatcherHintOptions): string;

declare interface MatcherHintOptions {
    	comment?: string;
    	expectedColor?: Formatter;
    	isDirectExpectCall?: boolean;
    	isNot?: boolean;
    	promise?: string;
    	receivedColor?: Formatter;
    	secondArgument?: string;
    	secondArgumentColor?: Formatter;
}

declare interface Matchers<T = any> {}

declare type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>> & ThisType<T> & { [K in keyof Matchers<T>]? : RawMatcherFn<T, Parameters<Matchers<T>[K]>> };

declare interface MatcherState {
    	customTesters: Array<Tester>;
    	assertionCalls: number;
    	currentTestName?: string;
    	/**
     	* @deprecated exists only in types
     	*/
    	dontThrow?: () => void;
    	/**
     	* @deprecated exists only in types
     	*/
    	error?: Error;
    	equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
    	/**
     	* @deprecated exists only in types
     	*/
    	expand?: boolean;
    	expectedAssertionsNumber?: number | null;
    	expectedAssertionsNumberErrorGen?: (() => Error) | null;
    	isExpectingAssertions?: boolean;
    	isExpectingAssertionsError?: Error | null;
    	isNot: boolean;
    	promise: string;
    	/**
     	* @deprecated exists only in types
     	*/
    	suppressedErrors: Array<Error>;
    	testPath?: string;
    	utils: ReturnType<typeof getMatcherUtils> & {
        		diff: typeof diff;
        		stringify: typeof stringify;
        		iterableEquality: Tester;
        		subsetEquality: Tester;
        	};
    	soft?: boolean;
    	poll?: boolean;
    	/**
     	* The same assertion instance that chai plugins receive.
     	* @experimental
     	* @see {@link https://www.chaijs.com/guide/plugins/} Core Plugin Concepts
     	*/
    	readonly assertion: Assertion_2;
}

declare interface MatcherState_2 extends MatcherState {
    environment: string;
    snapshotState: SnapshotState;
}

/** Same shape as expect.extend custom matcher result (SyncExpectationResult from @vitest/expect) */
declare interface MatchResult {
    	pass: boolean;
    	message: () => string;
    	actual?: unknown;
    	expected?: unknown;
}

declare type MaybeMockedDeep<T> = T extends Constructor ? MockedClassDeep<T> : T extends MockProcedure ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;

declare type MaybePartiallyMocked<T> = T extends Constructor ? MockedClass<T> : T extends MockProcedure ? MockedFunction<T> : T extends object ? MockedObject<T> : T;

declare type MaybePartiallyMockedDeep<T> = T extends Constructor ? MockedClassDeep<T> : T extends MockProcedure ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;

declare type MaybePromise<T> = T | Promise<T>;

declare type MdReporterOptions = {
    /**
     * Output detail level preset.
     * - `'normal'`: balanced output with code frames, repro commands, and candidate files
     * - `'compact'`: minimal output without code frames, candidate files, or full stack traces
     * - `'full'`: verbose output including console logs and environment info
     * @default 'normal'
     */ preset?: 'normal' | 'compact' | 'full';
    /**
     * Header section controls.
     * - `false`: omit all header extras (runtime/env)
     * - `true`: include all default header extras
     * - object form: toggle individual parts
     * @default { env: true }
     */ header?: boolean | {
        env?: boolean;
    };
    /**
     * Reproduction command controls.
     * - `false`: omit reproduction commands
     * - `'file'`: only include the test file path
     * - `'file+name'`: include both file path and `--testNamePattern`
     * - `true`: same as `'file+name'`
     * @default 'file+name'
     */ reproduction?: boolean | 'file' | 'file+name';
    /**
     * Test lists (Passed / Skipped / Todo) display mode.
     * - `'auto'`: show only when all tests pass and the run is focused
     * - `'always'`: always show regardless of test status or focus
     * @default 'auto'
     */ testLists?: 'auto' | 'always';
    /**
     * Failure output controls.
     * @default { max: 50 }
     */ failures?: {
        max?: number;
    };
    /**
     * Code frame controls.
     * - `false`: disable code frames
     * - `true`: enable with default line window
     * - object form: customize line window
     * @default { linesAbove: 2, linesBelow: 2 }
     */ codeFrame?: boolean | {
        linesAbove?: number;
        linesBelow?: number;
    };
    /**
     * Stack output controls.
     * - `false`: omit stack info
     * - `'top'`: include only the top frame
     * - `number`: include up to N stack frames
     * - `'full'`: include a large default number of stack frames
     * @default 'top'
     */ stack?: number | false | 'full' | 'top';
    /**
     * Candidate files controls (best-effort files extracted from stack traces).
     * - `false`: omit candidate files
     * - `true`: enable with defaults
     * - object form: customize max items
     * @default { max: 5 }
     */ candidateFiles?: boolean | {
        max?: number;
    };
    /**
     * Console output controls.
     * - `false`: omit console logs
     * - `true`: include console logs with defaults
     * - object form: customize limits
     * @default { maxLogsPerTestPath: 10, maxCharsPerEntry: 500 }
     */ console?: boolean | {
        maxLogsPerTestPath?: number;
        maxCharsPerEntry?: number;
    };
    /**
     * Error section controls.
     * @default { unhandled: true }
     */ errors?: boolean | {
        unhandled?: boolean;
    };
};

declare interface Memorize {
    	(pointer: "expected" | "actual", stringifiedValue: string): string;
}

declare type Methods<T> = {
    [K in keyof T]: T[K] extends MockProcedure ? K : never;
}[keyof T];

export declare interface Mock<T extends FunctionLike = FunctionLike> extends MockInstance<T> {
    new(...args: Parameters<T>): ReturnType<T>;
    (...args: Parameters<T>) : ReturnType<T>;
}

declare type MockContext<T extends FunctionLike = FunctionLike> = {
    /**
     * List of the call arguments of all calls that have been made to the mock.
     */ calls: Parameters<T>[];
    /**
     * List of all the object instances that have been instantiated from the mock.
     */ instances: ReturnType<T>[];
    /**
     * List of all the function contexts that have been applied to calls to the mock.
     */ contexts: ThisParameterType<T>[];
    /**
     * The order of mock's execution.
     * This returns an array of numbers which are shared between all defined mocks.
     * The index is starting with `1`.
     */ invocationCallOrder: number[];
    /**
     * List of the call arguments of the last call that was made to the mock.
     * If the function was not called, it will return `undefined`.
     */ lastCall: Parameters<T> | undefined;
    /**
     * List of the results of all calls that have been made to the mock.
     */ results: MockResult<ReturnType<T>>[];
    /**
     * List of the results of all values that were `resolved` or `rejected` from the function.
     */ settledResults: MockSettledResult<Awaited<ReturnType<T>>>[];
};

export declare type Mocked<T> = T extends Constructor ? MockedClass<T> : T extends MockProcedure ? MockedFunction<T> : T extends object ? MockedObject<T> : T;

declare type MockedCallable<T extends MockProcedure> = OmitThisParameter<T> & ConstructSignature<T> & Mock<T>;

declare type MockedClass<T extends Constructor> = MockedClassBase<T> & MockedObject<T>;

declare type MockedClassBase<T extends Constructor> = Mock<(...args: ConstructorParameters<T>) => InstanceType<T>> & {
    new(...args: ConstructorParameters<T>): InstanceType<T>;
    prototype: InstanceType<T>;
};

declare type MockedClassDeep<T extends Constructor> = MockedClassBase<T> & MockedObjectDeep<T>;

declare type MockedFunction<T extends MockProcedure> = MockedCallable<T> & {
    [K in keyof T]: T[K];
};

declare type MockedFunctionDeep<T extends MockProcedure> = MockedCallable<T> & MockedObjectDeep<T>;

declare type MockedObject<T> = {
    [K in Methods<T>]: T[K] extends MockProcedure ? MockedFunction<T[K]> : T[K];
} & {
    [K in Properties<T>]: T[K];
};

declare type MockedObjectDeep<T> = {
    [K in Methods<T>]: T[K] extends MockProcedure ? MockedFunctionDeep<T[K]> : T[K];
} & {
    [K in Properties<T>]: MaybeMockedDeep<T[K]>;
};

declare type MockFactory<T = unknown> = () => Partial<T>;

declare type MockFn = <T extends FunctionLike = FunctionLike>(fn?: T) => Mock<T>;

export declare interface MockInstance<T extends FunctionLike = FunctionLike> {
    _isMockFunction: true;
    /**
     * Returns the mock name string set by calling `.mockName()`
     */ getMockName(): string;
    /**
     * Sets the mock name for this mock.
     */ mockName(name: string): this;
    mock: MockContext<T>;
    /**
     * Clears all information about every call.
     */ mockClear(): this;
    /**
     * Does what `mockClear` does and resets inner implementation to the original function.
     */ mockReset(): this;
    /**
     * Does what `mockReset` does and restores original descriptors of spied-on objects.
     */ mockRestore(): void;
    /**
     * Restores the mock when it leaves a `using` scope.
     */ [Symbol.dispose](): void;
    /**
     * Returns current mock implementation if there is one.
     */ getMockImplementation(): NormalizedProcedure<T> | undefined;
    /**
     * Accepts a function that should be used as the implementation of the mock.
     */ mockImplementation(fn: NormalizedProcedure<T>): this;
    /**
     * Accepts a function that will be used as an implementation of the mock for one call to the mocked function.
     */ mockImplementationOnce(fn: NormalizedProcedure<T>): this;
    /**
     * Accepts a function which should be temporarily used as the implementation of the mock while the callback is being executed.
     */ withImplementation<T2>(fn: NormalizedProcedure<T>, callback: () => T2): T2 extends Promise<unknown> ? Promise<this> : this;
    /**
     * Return the `this` context from the method without invoking the actual implementation.
     */ mockReturnThis(): this;
    /**
     * Accepts a value that will be returned whenever the mock function is called.
     */ mockReturnValue(value: ReturnType<T>): this;
    /**
     * Accepts a value that will be returned for one call to the mock function.
     */ mockReturnValueOnce(value: ReturnType<T>): this;
    /**
     * Accepts a value that will be thrown whenever the mock function is called.
     */ mockThrow(value: unknown): this;
    /**
     * Accepts a value that will be thrown during the next function call.
     */ mockThrowOnce(value: unknown): this;
    /**
     * Accepts a value that will be resolved when the async function is called.
     */ mockResolvedValue(value: Awaited<ReturnType<T>>): this;
    /**
     * Accepts a value that will be resolved during the next function call.
     */ mockResolvedValueOnce(value: Awaited<ReturnType<T>>): this;
    /**
     * Accepts an error that will be rejected when async function is called.
     */ mockRejectedValue(error: unknown): this;
    /**
     * Accepts a value that will be rejected during the next function call.
     */ mockRejectedValueOnce(error: unknown): this;
}

/**
 * Options for rs.mock module mocking.
 * Supports `{ spy: true }` or `{ mock: true }`.
 */ declare type MockModuleOptions = {
    /**
     * If `true`, the module will be auto-mocked but the original implementations
     * will be preserved - all exports will be wrapped in spy functions that track calls.
     */ spy: true;
} | {
    /**
     * If `true`, the module will be auto-mocked with all exports replaced by mock functions.
     * Original implementations will NOT be preserved.
     */ mock: true;
};

/**
 * Options for mockObject
 */ declare interface MockOptions {
    /**
     * If `true`, the original implementation will be kept.
     * All methods will call the original implementation, but you can still track the calls.
     */ spy?: boolean;
}

declare type MockProcedure = (...args: any[]) => any;

declare type MockResult<T> = MockResultReturn<T> | MockResultThrow | MockResultIncomplete;

declare interface MockResultIncomplete {
    type: 'incomplete';
    value: undefined;
}

declare interface MockResultReturn<T> {
    type: 'return';
    /**
     * The value that was returned from the function. If function returned a Promise, then this will be a resolved value.
     */ value: T;
}

declare interface MockResultThrow {
    type: 'throw';
    /**
     * An error that was thrown during function execution.
     */ value: any;
}

declare type MockSettledResult<T> = MockSettledResultFulfilled<T> | MockSettledResultRejected;

declare interface MockSettledResultFulfilled<T> {
    type: 'fulfilled';
    value: T;
}

declare interface MockSettledResultRejected {
    type: 'rejected';
    value: any;
}

declare type NamesIndex = number;

declare interface NewPlugin {
    	serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
    	test: Test_2;
}

declare type Next = () => number;

declare type NextAsync = () => Promise<number>;

declare type NextTick = (callback: VoidVarArgsFunc, ...args: unknown[]) => void;

declare interface Node_2 {
    isRoot(): boolean;
    visit(visitor: Visitor, state: any): void;
}

declare type NodeImmediate = {
    hasRef: NodeImmediateHasRef;
    ref: NodeImmediateRef;
    unref: NodeImmediateUnref;
};

declare type NodeImmediateHasRef = () => boolean;

declare type NodeImmediateRef = () => NodeImmediate;

declare type NodeImmediateUnref = () => NodeImmediate;

declare type NormalizedBrowserModeConfig = {
    enabled: boolean;
    provider: BrowserProvider;
    browser: BrowserName;
    headless: boolean;
    port?: number;
    strictPort: boolean;
    viewport?: BrowserViewport;
    providerOptions: Record<string, unknown>;
};

declare type NormalizedConfig = Required<Omit<RstestConfig, OptionalKeys | 'pool' | 'projects' | 'coverage' | 'setupFiles' | 'globalSetup' | 'exclude' | 'testEnvironment' | 'browser' | 'output'>> & Partial<Pick<RstestConfig, OptionalKeys>> & {
    shard?: ShardConfig;
    pool: RstestPoolOptions;
    testEnvironment: EnvironmentWithOptions;
    coverage: NormalizedCoverageOptions;
    browser: NormalizedBrowserModeConfig;
    setupFiles: string[];
    globalSetup: string[];
    exclude: {
        patterns: string[];
        override?: boolean;
    };
    output: NormalizedOutputConfig;
};

declare type NormalizedCoverageOptions = Required<Omit<CoverageOptions, 'thresholds' | 'include' | 'changed'>> & {
    thresholds?: CoverageThresholds;
    include?: string[];
    changed?: boolean | string;
};

declare type NormalizedFixture = {
    isFn: boolean;
    deps?: string[];
    value: FixtureFn<any, any, any> | any;
    options?: FixtureOptions;
};

declare type NormalizedFixtures = Record<string, NormalizedFixture>;

declare type NormalizedOutputConfig = Partial<Omit<RstestOutputConfig, 'distPath'>> & {
    distPath: {
        root: string;
    };
};

declare type NormalizedProcedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;

declare type NormalizedProjectConfig = Required<Omit<NormalizedConfig, OptionalKeys | 'projects' | 'reporters' | 'pool' | 'shard' | 'setupFiles' | 'globalSetup' | 'output'>> & Pick<NormalizedConfig, OptionalKeys> & {
    setupFiles: string[];
    globalSetup: string[];
    output?: Omit<NormalizedOutputConfig, 'distPath'>;
};

declare interface OldPlugin {
    	print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
    	test: Test_2;
}

export declare const onTestFailed: Rstest['onTestFailed'];

declare type OnTestFailedHandler = (ctx: TestContext) => MaybePromise<void>;

export declare const onTestFinished: Rstest['onTestFinished'];

declare type OnTestFinishedHandler = (ctx: TestContext) => MaybePromise<void>;

declare type OptionalKeys = 'testNamePattern' | 'plugins' | 'performance' | 'source' | 'resolve' | 'tools' | 'dev' | 'onConsoleLog' | 'silent' | 'chaiConfig' | 'hideSkippedTestFiles' | 'resolveSnapshotPath' | 'extends';

declare interface Options {
    logger: {
        outputStream: Writable;
        errorStream: Writable;
        getColumns: () => number;
    };
    interval?: number;
    getWindow: () => string[];
}

declare type OptionsReceived = PrettyFormatOptions;

declare interface ParsedStack {
    	method: string;
    	file: string;
    	line: number;
    	column: number;
}

declare type Plugin_2 = NewPlugin | OldPlugin;

declare interface PluginOptions {
    	edgeSpacing: string;
    	min: boolean;
    	spacing: string;
}

declare type Plugins = Array<Plugin_2>;

declare interface PrettyFormatOptions {
    	/**
     	* Call `toJSON` on objects before formatting them.
     	* Ignored after the formatter has already called `toJSON` once for a value.
     	* @default true
     	*/
    	callToJSON?: boolean;
    	/**
     	* Whether to escape special characters in regular expressions.
     	* @default false
     	*/
    	escapeRegex?: boolean;
    	/**
     	* Whether to escape special characters in strings.
     	* @default true
     	*/
    	escapeString?: boolean;
    	/**
     	* Whether to highlight syntax using terminal colors.
     	* @default false
     	*/
    	highlight?: boolean;
    	/**
     	* Number of spaces to use for each level of indentation.
     	* @default 2
     	*/
    	indent?: number;
    	/**
     	* Maximum depth to recurse into nested values.
     	* @default Infinity
     	*/
    	maxDepth?: number;
    	/**
     	* Maximum number of items to print in arrays, sets, maps, and similar collections.
     	* @default Infinity
     	*/
    	maxWidth?: number;
    	/**
     	* Approximate per-depth-level budget for output length.
     	* When the accumulated output at any single depth level exceeds this value,
     	* further nesting is collapsed. This is a heuristic safety valve, not a hard
     	* limit — total output can reach up to roughly `maxDepth × maxOutputLength`.
     	* @default 1_000_000
     	*/
    	maxOutputLength?: number;
    	/**
     	* Whether to minimize added whitespace, including indentation and line breaks.
     	* @default false
     	*/
    	min?: boolean;
    	/**
     	* Whether to print `Object` / `Array` prefixes for plain objects and arrays.
     	* @default true
     	*/
    	printBasicPrototype?: boolean;
    	/**
     	* Whether to include the function name when formatting functions.
     	* @default true
     	*/
    	printFunctionName?: boolean;
    	/**
     	* Whether to include shadow-root contents when formatting DOM nodes.
     	* @default true
     	*/
    	printShadowRoot?: boolean;
    	/**
     	* Compare function used when sorting object keys. Set to `null` to disable sorting.
     	*/
    	compareKeys?: CompareKeys;
    	/**
     	* Plugins used to serialize application-specific data types.
     	* @default []
     	*/
    	plugins?: Plugins;
}

declare type Print = (arg0: unknown) => string;

declare function printDiffOrStringify(received: unknown, expected: unknown, options?: DiffOptions, memory?: StringifiedMemory): string | undefined;

declare type Printer = (val: unknown, config: Config, indentation: string, depth: number, refs: Refs, hasCalledToJSON?: boolean) => string;

declare function printExpected(value: unknown): string;

declare function printReceived(object: unknown): string;

declare function printWithType<T>(name: string, value: T, print: (value: T) => string): string;

declare type Procedure = (...args: any[]) => any;

declare interface ProcessDomainSnapshotOptions {
    	testId: string;
    	received: string;
    	expectedSnapshot: ExpectedSnapshot;
    	matchResult?: DomainMatchResult;
    	isInline?: boolean;
    	assertionName?: string;
    	error?: Error;
}

declare type ProjectConfig = Omit<RstestConfig, 'projects' | 'reporters' | 'pool' | 'isolate' | 'coverage' | 'resolveSnapshotPath' | 'onConsoleLog' | 'silent' | 'bail' | 'output'> & {
    output?: Omit<RstestOutputConfig, 'distPath'>;
};

declare type ProjectContext = {
    name: string;
    environmentName: string;
    _environmentGroup?: {
        key: string;
        baseKey: string;
        baseTestEnvironment: NormalizedProjectConfig['testEnvironment'];
        sourceEnvironmentName: string;
        sourceProjectName: string;
        hasImplicitEntries?: boolean;
        environmentComment?: {
            name?: EnvironmentName;
            options?: Record<string, unknown>;
        };
    };
    /** The root path of current project. */ rootPath: string;
    /** Whether to output es module. */ outputModule: boolean;
    configFilePath?: string;
    normalizedConfig: NormalizedProjectConfig;
    _globalSetups: boolean;
};

declare interface ProjectOptions {
    projectRoot: string;
}

declare type Promisify<O> = { [K in keyof O] : O[K] extends (...args: infer A) => infer R ? Promisify<O[K]> & ((...args: A) => Promise<R>) : O[K] };

declare type Promisify_2<O> = {
    [K in keyof O]: O[K] extends (...args: infer A) => infer R ? Promisify_2<O[K]> & ((...args: A) => Promise<R>) : O[K];
};

declare type PromisifyAssertion<T> = Promisify<Assertion_2<T>>;

declare type PromisifyAssertion_2<T> = Promisify_2<Assertion<T>>;

declare type Properties<T> = {
    [K in keyof T]: T[K] extends MockProcedure ? never : K;
}[keyof T];

declare type QueueMicrotask = (callback: VoidVarArgsFunc) => void;

declare interface Range_2 {
    start: Location_3;
    end: Location_3;
}

declare interface RawMatcherFn<
	T extends MatcherState = MatcherState,
	E extends Array<any> = Array<any>
> {
    	(this: T, received: any, ...expected: E): ExpectationResult;
}

declare interface RawSnapshotInfo {
    	file: string;
    	readonly?: boolean;
    	content?: string;
}

declare type RealTimers = {
    setTimeout: typeof globalThis.setTimeout;
    clearTimeout: typeof globalThis.clearTimeout;
    setImmediate?: typeof globalThis.setImmediate;
};

declare type Refs = Array<unknown>;

declare class ReportBase {
    constructor(options?: Partial<ReportBaseOptions>);
    execute(context: Context): void;
}

declare interface ReportBaseOptions {
    summarizer: Summarizers;
}

declare interface Reporter {
    /**
     * Set to `false` when the reporter does not write to process stdout/stderr.
     * @default true
     */ flushOutputStreams?: boolean;
    /**
     * Called before test file run.
     */ onTestFileStart?: (test: TestFileInfo) => void;
    /**
     * Called after tests in file collected.
     */ onTestFileReady?: (test: TestFileInfo) => void;
    /**
     * Called when the test file has finished running.
     */ onTestFileResult?: (test: TestFileResult) => void;
    /**
     * Called before running the test suite.
     */ onTestSuiteStart?: (test: TestSuiteInfo) => void;
    /**
     * Called when the suite has finished running or was just skipped.
     *
     * `result.errors` contains only suite hooks errors
     */ onTestSuiteResult?: (result: TestResult) => void;
    /**
     * Called when the test has finished running or was just skipped.
     */ onTestCaseResult?: (result: TestResult) => void;
    /**
     * Called before running the test case.
     */ onTestCaseStart?: (test: TestCaseInfo) => void;
    /**
     * Called before all tests start
     */ onTestRunStart?: () => MaybePromise<void>;
    /**
     * Called after all tests have finished running.
     */ onTestRunEnd?: ({ results, coverage, testResults, duration, getSourcemap, snapshotSummary, unhandledErrors }: {
        results: TestFileResult[];
        coverage?: CoverageMapData;
        testResults: TestResult[];
        duration: Duration;
        getSourcemap: GetSourcemap;
        unhandledErrors?: Error[];
        snapshotSummary: SnapshotSummary;
        filterRerunTestPaths?: string[];
    }) => MaybePromise<void>;
    /**
     * Called when console log is calling.
     */ onUserConsoleLog?: (log: UserConsoleLog) => void;
    /**
     * Called when rstest exit abnormally
     */ onExit?: () => void;
}

declare type ReporterWithOptions<Name extends BuiltInReporterNames = BuiltInReporterNames> = Name extends keyof BuiltinReporterOptions ? [Name, Partial<BuiltinReporterOptions[Name]>] : [Name, Record<string, unknown>];

declare interface ReportOptions {
    clover: CloverOptions;
    cobertura: CoberturaOptions;
    "html-spa": HtmlSpaOptions;
    html: HtmlOptions;
    json: JsonOptions;
    "json-summary": JsonSummaryOptions;
    lcov: LcovOptions;
    lcovonly: LcovOnlyOptions;
    none: never;
    teamcity: TeamcityOptions;
    text: TextOptions;
    "text-lcov": TextLcovOptions;
    "text-summary": TextSummaryOptions;
}

declare type ReportWithOptions<Name extends keyof ReportOptions = keyof ReportOptions> = Name extends keyof ReportOptions ? [Name, Partial<ReportOptions[Name]>] : [Name, Record<string, unknown>];

declare type RequestAnimationFrame = (callback: AnimationFrameCallback) => TimerId;

declare type RequestIdleCallback = (callback: RequestIdleCallbackCallback, options?: {
    timeout?: number;
}) => number;

declare type RequestIdleCallbackCallback = (deadline: IdleDeadline_2) => any;

declare type Reset = () => void;

declare type Ro<T> = T extends Array<infer V> ? V[] | Readonly<V[]> | RoArray<V> | Readonly<RoArray<V>> : T extends object ? T | Readonly<T> | RoObject<T> | Readonly<RoObject<T>> : T;

declare type RoArray<T> = Ro<T>[];

declare type RoObject<T> = {
    [K in keyof T]: T[K] | Ro<T[K]>;
};

export declare const rs: RstestUtilities;

declare type Rstest = RunnerAPI & {
    expect: RstestExpect;
    assert: typeof assert_2;
    rstest: RstestUtilities;
    rs: RstestUtilities;
};

export declare const rstest: RstestUtilities;

/**
 * Key under which the per-file runtime API object is published on the
 * executor's global; `import.meta.rstest` defines compile to a read of it, and
 * the mock hoister keeps `@rstest/core` external against the same key.
 * node: `rstestContext.global[KEY]` (runInPool); web: `globalThis[KEY]`
 * (browser client entry). Other `'@rstest/core'` string literals in the
 * codebase (the module-cache id in `core/plugins/moduleCacheControl.ts`, the
 * reporter package label in `reporter/md.ts`) have unrelated semantics and
 * must NOT be replaced with this constant.
 */
export declare const RSTEST_API_GLOBAL_KEY = '@rstest/core';

/**
 * Description key of the well-known `Symbol.for(...)` under which Rstest stores
 * the runtime env store on `globalThis`. Single owner of the string, shared by
 * three contexts that must resolve the SAME registry symbol: the core worker
 * runtime and the browser client both call `Symbol.for(RSTEST_ENV_SYMBOL_KEY)`,
 * while the host bakes it into the rspack `define` text via
 * `JSON.stringify(RSTEST_ENV_SYMBOL_KEY)`. Kept a plain string (not a Symbol) so
 * it serves both the runtime and the build-define codegen path. Re-exported from
 * both `./internal/browser-runtime` and `./internal/browser` barrels.
 */
export declare const RSTEST_ENV_SYMBOL_KEY = 'rstest.env';

declare type RstestBuildCacheConfig = {
    /**
     * Directory used to store Rsbuild persistent cache files.
     *
     * When omitted, rstest stores cache files under
     * `node_modules/.cache/rstest-<project-name>`.
     */ cacheDirectory?: string;
    /**
     * Additional values that should invalidate the persistent cache when changed.
     *
     * rstest appends its own runtime digest automatically.
     */ cacheDigest?: Array<string | undefined>;
    /**
     * Additional files that should invalidate the persistent cache when changed.
     *
     * rstest automatically adds the active rstest config file, project config
     * files, and discovered tsconfig paths when available.
     */ buildDependencies?: string[];
};

declare type RstestCommand = 'watch' | 'run' | 'list' | 'merge-reports';

declare interface RstestConfig {
    /**
     * Extend configuration from adapters
     */ extends?: ExtendConfigFn | ExtendConfig | (ExtendConfigFn | ExtendConfig)[];
    /**
     * Project root
     *
     * @default process.cwd()
     */ root?: string;
    /**
     * Run tests from one or more projects.
     */ projects?: TestProject[];
    /**
     * Project name
     *
     * @default rstest
     */ name?: string;
    /**
     * A list of glob patterns that match your test files.
     *
     * @default ['**\/*.{test,spec}.?(c|m)[jt]s?(x)']
     */ include?: string[];
    /**
     * A list of glob patterns that should be excluded from your test files.
     *
     * @default ['**\/node_modules/**', '**\/dist/**']
     */ exclude?: string[] | {
        patterns: string[];
        /**
         * override default exclude patterns
         * @default false
         */ override?: boolean;
    };
    /**
     * A list of glob patterns that match your in-source test files
     *
     * @default []
     */ includeSource?: string[];
    /**
     * A list of glob patterns that trigger running the whole test suite when
     * matched by changed files collected from `--changed`.
     *
     * @default ['**\/package.json/**', '**\/rstest.config.*']
     */ forceRerunTriggers?: string[];
    /**
     * Path to setup files. They will be run before each test file.
     */ setupFiles?: string[] | string;
    /**
     * Path to global setup files, relative to project root.
     * A global setup file can either export named functions `setup` and `teardown`
     * or a `default` function that returns a teardown function.
     */ globalSetup?: string[] | string;
    /**
     * Retry the test specific number of times if it fails.
     * @default 0
     */ retry?: number;
    /**
     * Pass when no tests are found.
     *
     * @default false
     */ passWithNoTests?: boolean;
    /**
     * Run only the test files that failed in the previous run, backed by the
     * persistent results cache. File-level granularity: the whole failed test
     * file re-runs. When there are no previously-failed files (or no cache yet),
     * all tests run with a notice.
     *
     * @default false
     */ onlyFailures?: boolean;
    /**
     * Pool used to run tests in.
     */ pool?: RstestPoolType | RstestPoolOptions;
    /**
     * Run tests in an isolated environment
     *
     * @default true
     */ isolate?: boolean;
    /**
     * Provide global APIs
     *
     * @default false
     */ globals?: boolean;
    /**
     * The environment that will be used for testing
     *
     * @default 'node'
     */ testEnvironment?: EnvironmentName | EnvironmentWithOptions;
    /**
     * Stop running tests after n failures.
     * Set to 0 to run all tests regardless of failures.
     *
     * @default 0
     */ bail?: number;
    /**
     * print console traces when calling any console method.
     *
     * @default false
     */ printConsoleTrace?: boolean;
    /**
     * Disable console intercept enhancements. `onConsoleLog` & `printConsoleTrace`
     * configuration will not take effect. When `silent` is enabled, Rstest still
     * uses an internal console interception path to control test log output.
     *
     * @default false
     */ disableConsoleIntercept?: boolean;
    /**
     * Silence intercepted console output from tests.
     * - `true`: hide all intercepted test console logs
     * - `'passed-only'`: show intercepted logs only for failed tasks
     *
     * @default false
     */ silent?: boolean | 'passed-only';
    /**
     * Update snapshot files. Will update all changed snapshots and delete obsolete ones.
     *
     * @default false
     */ update?: boolean;
    /**
     * Custom reporter for output.
     * @default ['default']
     */ reporters?: Reporter | BuiltInReporterNames | (Reporter | BuiltInReporterNames | [BuiltInReporterNames] | ReporterWithOptions)[];
    /**
     * Hide skipped tests logs.
     *
     * @default false
     */ hideSkippedTests?: boolean;
    /**
     * Hide skipped test files logs.
     *
     * @default false
     */ hideSkippedTestFiles?: boolean;
    /**
     * Run only tests with a name that matches the regex.
     */ testNamePattern?: string | RegExp;
    /**
     * Timeout of a test in milliseconds.
     * @default 5000
     */ testTimeout?: number;
    /**
     * Timeout of hook in milliseconds.
     * @default 10000
     */ hookTimeout?: number;
    /**
     * Automatically clear mock calls, instances, contexts and results before every test.
     * @default false
     */ clearMocks?: boolean;
    /**
     * Automatically reset mock state before every test.
     * @default false
     */ resetMocks?: boolean;
    /**
     * Automatically restore mock state and implementation before every test.
     * @default false
     */ restoreMocks?: boolean;
    /**
     * The number of milliseconds after which a test or suite is considered slow and reported as such in the results.
     * @default 300
     */ slowTestThreshold?: number;
    /**
     * Detect async resources that are still active after a test file finishes.
     * This may slow down tests and should be used for debugging leaks.
     * @default false
     */ detectAsyncLeaks?: boolean;
    /**
     * Restores all global variables that were changed with `rstest.stubGlobal` before every test.
     * @default false
     */ unstubGlobals?: boolean;
    /**
     * Restores all runtime env values that were changed with `rstest.stubEnv` before every test.
     * @default false
     */ unstubEnvs?: boolean;
    /**
     * Maximum number of concurrent tests
     * @default 5
     */ maxConcurrency?: number;
    /**
     * Log heap usage after each test
     * @default false
     */ logHeapUsage?: boolean;
    /**
     * Custom handler for console log in tests.
     *
     * Return `false` to silence the log.
     *
     * @param content - The console output text.
     * @param type - Which stream the output came from.
     */ onConsoleLog?: (content: string, type: ConsoleStreamType) => boolean | void;
    /** Format snapshot output */ snapshotFormat?: SnapshotFormat;
    /**
     * Resolve custom snapshot path
     */ resolveSnapshotPath?: (testPath: string, snapExtension: string) => string;
    /**
     * Custom environment variables available on `process.env` during tests.
     */ env?: Partial<NodeJS.ProcessEnv>;
    /**
     * Browser mode configuration.
     */ browser?: BrowserModeConfig;
    /**
     * Enable Module Federation compatibility mode for Node tests.
     *
     * When enabled, Rstest installs runtime shims so that Module Federation
     * runtimes which load chunks via Node `fs`/`vm`/`eval` or HTTP work inside
     * the test worker.
     * @default false
     */ federation?: boolean;
    /**
     * Coverage options
     */ coverage?: CoverageOptions;
    /**
     * Performance-related Rsbuild options used by rstest.
     */ performance?: RstestPerformanceConfig;
    /**
     * chai configuration options
     */ chaiConfig?: ChaiConfig;
    /**
     * Include `location` property in `TestInfo` received by reporters
     */ includeTaskLocation?: boolean;
    // Rsbuild configs
    plugins?: RsbuildConfig['plugins'];
    source?: Pick<NonNullable<RsbuildConfig['source']>, 'assetsInclude' | 'define' | 'tsconfigPath' | 'decorators' | 'include' | 'exclude' | 'transformImport' | 'assetsInclude'>;
    dev?: Pick<NonNullable<RsbuildConfig['dev']>, 'writeToDisk'>;
    output?: RstestOutputConfig;
    resolve?: RsbuildConfig['resolve'];
    tools?: Pick<NonNullable<RsbuildConfig['tools']>, 'rspack' | 'swc' | 'bundlerChain'>;
}

declare type RstestContext = {
    /** The Rstest core version. */ version: string;
    /** The root path of rstest. */ rootPath: string;
    /** The original Rstest config passed from the createRstest method. */ originalConfig: Readonly<RstestConfig>;
    /** The normalized Rstest config. */ normalizedConfig: NormalizedConfig;
    /** filter by a filename regex pattern */ fileFilters?: string[];
    /** How file filters should match discovered test files. */ fileFilterMode?: FileFilterMode;
    /** Original source filters passed to `--related`, `--findRelatedTests`, or resolved from `--changed`. */ relatedFilters?: string[];
    /** CLI option that produced related source filters. */ relatedMode?: 'related' | 'changed';
    /** Related test resolution completed successfully but matched no test files. */ relatedResolutionEmpty?: boolean;
    /** Changed source files used to limit coverage reports for `--changed`. */ changedCoverageFilters?: string[];
    /** Why a related run was expanded back to the full test suite. */ relatedRerunReason?: 'forceRerunTrigger';
    /** Changed files that caused a related run to expand back to the full test suite. */ relatedRerunFiles?: string[];
    /** The config file path. */ configFilePath?: string;
    /**
     * Run tests from one or more projects.
     */ projects: ProjectContext[];
    /**
     * The test state
     */ testState: RstestTestState;
    /**
     * The command type.
     *
     * - run: `rstest`
     * - dev: `rstest dev` or watch mode
     * - list: `rstest list`
     */ command: RstestCommand;
    /**
     * Dump a Perfetto-compatible performance trace JSON file. CLI-only switch;
     * not exposed via user config.
     *
     * @internal
     */ trace: boolean;
    /** See the `embedded` option on `createRstest`. */ embedded: boolean;
    reporters: Reporter[];
    snapshotManager: SnapshotManager;
    stateManager: TestStateManager;
    reporterResults: {
        results: TestFileResult[];
        testResults: TestResult[];
    };
    /** Merge a batch of file/test results into `reporterResults`. */ updateReporterResultState: (results: TestFileResult[], testResults: TestResult[], deletedEntries?: string[]) => void;
};

declare type RstestExpect = ExpectStatic;

declare type RstestOutputConfig = Pick<NonNullable<RsbuildConfig['output']>, 'cssModules' | 'emitAssets' | 'externals' | 'cleanDistPath' | 'module'> & {
    distPath?: string | {
        root?: string;
    };
    /**
     * Whether to bundle third-party dependencies from node_modules.
     * - `true`: Always bundle all third-party dependencies.
     * - `false`: Always externalize third-party dependencies.
     * - `['pkg']`: Bundle the package and all of its subpaths.
     * - `['pkg/subpath']`: Bundle a specific package subpath.
     * - `['pkg/*']`: Bundle package subpaths that match the pattern.
     * - `[/^pkg\\/subpath/]`: Bundle package requests matched by a regular
     *   expression.
     *
     * When unset, rstest bundles dependencies in browser-like test
     * environments (jsdom, happy-dom, etc.) and externalizes them in the node
     * environment. This option is not supported in browser mode.
     */ bundleDependencies?: boolean | BundleDependencyPattern[];
};

declare type RstestPerformanceConfig = {
    /**
     * Enable Rsbuild persistent build cache for test builds.
     *
     * When set to `true`, rstest uses a cache directory outside the temporary
     * output folder and appends rstest-specific invalidation inputs.
     *
     * @default false
     */ buildCache?: boolean | RstestBuildCacheConfig;
};

declare type RstestPoolOptions = {
    /** Pool used to run tests in. */ type?: RstestPoolType;
    /** Maximum number or percentage of workers to run tests in. */ maxWorkers?: number | string;
    /** Pass additional arguments to node process in the child processes. */ execArgv?: string[];
};

declare type RstestPoolType = 'forks' | 'threads';

declare type RstestTestState = {
    getRunningModules: () => RunningModules;
    getTestModules: () => TestFileResult[];
    /** Get the test files paths. return `undefined` in watch mode. */ getTestFiles: () => string[] | undefined;
};

declare interface RstestUtilities {
    /**
     * Creates a spy on a function.
     */ fn: MockFn;
    /**
     * Creates a spy on a method of an object
     */ spyOn: <T extends Record<string, any>, K extends keyof T>(obj: T, methodName: K, accessType?: 'get' | 'set') => MockInstance<T[K]>;
    /**
     * Determines if the given function is a mocked function.
     */ isMockFunction: (fn: any) => fn is MockInstance;
    /**
     * Deeply mocks properties and methods of a given object
     * in the same way as `rstest.mock()` mocks module exports.
     *
     * @example
     * ```ts
     * const original = {
     *   simple: () => 'value',
     *   nested: {
     *     method: () => 'real'
     *   },
     *   prop: 'foo',
     * }
     *
     * const mocked = rstest.mockObject(original)
     * expect(mocked.simple()).toBe(undefined)
     * expect(mocked.nested.method()).toBe(undefined)
     * expect(mocked.prop).toBe('foo')
     *
     * mocked.simple.mockReturnValue('mocked')
     * expect(mocked.simple()).toBe('mocked')
     *
     * // With spy option to keep original implementations
     * const spied = rstest.mockObject(original, { spy: true })
     * expect(spied.simple()).toBe('value')
     * expect(spied.simple).toHaveBeenCalled()
     * ```
     *
     * @param value - The object to be mocked
     * @param options - Mock options
     * @returns A deeply mocked version of the input object
     */ mockObject: <T>(value: T, options?: MockOptions) => MaybeMockedDeep<T>;
    /**
     * Type helper for TypeScript. Just returns the object that was passed.
     *
     * When `partial` is `true` it will expect a `Partial<T>` as a return value.
     * By default, this will only make TypeScript believe that the first level values are mocked.
     * You can pass down `{ deep: true }` as a second argument to tell TypeScript
     * that the whole object is mocked, if it actually is.
     *
     * @example
     * ```ts
     * import example from './example.js'
     *
     * rstest.mock('./example.js')
     *
     * test('1 + 1 equals 10', async () => {
     *   rstest.mocked(example.calc).mockReturnValue(10)
     *   expect(example.calc(1, '+', 1)).toBe(10)
     * })
     * ```
     * @param item - Anything that can be mocked
     * @returns The same item with mocked type
     */ mocked: (<T>(item: T, deep?: false) => Mocked<T>) & (<T>(item: T, deep: true) => MaybeMockedDeep<T>) & (<T>(item: T, options: {
        partial?: false;
        deep?: false;
    }) => Mocked<T>) & (<T>(item: T, options: {
        partial?: false;
        deep: true;
    }) => MaybeMockedDeep<T>) & (<T>(item: T, options: {
        partial: true;
        deep?: false;
    }) => MaybePartiallyMocked<T>) & (<T>(item: T, options: {
        partial: true;
        deep: true;
    }) => MaybePartiallyMockedDeep<T>);
    /**
     * Calls `.mockClear()` on all spies.
     */ clearAllMocks: () => RstestUtilities;
    /**
     * Calls `.mockReset()` on all spies.
     */ resetAllMocks: () => RstestUtilities;
    /**
     * Calls `.mockRestore()` on all spies.
     */ restoreAllMocks: () => RstestUtilities;
    /**
     * Mock a module.
     *
     * When called with a factory function, the module will be replaced with the return value of the factory.
     * When called with `{ spy: true }`, the module will be auto-mocked but the original implementations
     * will be preserved - all exports will be wrapped in spy functions that track calls.
     *
     * @example
     * ```ts
     * // Replace module with factory
     * rs.mock('./module', () => ({ fn: rs.fn() }))
     *
     * // Auto-mock with spy mode - keeps original implementations
     * rs.mock('./module', { spy: true })
     * ```
     */ mock<T = unknown>(moduleName: string | Promise<T>, factoryOrOptions?: MockFactory<T> | MockModuleOptions): void;
    /**
     * Mock a module (CommonJS require)
     */ mockRequire: <T = unknown>(moduleName: string, factoryOrOptions?: (() => T) | MockModuleOptions) => void;
    /**
     * Mock a module, not hoisted.
     *
     * When called with `{ spy: true }`, the module will be auto-mocked but the original implementations
     * will be preserved - all exports will be wrapped in spy functions that track calls.
     */ doMock<T = unknown>(moduleName: string | Promise<T>, factoryOrOptions?: MockFactory<T> | MockModuleOptions): void;
    /**
     * Mock a module, not hoisted (CommonJS require).
     */ doMockRequire: <T = unknown>(moduleName: string, factoryOrOptions?: (() => T) | MockModuleOptions) => void;
    /**
     * Hoisted mock function.
     */ hoisted: <T = unknown>(fn: () => T) => T;
    /**
     * Removes module from the mocked registry.
     */ unmock: (path: string) => void;
    /**
     * Removes CommonJS require module from the mocked registry.
     */ unmockRequire: (path: string) => void;
    /**
     * Removes module from the mocked registry, not hoisted.
     */ doUnmock: (path: string) => void;
    /**
     * Removes CommonJS require module from the mocked registry, not hoisted.
     */ doUnmockRequire: (path: string) => void;
    /**
     * Imports a module with all of its properties (including nested properties) mocked.
     */ importMock: <T = Record<string, unknown>>(path: string) => Promise<T>;
    /**
     * Imports a module with all of its properties (including nested properties) mocked.
     */ requireMock: <T = Record<string, unknown>>(path: string) => T;
    /**
     * Import and return the actual module instead of a mock, bypassing all checks on whether the module should receive a mock implementation or not.
     */ importActual: <T = Record<string, unknown>>(path: string) => Promise<T>;
    /**
     * Require and return the actual module instead of a mock, bypassing all checks on whether the module should receive a mock implementation or not.
     */ requireActual: <T = Record<string, unknown>>(path: string) => T;
    /**
     * Resets modules registry by clearing the cache of all modules.
     */ resetModules: () => RstestUtilities;
    /**
     * Changes the value of an environment variable in the current runtime env store.
     * Uses `process.env` in Node.js and runtime env store in browser mode.
     */ stubEnv: (name: string, value: string | undefined) => DisposableRstestUtilities;
    /**
     * Restores all env values that were changed with `rstest.stubEnv`.
     */ unstubAllEnvs: () => RstestUtilities;
    /**
     * Changes the value of global variable.
     */ stubGlobal: (name: string | number | symbol, value: unknown) => DisposableRstestUtilities;
    /**
     * Restores all global variables that were changed with `rstest.stubGlobal`.
     */ unstubAllGlobals: () => RstestUtilities;
    /**
     * Update runtime config for the current test.
     */ setConfig: (config: RuntimeOptions) => void;
    /**
     * get runtime config for the current test.
     */ getConfig: () => RuntimeOptions;
    /**
     * Reset runtime config that were changed with `rstest.setConfig`.
     */ resetConfig: () => void;
    /**
     * Mocks timers using `@sinonjs/fake-timers`.
     */ useFakeTimers: (config?: Config_2) => DisposableRstestUtilities;
    useRealTimers: () => RstestUtilities;
    isFakeTimers: () => boolean;
    /**
     * Set the current system time used by fake timers.
     */ setSystemTime: (now?: FakeTimerSystemTime) => RstestUtilities;
    getRealSystemTime: () => number;
    getRealTimers: () => RealTimers;
    runAllTicks: () => RstestUtilities;
    runAllTimers: () => RstestUtilities;
    runAllTimersAsync: () => Promise<RstestUtilities>;
    runOnlyPendingTimers: () => RstestUtilities;
    runOnlyPendingTimersAsync: () => Promise<RstestUtilities>;
    advanceTimersByTime: (ms: FakeTimerTickTime) => RstestUtilities;
    advanceTimersByTimeAsync: (ms: FakeTimerTickTime) => Promise<RstestUtilities>;
    advanceTimersToNextTimer: (steps?: number) => RstestUtilities;
    advanceTimersToNextTimerAsync: (steps?: number) => Promise<RstestUtilities>;
    advanceTimersToNextFrame: () => RstestUtilities;
    jumpTimersByTime: (ms: FakeTimerTickTime) => RstestUtilities;
    setTickMode: (mode: FakeTimerTickMode) => RstestUtilities;
    /**
     * Returns the number of fake timers still left to run.
     */ getTimerCount: () => number;
    /**
     * Removes all timers that are scheduled to run.
     */ clearAllTimers: () => RstestUtilities;
    /**
     * Retry callback until it succeeds (doesn't throw) or timeout is reached.
     * If timeout is reached, throws the last error from the callback.
     */ waitFor: <T>(callback: WaitForCallback<T>, options?: number | WaitForOptions) => Promise<T>;
    /**
     * Retry callback until it returns a truthy value or timeout is reached.
     * If callback throws, it interrupts immediately and throws that error.
     * If timeout is reached, throws an error.
     */ waitUntil: <T>(callback: () => MaybePromise<T>, options?: number | WaitUntilOptions) => Promise<Truthy<Awaited<T>>>;
}

declare type RunAll = () => number;

declare type RunAllAsync = () => Promise<number>;

declare type RunMicrotasks = () => void;

declare type RunnerAPI = {
    describe: DescribeAPI;
    it: TestAPIs;
    test: TestAPIs;
    beforeAll: (fn: BeforeAllListener, timeout?: number) => void;
    afterAll: (fn: AfterAllListener, timeout?: number) => void;
    beforeEach: <ExtraContext = object>(fn: BeforeEachListener<ExtraContext>, timeout?: number) => void;
    afterEach: <ExtraContext = object>(fn: AfterEachListener<ExtraContext>, timeout?: number) => void;
    onTestFinished: (fn: OnTestFinishedHandler, timeout?: number) => void;
    onTestFailed: (fn: OnTestFailedHandler, timeout?: number) => void;
};

export declare type RunnerHooks = {
    onTestSuiteStart?: (test: TestSuiteInfo) => Promise<void>;
    onTestSuiteResult?: (result: TestResult) => Promise<void>;
    /**
     * Called after tests in file collected.
     */ onTestFileReady?: (test: TestFileInfo) => Promise<void>;
    /**
     * Called before running the test case.
     */ onTestCaseStart?: (test: TestCaseInfo) => Promise<void>;
    /**
     * Called after the test is finished running.
     */ onTestCaseResult?: (result: TestResult) => Promise<void>;
    /**
     * The number of failed tests.
     */ getCountOfFailedTests: () => Promise<number>;
};

declare type RunningModules = Map<string, {
    runningTests: TestCaseInfo[];
    results: TestResult[];
}>;

export declare type RuntimeConfig = Pick<RstestContext['normalizedConfig'], 'testTimeout' | 'testNamePattern' | 'globals' | 'passWithNoTests' | 'retry' | 'clearMocks' | 'resetMocks' | 'restoreMocks' | 'unstubEnvs' | 'unstubGlobals' | 'maxConcurrency' | 'printConsoleTrace' | 'disableConsoleIntercept' | 'testEnvironment' | 'federation' | 'isolate' | 'hookTimeout' | 'coverage' | 'snapshotFormat' | 'env' | 'logHeapUsage' | 'detectAsyncLeaks' | 'bail' | 'chaiConfig' | 'includeTaskLocation' | 'silent'>;

declare type RuntimeOptions = Partial<Pick<RuntimeConfig, 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'resetMocks' | 'restoreMocks' | 'maxConcurrency' | 'retry'>>;

declare type RunToFrame = () => number;

declare type RunToLast = () => number;

declare type RunToLastAsync = () => Promise<number>;

declare interface SaveStatus {
    	deleted: boolean;
    	saved: boolean;
}

declare type SetImmediate = (callback: VoidVarArgsFunc, ...args: unknown[]) => NodeImmediate;

declare type SetInterval = (callback: VoidVarArgsFunc, delay?: number, ...args: unknown[]) => TimerId;

export declare const setRealTimers: () => void;

declare type SetSystemTime = (now?: number | Date | TemporalTimelike) => void;

declare type SetTickMode = (tickModeConfig: SetTickModeConfig) => void;

declare type SetTickModeConfig = {
    mode: TickMode;
    delta?: number;
};

declare type SetTimeout = (callback: VoidVarArgsFunc, delay?: number, ...args: unknown[]) => TimerId;

/**
 * Per-invocation test sharding, resolved from the `--shard <index/count>` CLI
 * flag. It is intentionally not a user config field: the index/count must
 * differ on every CI runner, so it cannot be expressed by a value committed to
 * the shared config file. Kept on the resolved/normalized config only.
 */ declare type ShardConfig = {
    count: number;
    index: number;
};

/**
 * Header written at the top of every `.snap` file.
 *
 * Shared by the node worker snapshot environment and the browser client so
 * snapshot files stay byte-identical regardless of which executor wrote them.
 */
export declare const SNAPSHOT_HEADER = '// Rstest Snapshot';

declare class SnapshotClient {
    	private options;
    	snapshotStateMap: Map<string, SnapshotState>;
    	constructor(options?: SnapshotClientOptions);
    	setup(filepath: string, options: SnapshotStateOptions): Promise<void>;
    	finish(filepath: string): Promise<SnapshotResult>;
    	skipTest(filepath: string, testName: string): void;
    	clearTest(filepath: string, testId: string): void;
    	getSnapshotState(filepath: string): SnapshotState;
    	match(options: AssertOptions): MatchResult;
    	assert(options: AssertOptions): void;
    	matchDomain(options: AssertDomainOptions): MatchResult;
    	pollMatchDomain(options: AssertDomainPollOptions): Promise<MatchResult>;
    	assertRaw(options: AssertOptions): Promise<void>;
    	clear(): void;
}

declare interface SnapshotClientOptions {
    	isEqual?: (received: unknown, expected: unknown) => boolean;
}

declare interface SnapshotEnvironment {
    	getVersion: () => string;
    	getHeader: () => string;
    	resolvePath: (filepath: string) => Promise<string>;
    	resolveRawPath: (testPath: string, rawPath: string) => Promise<string>;
    	saveSnapshotFile: (filepath: string, snapshot: string) => Promise<void>;
    	readSnapshotFile: (filepath: string) => Promise<string | null>;
    	removeSnapshotFile: (filepath: string) => Promise<void>;
    	processStackTrace?: (stack: ParsedStack) => ParsedStack;
}

declare type SnapshotFormat = Omit<NonNullable<SnapshotStateOptions['snapshotFormat']>, 'plugins' | 'compareKeys'>;

declare class SnapshotManager {
    	options: Omit<SnapshotStateOptions, "snapshotEnvironment">;
    	summary: SnapshotSummary;
    	extension: string;
    	constructor(options: Omit<SnapshotStateOptions, "snapshotEnvironment">);
    	clear(): void;
    	add(result: SnapshotResult): void;
    	resolvePath<T = any>(testPath: string, context?: T): string;
    	resolveRawPath(testPath: string, rawPath: string): string;
}

declare interface SnapshotMatcher<T> {
    <U extends {
        [P in keyof T]: any;
    }>(snapshot: Partial<U>, message?: string) : void;
    (message?: string) : void;
}

declare interface SnapshotMatchOptions {
    	testId: string;
    	testName: string;
    	received: unknown;
    	key?: string;
    	inlineSnapshot?: string;
    	isInline: boolean;
    	error?: Error;
    	rawSnapshot?: RawSnapshotInfo;
    	assertionName?: string;
}

declare interface SnapshotResult {
    	filepath: string;
    	added: number;
    	fileDeleted: boolean;
    	matched: number;
    	unchecked: number;
    	uncheckedKeys: Array<string>;
    	unmatched: number;
    	updated: number;
}

declare interface SnapshotReturnOptions {
    	actual: string;
    	count: number;
    	expected?: string;
    	key: string;
    	pass: boolean;
}

declare class SnapshotState {
    	testFilePath: string;
    	snapshotPath: string;
    	private _counters;
    	private _dirty;
    	private _updateSnapshot;
    	private _snapshotData;
    	private _initialData;
    	private _inlineSnapshots;
    	private _inlineSnapshotStacks;
    	private _testIdToKeys;
    	private _rawSnapshots;
    	private _uncheckedKeys;
    	private _snapshotFormat;
    	private _environment;
    	private _fileExists;
    	expand: boolean;
    	private _added;
    	private _matched;
    	private _unmatched;
    	private _updated;
    	get added(): CounterMap<string>;
    	set added(value: number);
    	get matched(): CounterMap<string>;
    	set matched(value: number);
    	get unmatched(): CounterMap<string>;
    	set unmatched(value: number);
    	get updated(): CounterMap<string>;
    	set updated(value: number);
    	private constructor();
    	static create(testFilePath: string, options: SnapshotStateOptions): Promise<SnapshotState>;
    	get snapshotUpdateState(): SnapshotUpdateState;
    	get environment(): SnapshotEnvironment;
    	markSnapshotsAsCheckedForTest(testName: string): void;
    	clearTest(testId: string): void;
    	protected _inferInlineSnapshotStack(stacks: ParsedStack[]): ParsedStack | null;
    	private _addSnapshot;
    	private _resolveKey;
    	private _resolveInlineStack;
    	private _reconcile;
    	save(): Promise<SaveStatus>;
    	getUncheckedCount(): number;
    	getUncheckedKeys(): Array<string>;
    	removeUncheckedKeys(): void;
    	probeExpectedSnapshot(options: Pick<SnapshotMatchOptions, "testName" | "testId" | "isInline" | "inlineSnapshot">): ExpectedSnapshot;
    	match({ testId, testName, received, key, inlineSnapshot, isInline, error, rawSnapshot, assertionName }: SnapshotMatchOptions): SnapshotReturnOptions;
    	processDomainSnapshot({ testId, received, expectedSnapshot, matchResult, isInline, error, assertionName }: ProcessDomainSnapshotOptions): SnapshotReturnOptions;
    	pack(): Promise<SnapshotResult>;
}

declare interface SnapshotStateOptions {
    	updateSnapshot: SnapshotUpdateState;
    	snapshotEnvironment: SnapshotEnvironment;
    	expand?: boolean;
    	snapshotFormat?: OptionsReceived;
    	resolveSnapshotPath?: (path: string, extension: string, context?: any) => string;
}

declare interface SnapshotSummary {
    	added: number;
    	didUpdate: boolean;
    	failure: boolean;
    	filesAdded: number;
    	filesRemoved: number;
    	filesRemovedList: Array<string>;
    	filesUnmatched: number;
    	filesUpdated: number;
    	matched: number;
    	total: number;
    	unchecked: number;
    	uncheckedKeysByFile: Array<UncheckedSnapshot>;
    	unmatched: number;
    	updated: number;
}

declare type SnapshotUpdateState = "all" | "new" | "none";

declare type SourceColumn = number;

declare type SourceLine = number;

declare abstract class SourceMap {
    version: SourceMapV3['version'];
    file: SourceMapV3['file'];
    names: SourceMapV3['names'];
    sourceRoot: SourceMapV3['sourceRoot'];
    sources: SourceMapV3['sources'];
    sourcesContent: SourceMapV3['sourcesContent'];
    resolvedSources: SourceMapV3['sources'];
    ignoreList: SourceMapV3['ignoreList'];
}

declare type SourceMapInput = string | EncodedSourceMapXInput | DecodedSourceMapXInput | TraceMap;

declare type SourceMapSegment = [GeneratedColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn] | [GeneratedColumn, SourcesIndex, SourceLine, SourceColumn, NamesIndex];

declare interface SourceMapV3 {
    file?: string | null;
    names: string[];
    sourceRoot?: string;
    sources: (string | null)[];
    sourcesContent?: (string | null)[];
    version: 3;
    ignoreList?: number[];
}

declare type SourcesIndex = number;

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

declare interface StringifiedMemory {
    	expected?: string;
    	actual?: string;
}

declare function stringify(object: unknown, maxDepth?: number, { maxLength, filterNode, ...options }?: StringifyOptions): string;

declare interface StringifyOptions extends PrettyFormatOptions {
    	maxLength?: number;
    	filterNode?: string | ((node: any) => boolean);
}

declare interface SuiteContext {
    filepath: TestPath;
    meta: TaskMeta;
}

declare type Summarizers = "flat" | "nested" | "pkg" | "defaultSummarizer";

/** Union type for all supported reporter types */ declare type SupportedReporter = keyof ReportOptions | ReportWithOptions | ReportBase | CustomReporter;

declare interface SyncExpectationResult {
    	pass: boolean;
    	message: () => string;
    	actual?: any;
    	expected?: any;
    	meta?: object;
}

/** Per-platform task attribution primitive used by the shared runner. */ export declare interface TaskContext {
    getCurrent(): CurrentTaskInfo | undefined;
    run<T>(task: CurrentTaskInfo, fn: () => T | Promise<T>): T | Promise<T>;
    setFallback(task: CurrentTaskInfo | undefined): void;
}

declare type TaskMeta = Record<string, TaskMetaValue>;

declare type TaskMetaValue = string | number | boolean | null | TaskMetaValue[] | {
    [key: string]: TaskMetaValue;
};

declare interface TaskResult {
    /**
     * State of the task. Inherits the `task.mode` during collection.
     * When the task has finished, it will be changed to `pass` or `fail`.
     * - **pass**: task ran successfully
     * - **fail**: task failed
     */ state: TaskState;
    /**
     * Errors that occurred during the task execution. It is possible to have several errors
     * if `expect.soft()` failed multiple times or `retry` was triggered.
     */ errors?: FormattedError[];
}

declare type TaskState = 'pass' | 'fail';

declare interface TeamcityOptions extends FileOptions {
    blockName: string;
}

declare type TemporalDuration = {
    years: number;
    months: number;
    weeks: number;
    days: number;
    hours: number;
    minutes: number;
    seconds: number;
    milliseconds: number;
    microseconds: number;
    nanoseconds: number;
    total: (options: {
        unit: string;
        relativeTo?: unknown;
    }) => number;
};

declare type TemporalTimelike = {
    epochMilliseconds: number;
};

export declare type Test = TestSuite | TestCase;

export declare const test: Rstest['test'];

declare type Test_2 = (arg0: any) => boolean;

declare type TestAPI<ExtraContext = object> = TestFn<ExtraContext> & {
    each: TestEachFn;
    for: TestForFn<ExtraContext>;
    fails: TestAPI<ExtraContext>;
    concurrent: TestAPI<ExtraContext>;
    sequential: TestAPI<ExtraContext>;
    only: TestAPI<ExtraContext>;
    skip: TestAPI<ExtraContext>;
    todo: TestAPI<ExtraContext>;
    runIf: (condition: boolean) => TestAPI<ExtraContext>;
    skipIf: (condition: boolean) => TestAPI<ExtraContext>;
};

declare type TestAPIs<ExtraContext = object> = TestAPI<ExtraContext> & {
    extend: <T extends Record<string, any> = object>(fixtures: Fixtures<T, ExtraContext>) => TestAPIs<{
        [K in keyof T | keyof ExtraContext]: K extends keyof T ? T[K] : K extends keyof ExtraContext ? ExtraContext[K] : never;
    }>;
};

/**
 * The two accepted call shapes shared by `test` / `it` and the functions returned
 * by `test.each` / `test.for`:
 * - `(name, fn, timeout?)` — test function second, with an optional numeric timeout
 *   last (kept for Jest compatibility; shorthand for `{ timeout: n }`).
 * - `(name, options, fn?)` — `TestOptions` object as the second argument.
 *
 * The function-first overload is listed first so the common `test(name, fn)` case
 * binds the callback's context types — a function value is otherwise assignable to
 * the all-optional `TestOptions`, which would swallow contextual typing.
 */ declare type TestCall<Fn> = {
    (description: string, fn?: Fn, timeout?: number) : void;
    (description: string, options: TestOptions, fn?: Fn) : void;
};

declare type TestCallbackFn<ExtraContext = object> = (context: TestContext & ExtraContext) => MaybePromise<void>;

declare type TestCase = TestCaseInfo & {
    originalFn?: (context: TestContext) => void | Promise<void>;
    fn?: (context: TestContext) => void | Promise<void>;
    fails?: boolean;
    each?: boolean;
    fixtures?: NormalizedFixtures;
    concurrent?: boolean;
    sequential?: boolean;
    inTestEach?: boolean;
    context: TestContext;
    only?: boolean;
    /**
     * Per-test override for the number of retries on failure. When undefined,
     * the runner falls back to `runtimeConfig.retry`.
     */ retry?: number;
    /**
     * Number of additional runs to perform on top of the first run; any failure
     * short-circuits remaining repeats. Currently per-test only.
     */ repeats?: number;
    onFinished: OnTestFinishedHandler[];
    onFailed: OnTestFailedHandler[];
    /**
     * Store promises (from async expects) to wait for them before finishing the test
     */ promises?: Promise<any>[];
    /**
     * Store stack trace error created when test is registered, used for trace original position
     */ stackTraceError: Error;
    /**
     * Result of the task. if `expect.soft()` failed multiple times or `retry` was triggered.
     */ result?: TaskResult;
};

declare type TestCaseInfo = {
    testId: string;
    testPath: TestPath;
    name: string;
    timeout?: number;
    parentNames?: string[];
    project: string;
    startTime?: number;
    /** Only included when `includeTaskLocation` config is enabled */ location?: Location_2;
    meta?: TaskMeta;
    type: 'case';
    runMode: TestRunMode;
};

declare interface TestContext {
    /**
     * Metadata of the current test
     */ task: {
        /** A stable, unique identifier for the test */ id: string;
        /** Test name provided by user */ name: string;
        /** Absolute path of the current test file when provided by the runner */ filepath?: string;
        /** Absolute path of the current project's root directory. */ projectRoot?: string;
        /** Result of the current test, undefined if the test is not run yet */ result?: TestResult;
        /** Mutable metadata copied to the current test result. */ meta: TaskMeta;
    };
    expect: RstestExpect;
    /** Skip the current test during execution. */ skip: () => never;
    onTestFinished: RunnerAPI['onTestFinished'];
    onTestFailed: RunnerAPI['onTestFailed'];
}

declare interface TestEachFn {
    <T extends Record<string, unknown>>(cases: readonly T[]) : TestCall<(param: T) => MaybePromise<void>>;
    <T extends readonly [unknown, ...unknown[]]>(cases: readonly T[]) : TestCall<(...args: [...T]) => MaybePromise<void>>;
    <T>(cases: readonly T[]) : TestCall<(...args: T[]) => MaybePromise<void>>;
    <T extends Record<string, unknown>>(strings: TemplateStringsArray, ...expressions: unknown[]) : TestCall<(param: T) => MaybePromise<void>>;
}

declare type Tester = (this: TesterContext, a: any, b: any, customTesters: Array<Tester>) => boolean | undefined;

declare interface TesterContext {
    	equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
}

declare type TestFileInfo = {
    testId: string;
    testPath: TestPath;
    project: string;
    tests: TestInfo[];
};

export declare type TestFileResult = TestResult & {
    results: TestResult[];
    snapshotResult?: SnapshotResult;
    coverage?: Record<string, FileCoverageData>;
    /**
     * Raw coverage payload used internally between workers and the pool.
     * Stripped at the pool boundary before results are exposed to reporters.
     *
     * @internal
     */ coverageRaw?: unknown;
    /**
     * Perfetto-compatible trace events. Stripped at the pool boundary.
     *
     * @internal
     */ traceEvents?: TraceEvent[];
};

declare type TestFn<ExtraContext = object> = TestCall<TestCallbackFn<ExtraContext>>;

declare interface TestForFn<ExtraContext = object> {
    <T>(cases: readonly T[]) : TestCall<(param: T, context: TestContext & ExtraContext) => MaybePromise<void>>;
    <T extends Record<string, unknown>>(strings: TemplateStringsArray, ...expressions: unknown[]) : TestCall<(param: T, context: TestContext & ExtraContext) => MaybePromise<void>>;
}

export declare type TestInfo = TestCaseInfo | (TestSuiteInfo & {
    tests: TestInfo[];
});

/**
 * Per-test options accepted as the second argument of `test` / `it` / `test.each` /
 * `test.for`. Passing a plain `number` as the last argument is equivalent to
 * `{ timeout: n }`.
 *
 * Declared as an `interface` so consumers can use module augmentation to add
 * fields in the future without breaking source compatibility.
 */ declare interface TestOptions {
    /**
     * Per-test timeout in milliseconds. Overrides `test.testTimeout`.
     */ timeout?: number;
    /**
     * Number of times to retry the test if it fails. Overrides `test.retry`.
     *
     * @default 0
     */ retry?: number;
    /**
     * Number of times to re-run the test after it has already passed. The test is
     * considered failed as soon as any run fails. Total executions per case is
     * `repeats + 1`. Orthogonal to `retry`: each repeat independently honors the
     * configured retry budget.
     *
     * @default 0
     */ repeats?: number;
    /**
     * Initial metadata for this test or suite. Suite metadata is inherited by
     * descendant suites and tests; child metadata overrides inherited keys.
     */ meta?: TaskMeta;
}

/** The test file original path */ declare type TestPath = string;

declare type TestProject = string | InlineProjectConfig;

export declare type TestResult = {
    testId: string;
    status: TestResultStatus;
    name: string;
    testPath: TestPath;
    parentNames?: string[];
    duration?: number;
    errors?: FormattedError[];
    retryErrors?: FormattedError[];
    retryCount?: number;
    project: string;
    meta?: TaskMeta;
    heap?: number;
};

declare type TestResultStatus = 'skip' | 'pass' | 'fail' | 'todo';

declare type TestRunMode = 'run' | 'skip' | 'todo' | 'only';

declare class TestStateManager {
    runningModules: Map<string, {
        runningTests: TestCaseInfo[];
        results: TestResult[];
    }>;
    testModules: TestFileResult[];
    testFiles: string[] | undefined;
    onTestFileStart(testPath: string): void;
    onTestCaseResult(result: TestResult): void;
    onTestCaseStart(test: TestCaseInfo): void;
    getCountOfFailedTests(): number;
    onTestFileResult(test: TestFileResult): void;
    reset(): void;
}

declare type TestSuite = TestSuiteInfo & {
    each?: boolean;
    inTestEach?: boolean;
    concurrent?: boolean;
    sequential?: boolean;
    /**
     * Suite-level `TestOptions` passed to `describe(name, options, fn)`. Applied
     * as inheritable defaults to descendant suites and cases: an explicit child
     * value wins, and a nested `describe` carries inherited values to its own
     * descendants.
     */ timeout?: number;
    retry?: number;
    repeats?: number;
    /** nested cases and suite could in a suite */ tests: Test[];
    afterAllListeners?: AfterAllListener[];
    beforeAllListeners?: BeforeAllListener[];
    afterEachListeners?: AfterEachListener[];
    beforeEachListeners?: BeforeEachListener[];
};

declare type TestSuiteInfo = {
    testId: string;
    name: string;
    parentNames?: string[];
    testPath: TestPath;
    project: string;
    type: 'suite';
    /** Only included when `includeTaskLocation` config is enabled */ location?: Location_2;
    meta?: TaskMeta;
    runMode: TestRunMode;
};

declare type TextLcovOptions = ProjectOptions;

declare interface TextOptions extends FileOptions {
    maxCols: number;
    skipEmpty: boolean;
    skipFull: boolean;
}

declare type TextSummaryOptions = FileOptions;

/** check thresholds for matched files */ declare type ThresholdGlobRecord = Record<string, CoverageThreshold & {
    /**
     * check thresholds per file
     * @default false
     */ perFile?: boolean;
}>;

declare type Tick = (tickValue: number | string | TemporalDuration) => number;

declare type TickAsync = (tickValue: number | string | TemporalDuration) => Promise<number>;

declare type TickMode = "nextAsync" | "manual" | "interval";

declare type Timer = TimerInitialProps;

declare type TimeRemaining = () => number;

declare type TimerHeap = {
    timers: Timer[];
    peek: () => Timer | undefined;
    push: (timer: Timer) => void;
    pop: () => Timer | undefined;
    remove: (timer: Timer) => void;
};

declare type TimerId = number | NodeImmediate | Timer;

declare type TimerInitialProps = {
    func: VoidVarArgsFunc;
    args?: unknown[];
    type?: 'Timeout' | 'Interval' | 'Immediate' | 'AnimationFrame' | 'IdleCallback';
    delay?: number;
    callAt?: number;
    createdAt?: number;
    immediate?: boolean;
    id?: number;
    error?: Error;
    interval?: number;
    animation?: boolean;
    requestIdleCallback?: boolean;
    order?: number;
    heapIndex?: number;
};

declare interface Totals {
    total: number;
    covered: number;
    skipped: number;
    pct: number;
}

/**
 * Perfetto/Chrome trace event (subset). Emitted by the worker-side
 * `PhaseTracker` and consumed by the controller below.
 *
 * `ph`:
 * - `'X'`: complete (sliced) event with `dur` — drawn as a slice
 * - `'M'`: metadata (process/thread name, sort index)
 * - `'C'`: counter — `args` numeric values are plotted as tracks
 */ declare type TraceEvent = {
    name: string;
    cat: string;
    ph: 'X' | 'M' | 'C';
    ts: number;
    dur?: number;
    pid: number;
    tid: number;
    args?: Record<string, string | number | boolean | undefined>;
};

declare class TraceMap implements SourceMap {
    version: SourceMapV3['version'];
    file: SourceMapV3['file'];
    names: SourceMapV3['names'];
    sourceRoot: SourceMapV3['sourceRoot'];
    sources: SourceMapV3['sources'];
    sourcesContent: SourceMapV3['sourcesContent'];
    ignoreList: SourceMapV3['ignoreList'];
    resolvedSources: string[];
    private _encoded;
    private _decoded;
    private _decodedMemo;
    private _bySources;
    private _bySourceMemos;
    constructor(map: Ro<SourceMapInput>, mapUrl?: string | null);
}

declare interface Tree<N extends Node_2 = Node_2> {
    getRoot(): N;
    visit(visitor: Partial<Visitor<N>>, state: any): void;
}

declare type Truthy<T> = Exclude<T, Falsy>;

declare interface UncheckedSnapshot {
    	filePath: string;
    	keys: Array<string>;
}

declare type Uninstall = () => void;

export declare const unwrapRegex: (value: string) => string | RegExp;

declare type Use<T> = (value: T) => Promise<void>;

declare interface UserConsoleLog {
    content: string;
    name: string;
    taskId?: string;
    taskName?: string;
    taskParentNames?: string[];
    taskType?: 'file' | 'suite' | 'case';
    trace?: string;
    testPath: TestPath;
    /**
     * Owning project. A test path alone does not identify the emitter once
     * several projects run the same file, and consumers that attribute output to
     * a file (the blob reporter's replay track, the browser host's sink routing)
     * cannot recover it from the other fields.
     */ project: string;
    type: ConsoleStreamType;
}

declare type VerboseReporterOptions = Omit<DefaultReporterOptions, 'summary'>;

declare interface Visitor<N extends Node_2 = Node_2> {
    onStart(root: N, state: any): void;
    onSummary(root: N, state: any): void;
    onDetail(root: N, state: any): void;
    onSummaryEnd(root: N, state: any): void;
    onEnd(root: N, state: any): void;
}

declare type VitestAssertion<
	A,
	T
> = { [K in keyof A] : A[K] extends Chai.Assertion ? Assertion_2<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T> } & ((type: string, message?: string) => Assertion_2);

declare type VitestExpectProperties = {
    [K in keyof ExpectStatic_2]: ExpectStatic_2[K];
};

declare type VoidVarArgsFunc = (...args: unknown[]) => void;

declare type WaitForCallback<T> = () => MaybePromise<T>;

declare interface WaitForOptions {
    timeout?: number;
    interval?: number;
}

declare interface WaitUntilOptions {
    timeout?: number;
    interval?: number;
}

declare type Watermark = [number, number];

declare interface Watermarks {
    statements: Watermark;
    functions: Watermark;
    branches: Watermark;
    lines: Watermark;
}

declare type WithAsymmetricMatcher<T> = T | AsymmetricMatcher<unknown>;

declare type WorkerContext = {
    rootPath: RstestContext['rootPath'];
    projectRoot: ProjectContext['rootPath'];
    project: string;
    runtimeConfig: RuntimeConfig;
    taskId: number;
    /**
     * Monotonically increasing per-compile id: stable across all files of one
     * run, bumped on every watch rebuild. A change tells a reused worker to flush
     * its kept module cache before loading (#1373).
     */ buildId: number;
    outputModule: boolean;
    /** When true, the worker emits Perfetto trace events alongside phase totals. */ trace?: boolean;
};

export declare type WorkerState = WorkerContext & {
    environment: string;
    testPath: TestPath;
    distPath: DistPath;
    currentTask?: CurrentTaskInfo;
    snapshotClient?: SnapshotClient;
    snapshotOptions: {
        updateSnapshot: SnapshotUpdateState;
        snapshotEnvironment: SnapshotEnvironment;
        snapshotFormat: RuntimeConfig['snapshotFormat'];
    };
};

declare type XInput = {
    x_google_ignoreList?: SourceMapV3['ignoreList'];
};

declare interface XmlWriter {
    indent(str: string): string;
    /**
     * writes the opening XML tag with the supplied attributes
     */
    openTag(name: string, attrs?: any): void;
    /**
     * closes an open XML tag.
     */
    closeTag(name: string): void;
    /**
     * writes a tag and its value opening and closing it at the same time
     */
    inlineTag(name: string, attrs?: any, content?: string): void;
    /**
     * closes all open tags and ends the document
     */
    closeAll(): void;
}

export { }
