///<reference path="./chai.d.cts" />
import { assert } from 'chai';
import * as chai_2 from 'chai';
import { should } from 'chai';

declare type AddEventListenerOptionsArgument = Parameters<typeof EventTarget.prototype.addEventListener>[2];

/**
 * Registers a callback function to be executed once after all tests within the current suite have completed.
 * This hook is useful for scenarios where you need to perform cleanup operations after all tests in a suite have run, such as closing database connections or cleaning up temporary files.
 *
 * **Note:** The `afterAll` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
 *
 * @param {Function} fn - The callback function to be executed after all tests.
 * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
 * @returns {void}
 * @example
 * ```ts
 * // Example of using afterAll to close a database connection
 * afterAll(async () => {
 *   await database.disconnect();
 * });
 * ```
 */
export declare function afterAll(fn: AfterAllListener, timeout?: number): void;

declare interface AfterAllListener {
    (suite: Readonly<RunnerTestSuite | RunnerTestFile>): Awaitable_2<unknown>;
}

/**
 * Registers a callback function to be executed after each test within the current suite has completed.
 * This hook is useful for scenarios where you need to clean up or reset the test environment after each test runs, such as deleting temporary files, clearing test-specific database entries, or resetting mocked functions.
 *
 * **Note:** The `afterEach` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
 *
 * @param {Function} fn - The callback function to be executed after each test. This function receives an `TestContext` parameter if additional test context is needed.
 * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
 * @returns {void}
 * @example
 * ```ts
 * // Example of using afterEach to delete temporary files created during a test
 * afterEach(async () => {
 *   await fileSystem.deleteTempFiles();
 * });
 * ```
 */
export declare function afterEach<ExtraContext = object>(fn: AfterEachListener<ExtraContext>, timeout?: number): void;

declare interface AfterEachListener<ExtraContext = object> {
    (context: ExtendedContext<RunnerTestCase | RunnerCustomCase> & ExtraContext, suite: Readonly<RunnerTestSuite>): Awaitable_2<unknown>;
}

export declare interface AfterSuiteRunMeta {
    coverage?: unknown;
    testFiles: string[];
    transformMode: TransformMode | 'browser';
    projectName?: string;
}

/**
 * Checks if all the boolean types in the {@linkcode Types} array are `true`.
 */
declare type And<Types extends boolean[]> = Types[number] extends true ? true : false;

/** @deprecated do not use, internal helper */
export declare type ArgumentsType<T> = ArgumentsType_2<T>;

declare type ArgumentsType_2<T> = T extends (...args: infer U) => any ? U : never;

declare type ArgumentsType_3<T> = T extends (...args: infer A) => any ? A : never;

/** @deprecated do not use, internal helper */
export declare type Arrayable<T> = Arrayable_2<T>;

declare type Arrayable_2<T> = T | Array<T>;

export { assert }

export declare interface Assertion<T = any> extends VitestAssertion<Chai.Assertion, T>, JestAssertion<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;
    /**
     * 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');
     */
    toSatisfy: <E>(matcher: (value: E) => boolean, message?: string) => 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>;
}

export declare interface AssertType {
    <T>(value: T): void;
}

export declare const assertType: AssertType;

export declare interface AsymmetricMatchersContaining {
    /**
     * 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: 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<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.
     *
     * @param precision - Optional decimal precision for comparison. Default is 2.
     *
     * @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;
}

declare type AsyncExpectationResult = Promise<SyncExpectationResult>;

/**
 * Represents a value that can be of various types.
 */
declare type AValue = {
    [avalue]?: undefined;
} | string | number | boolean | symbol | bigint | null | undefined | void;

/**
 * A type which should match anything passed as a value but *doesn't*
 * match {@linkcode Mismatch}. It helps TypeScript select the right overload
 * for {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} and
 * {@linkcode PositiveExpectTypeOf.toMatchTypeOf | .toMatchTypeOf()}.
 *
 * @internal
 */
declare const avalue: unique symbol;

/** @deprecated do not use, internal helper */
export declare type Awaitable<T> = Awaitable_3<T>;

declare type Awaitable_2<T> = T | PromiseLike<T>;

declare type Awaitable_3<T> = T | PromiseLike<T>;

/**
 * Represents the base interface for the
 * {@linkcode expectTypeOf()} function.
 * Provides a set of assertion methods to perform type checks on a value.
 */
declare interface BaseExpectTypeOf<Actual, Options extends {
    positive: boolean;
}> {
    /**
     * Checks whether the type of the value is `any`.
     */
    toBeAny: Scolder<ExpectAny<Actual>, Options>;
    /**
     * Checks whether the type of the value is `unknown`.
     */
    toBeUnknown: Scolder<ExpectUnknown<Actual>, Options>;
    /**
     * Checks whether the type of the value is `never`.
     */
    toBeNever: Scolder<ExpectNever<Actual>, Options>;
    /**
     * Checks whether the type of the value is `function`.
     */
    toBeFunction: Scolder<ExpectFunction<Actual>, Options>;
    /**
     * Checks whether the type of the value is `object`.
     */
    toBeObject: Scolder<ExpectObject<Actual>, Options>;
    /**
     * Checks whether the type of the value is an {@linkcode Array}.
     */
    toBeArray: Scolder<ExpectArray<Actual>, Options>;
    /**
     * Checks whether the type of the value is `number`.
     */
    toBeNumber: Scolder<ExpectNumber<Actual>, Options>;
    /**
     * Checks whether the type of the value is `string`.
     */
    toBeString: Scolder<ExpectString<Actual>, Options>;
    /**
     * Checks whether the type of the value is `boolean`.
     */
    toBeBoolean: Scolder<ExpectBoolean<Actual>, Options>;
    /**
     * Checks whether the type of the value is `void`.
     */
    toBeVoid: Scolder<ExpectVoid<Actual>, Options>;
    /**
     * Checks whether the type of the value is `symbol`.
     */
    toBeSymbol: Scolder<ExpectSymbol<Actual>, Options>;
    /**
     * Checks whether the type of the value is `null`.
     */
    toBeNull: Scolder<ExpectNull<Actual>, Options>;
    /**
     * Checks whether the type of the value is `undefined`.
     */
    toBeUndefined: Scolder<ExpectUndefined<Actual>, Options>;
    /**
     * Checks whether the type of the value is `null` or `undefined`.
     */
    toBeNullable: Scolder<ExpectNullable<Actual>, Options>;
    /**
     * Checks whether the type of the value is **`bigint`**.
     *
     * @example
     * <caption>#### Distinguish between **`number`** and **`bigint`**</caption>
     *
     * ```ts
     * import { expectTypeOf } from 'expect-type'
     *
     * const aVeryBigInteger = 10n ** 100n
     *
     * expectTypeOf(aVeryBigInteger).not.toBeNumber()
     *
     * expectTypeOf(aVeryBigInteger).toBeBigInt()
     * ```
     *
     * @since 1.1.0
     */
    toBeBigInt: Scolder<ExpectBigInt<Actual>, Options>;
    /**
     * Checks whether a function is callable with the given parameters.
     *
     * __Note__: You cannot negate this assertion with
     * {@linkcode PositiveExpectTypeOf.not | .not}, you need to use
     * `ts-expect-error` instead.
     *
     * @example
     * ```ts
     * const f = (a: number) => [a, a]
     *
     * expectTypeOf(f).toBeCallableWith(1)
     * ```
     *
     * __Known Limitation__: This assertion will likely fail if you try to use it
     * with a generic function or an overload.
     * @see {@link https://github.com/mmkal/expect-type/issues/50 | This issue} for an example and a workaround.
     *
     * @param args - The arguments to check for callability.
     * @returns `true`.
     */
    toBeCallableWith: Options['positive'] extends true ? <Args extends OverloadParameters<Actual>>(...args: Args) => ExpectTypeOf<OverloadsNarrowedByParameters<Actual, Args>, Options> : never;
    /**
     * Checks whether a class is constructible with the given parameters.
     *
     * @example
     * ```ts
     * expectTypeOf(Date).toBeConstructibleWith('1970')
     *
     * expectTypeOf(Date).toBeConstructibleWith(0)
     *
     * expectTypeOf(Date).toBeConstructibleWith(new Date())
     *
     * expectTypeOf(Date).toBeConstructibleWith()
     * ```
     *
     * @param args - The arguments to check for constructibility.
     * @returns `true`.
     */
    toBeConstructibleWith: Options['positive'] extends true ? <Args extends ConstructorOverloadParameters<Actual>>(...args: Args) => true : never;
    /**
     * Equivalent to the {@linkcode Extract} utility type.
     * Helps narrow down complex union types.
     *
     * @example
     * ```ts
     * type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T }
     *
     * interface CSSProperties {
     *   margin?: string
     *   padding?: string
     * }
     *
     * function getResponsiveProp<T>(_props: T): ResponsiveProp<T> {
     *   return {}
     * }
     *
     * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' }
     *
     * expectTypeOf(getResponsiveProp(cssProperties))
     *   .extract<{ xs?: any }>() // extracts the last type from a union
     *   .toEqualTypeOf<{
     *     xs?: CSSProperties
     *     sm?: CSSProperties
     *     md?: CSSProperties
     *   }>()
     *
     * expectTypeOf(getResponsiveProp(cssProperties))
     *   .extract<unknown[]>() // extracts an array from a union
     *   .toEqualTypeOf<CSSProperties[]>()
     * ```
     *
     * __Note__: If no type is found in the union, it will return `never`.
     *
     * @param v - The type to extract from the union.
     * @returns The type after extracting the type from the union.
     */
    extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, Options>;
    /**
     * Equivalent to the {@linkcode Exclude} utility type.
     * Removes types from a union.
     *
     * @example
     * ```ts
     * type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T }
     *
     * interface CSSProperties {
     *   margin?: string
     *   padding?: string
     * }
     *
     * function getResponsiveProp<T>(_props: T): ResponsiveProp<T> {
     *   return {}
     * }
     *
     * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' }
     *
     * expectTypeOf(getResponsiveProp(cssProperties))
     *   .exclude<unknown[]>()
     *   .exclude<{ xs?: unknown }>() // or just `.exclude<unknown[] | { xs?: unknown }>()`
     *   .toEqualTypeOf<CSSProperties>()
     * ```
     */
    exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, Options>;
    /**
     * Equivalent to the {@linkcode Pick} utility type.
     * Helps select a subset of properties from an object type.
     *
     * @example
     * ```ts
     * interface Person {
     *   name: string
     *   age: number
     * }
     *
     * expectTypeOf<Person>()
     *   .pick<'name'>()
     *   .toEqualTypeOf<{ name: string }>()
     * ```
     *
     * @param keyToPick - The property key to pick.
     * @returns The type after picking the property.
     */
    pick: <KeyToPick extends keyof Actual>(keyToPick?: KeyToPick) => ExpectTypeOf<Pick<Actual, KeyToPick>, Options>;
    /**
     * Equivalent to the {@linkcode Omit} utility type.
     * Helps remove a subset of properties from an object type.
     *
     * @example
     * ```ts
     * interface Person {
     *   name: string
     *   age: number
     * }
     *
     * expectTypeOf<Person>().omit<'name'>().toEqualTypeOf<{ age: number }>()
     * ```
     *
     * @param keyToOmit - The property key to omit.
     * @returns The type after omitting the property.
     */
    omit: <KeyToOmit extends keyof Actual | (PropertyKey & Record<never, never>)>(keyToOmit?: KeyToOmit) => ExpectTypeOf<Omit<Actual, KeyToOmit>, Options>;
    /**
     * Extracts a certain function argument with `.parameter(number)` call to
     * perform other assertions on it.
     *
     * @example
     * ```ts
     * function foo(a: number, b: string) {
     *   return [a, b]
     * }
     *
     * expectTypeOf(foo).parameter(0).toBeNumber()
     *
     * expectTypeOf(foo).parameter(1).toBeString()
     * ```
     *
     * @param index - The index of the parameter to extract.
     * @returns The extracted parameter type.
     */
    parameter: <Index extends number>(index: Index) => ExpectTypeOf<OverloadParameters<Actual>[Index], Options>;
    /**
     * Equivalent to the {@linkcode Parameters} utility type.
     * Extracts function parameters to perform assertions on its value.
     * Parameters are returned as an array.
     *
     * @example
     * ```ts
     * function noParam() {}
     *
     * function hasParam(s: string) {}
     *
     * expectTypeOf(noParam).parameters.toEqualTypeOf<[]>()
     *
     * expectTypeOf(hasParam).parameters.toEqualTypeOf<[string]>()
     * ```
     */
    parameters: ExpectTypeOf<OverloadParameters<Actual>, Options>;
    /**
     * Equivalent to the {@linkcode ConstructorParameters} utility type.
     * Extracts constructor parameters as an array of values and
     * perform assertions on them with this method.
     *
     * For overloaded constructors it will return a union of all possible parameter-tuples.
     *
     * @example
     * ```ts
     * expectTypeOf(Date).constructorParameters.toEqualTypeOf<
     *   [] | [string | number | Date]
     * >()
     * ```
     */
    constructorParameters: ExpectTypeOf<ConstructorOverloadParameters<Actual>, Options>;
    /**
     * Equivalent to the {@linkcode ThisParameterType} utility type.
     * Extracts the `this` parameter of a function to
     * perform assertions on its value.
     *
     * @example
     * ```ts
     * function greet(this: { name: string }, message: string) {
     *   return `Hello ${this.name}, here's your message: ${message}`
     * }
     *
     * expectTypeOf(greet).thisParameter.toEqualTypeOf<{ name: string }>()
     * ```
     */
    thisParameter: ExpectTypeOf<ThisParameterType<Actual>, Options>;
    /**
     * Equivalent to the {@linkcode InstanceType} utility type.
     * Extracts the instance type of a class to perform assertions on.
     *
     * @example
     * ```ts
     * expectTypeOf(Date).instance.toHaveProperty('toISOString')
     * ```
     */
    instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf<I, Options> : never;
    /**
     * Equivalent to the {@linkcode ReturnType} utility type.
     * Extracts the return type of a function.
     *
     * @example
     * ```ts
     * expectTypeOf(() => {}).returns.toBeVoid()
     *
     * expectTypeOf((a: number) => [a, a]).returns.toEqualTypeOf([1, 2])
     * ```
     */
    returns: Actual extends Function ? ExpectTypeOf<OverloadReturnTypes<Actual>, Options> : never;
    /**
     * Extracts resolved value of a Promise,
     * so you can perform other assertions on it.
     *
     * @example
     * ```ts
     * async function asyncFunc() {
     *   return 123
     * }
     *
     * expectTypeOf(asyncFunc).returns.resolves.toBeNumber()
     *
     * expectTypeOf(Promise.resolve('string')).resolves.toBeString()
     * ```
     *
     * Type Equivalent:
     * ```ts
     * type Resolves<PromiseType> = PromiseType extends PromiseLike<infer ResolvedType>
     *   ? ResolvedType
     *   : never
     * ```
     */
    resolves: Actual extends PromiseLike<infer ResolvedType> ? ExpectTypeOf<ResolvedType, Options> : never;
    /**
     * Extracts array item type to perform assertions on.
     *
     * @example
     * ```ts
     * expectTypeOf([1, 2, 3]).items.toEqualTypeOf<number>()
     *
     * expectTypeOf([1, 2, 3]).items.not.toEqualTypeOf<string>()
     * ```
     *
     * __Type Equivalent__:
     * ```ts
     * type Items<ArrayType> = ArrayType extends ArrayLike<infer ItemType>
     *   ? ItemType
     *   : never
     * ```
     */
    items: Actual extends ArrayLike<infer ItemType> ? ExpectTypeOf<ItemType, Options> : never;
    /**
     * Extracts the type guarded by a function to perform assertions on.
     *
     * @example
     * ```ts
     * function isString(v: any): v is string {
     *   return typeof v === 'string'
     * }
     *
     * expectTypeOf(isString).guards.toBeString()
     * ```
     */
    guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf<T, Options> : never;
    /**
     * Extracts the type asserted by a function to perform assertions on.
     *
     * @example
     * ```ts
     * function assertNumber(v: any): asserts v is number {
     *   if (typeof v !== 'number')
     *     throw new TypeError('Nope !')
     * }
     *
     * expectTypeOf(assertNumber).asserts.toBeNumber()
     * ```
     */
    asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf<T, Options> : never;
}

/**
 * Registers a callback function to be executed once before all tests within the current suite.
 * This hook is useful for scenarios where you need to perform setup operations that are common to all tests in a suite, such as initializing a database connection or setting up a test environment.
 *
 * **Note:** The `beforeAll` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file.
 *
 * @param {Function} fn - The callback function to be executed before all tests.
 * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
 * @returns {void}
 * @example
 * ```ts
 * // Example of using beforeAll to set up a database connection
 * beforeAll(async () => {
 *   await database.connect();
 * });
 * ```
 */
export declare function beforeAll(fn: BeforeAllListener, timeout?: number): void;

declare interface BeforeAllListener {
    (suite: Readonly<RunnerTestSuite | RunnerTestFile>): Awaitable_2<unknown>;
}

/**
 * Registers a callback function to be executed before each test within the current suite.
 * This hook is useful for scenarios where you need to reset or reinitialize the test environment before each test runs, such as resetting database states, clearing caches, or reinitializing variables.
 *
 * **Note:** The `beforeEach` hooks are executed in the order they are defined one after another. You can configure this by changing the `sequence.hooks` option in the config file.
 *
 * @param {Function} fn - The callback function to be executed before each test. This function receives an `TestContext` parameter if additional test context is needed.
 * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
 * @returns {void}
 * @example
 * ```ts
 * // Example of using beforeEach to reset a database state
 * beforeEach(async () => {
 *   await database.reset();
 * });
 * ```
 */
export declare function beforeEach<ExtraContext = object>(fn: BeforeEachListener<ExtraContext>, timeout?: number): void;

declare interface BeforeEachListener<ExtraContext = object> {
    (context: ExtendedContext<RunnerTestCase | RunnerCustomCase> & ExtraContext, suite: Readonly<RunnerTestSuite>): Awaitable_2<unknown>;
}

export declare const bench: BenchmarkAPI;

/**
 * Both the `Task` and `Bench` objects extend the `EventTarget` object,
 * so you can attach a listeners to different types of events
 * to each class instance using the universal `addEventListener` and
 * `removeEventListener`
 */
/**
 * Bench events
 */
declare type BenchEvents = 'abort' | 'complete' | 'error' | 'reset' | 'start' | 'warmup' | 'cycle' | 'add' | 'remove' | 'todo';

declare interface BenchEventsMap {
    abort: NoopEventListener;
    start: NoopEventListener;
    complete: NoopEventListener;
    warmup: NoopEventListener;
    reset: NoopEventListener;
    add: TaskEventListener;
    remove: TaskEventListener;
    cycle: TaskEventListener;
    error: TaskEventListener;
    todo: TaskEventListener;
}

/**
 * The Benchmark instance for keeping track of the benchmark tasks and controlling
 * them.
 */
export declare class BenchFactory extends EventTarget {
    _tasks: Map<string, BenchTask>;
    _todos: Map<string, BenchTask>;
    /**
     * Executes tasks concurrently based on the specified concurrency mode.
     *
     * - When `mode` is set to `null` (default), concurrency is disabled.
     * - When `mode` is set to 'task', each task's iterations (calls of a task function) run concurrently.
     * - When `mode` is set to 'bench', different tasks within the bench run concurrently.
     */
    concurrency: 'task' | 'bench' | null;
    /**
     * The maximum number of concurrent tasks to run. Defaults to Infinity.
     */
    threshold: number;
    signal?: AbortSignal;
    throws: boolean;
    warmupTime: number;
    warmupIterations: number;
    time: number;
    iterations: number;
    now: () => number;
    setup: Hook;
    teardown: Hook;
    constructor(options?: BenchOptions);
    private runTask;
    /**
     * run the added tasks that were registered using the
     * {@link add} method.
     * Note: This method does not do any warmup. Call {@link warmup} for that.
     */
    run(): Promise<BenchTask[]>;
    /**
     * See Bench.{@link concurrency}
     */
    runConcurrently(threshold?: number, mode?: NonNullable<BenchFactory['concurrency']>): Promise<BenchTask[]>;
    /**
     * warmup the benchmark tasks.
     * This is not run by default by the {@link run} method.
     */
    warmup(): Promise<void>;
    /**
     * warmup the benchmark tasks concurrently.
     * This is not run by default by the {@link runConcurrently} method.
     */
    warmupConcurrently(threshold?: number, mode?: NonNullable<BenchFactory['concurrency']>): Promise<void>;
    /**
     * reset each task and remove its result
     */
    reset(): void;
    /**
     * add a benchmark task to the task map
     */
    add(name: string, fn: Fn, opts?: FnOptions): this;
    /**
     * add a benchmark todo to the todo map
     */
    todo(name: string, fn?: Fn, opts?: FnOptions): this;
    /**
     * remove a benchmark task from the task map
     */
    remove(name: string): this;
    addEventListener<K extends BenchEvents, T = BenchEventsMap[K]>(type: K, listener: T, options?: AddEventListenerOptionsArgument): void;
    removeEventListener<K extends BenchEvents, T = BenchEventsMap[K]>(type: K, listener: T, options?: RemoveEventListenerOptionsArgument): void;
    /**
     * table of the tasks results
     */
    table(convert?: (task: BenchTask) => Record<string, string | number> | undefined): (Record<string, string | number> | null)[];
    /**
     * (getter) tasks results as an array
     */
    get results(): (BenchTaskResult | undefined)[];
    /**
     * (getter) tasks as an array
     */
    get tasks(): BenchTask[];
    get todos(): BenchTask[];
    /**
     * get a task based on the task name
     */
    getTask(name: string): BenchTask | undefined;
}

export declare type BenchFunction = (this: BenchFactory) => Promise<void> | void;

export declare interface Benchmark extends RunnerCustomCase {
    meta: {
        benchmark: true;
        result?: BenchTaskResult;
    };
}

export declare type BenchmarkAPI = ChainableBenchmarkAPI & {
    skipIf: (condition: any) => ChainableBenchmarkAPI;
    runIf: (condition: any) => ChainableBenchmarkAPI;
};

export declare interface BenchmarkResult extends BenchTaskResult {
    name: string;
    rank: number;
    sampleCount: number;
    median: number;
}

export declare type BenchOptions = {
    /**
     * time needed for running a benchmark task (milliseconds) @default 500
     */
    time?: number;
    /**
     * number of times that a task should run if even the time option is finished @default 10
     */
    iterations?: number;
    /**
     * function to get the current timestamp in milliseconds
     */
    now?: () => number;
    /**
     * An AbortSignal for aborting the benchmark
     */
    signal?: AbortSignal;
    /**
     * Throw if a task fails (events will not work if true)
     */
    throws?: boolean;
    /**
     * warmup time (milliseconds) @default 100ms
     */
    warmupTime?: number;
    /**
     * warmup iterations @default 5
     */
    warmupIterations?: number;
    /**
     * setup function to run before each benchmark task (cycle)
     */
    setup?: Hook;
    /**
     * teardown function to run after each benchmark task (cycle)
     */
    teardown?: Hook;
};

/**
 * A class that represents each benchmark task in Tinybench. It keeps track of the
 * results, name, Bench instance, the task function and the number times the task
 * function has been executed.
 */
export declare class BenchTask extends EventTarget {
    bench: BenchFactory;
    /**
     * task name
     */
    name: string;
    fn: Fn;
    runs: number;
    /**
     * the result object
     */
    result?: BenchTaskResult;
    /**
     * Task options
     */
    opts: FnOptions;
    constructor(bench: BenchFactory, name: string, fn: Fn, opts?: FnOptions);
    private loop;
    /**
     * run the current task and write the results in `Task.result` object
     */
    run(): Promise<this>;
    /**
     * warmup the current task
     */
    warmup(): Promise<void>;
    addEventListener<K extends TaskEvents, T = TaskEventsMap[K]>(type: K, listener: T, options?: AddEventListenerOptionsArgument): void;
    removeEventListener<K extends TaskEvents, T = TaskEventsMap[K]>(type: K, listener: T, options?: RemoveEventListenerOptionsArgument): void;
    /**
     * change the result object values
     */
    setResult(result: Partial<BenchTaskResult>): void;
    /**
     * reset the task to make the `Task.runs` a zero-value and remove the `Task.result`
     * object
     */
    reset(): void;
}

/**
 * the benchmark task result object
 */
export declare type BenchTaskResult = {
    error?: unknown;
    /**
     * The amount of time in milliseconds to run the benchmark task (cycle).
     */
    totalTime: number;
    /**
     * the minimum value in the samples
     */
    min: number;
    /**
     * the maximum value in the samples
     */
    max: number;
    /**
     * the number of operations per second
     */
    hz: number;
    /**
     * how long each operation takes (ms)
     */
    period: number;
    /**
     * task samples of each task iteration time (ms)
     */
    samples: number[];
    /**
     * samples mean/average (estimate of the population mean)
     */
    mean: number;
    /**
     * samples variance (estimate of the population variance)
     */
    variance: number;
    /**
     * samples standard deviation (estimate of the population standard deviation)
     */
    sd: number;
    /**
     * standard error of the mean (a.k.a. the standard deviation of the sampling distribution of the sample mean)
     */
    sem: number;
    /**
     * degrees of freedom
     */
    df: number;
    /**
     * critical value of the samples
     */
    critical: number;
    /**
     * margin of error
     */
    moe: number;
    /**
     * relative margin of error
     */
    rme: number;
    /**
     * p75 percentile
     */
    p75: number;
    /**
     * p99 percentile
     */
    p99: number;
    /**
     * p995 percentile
     */
    p995: number;
    /**
     * p999 percentile
     */
    p999: number;
};

declare type BirpcFn<T> = PromisifyFn<T> & {
    /**
     * Send event without asking for response
     */
    asEvent: (...args: ArgumentsType_3<T>) => void;
};

declare type BirpcReturn<RemoteFunctions, LocalFunctions = Record<string, never>> = {
    [K in keyof RemoteFunctions]: BirpcFn<RemoteFunctions[K]>;
} & {
    $functions: LocalFunctions;
    $close: () => void;
};

export declare interface BrowserUI {
    setCurrentFileId: (fileId: string) => void;
    setIframeViewport: (width: number, height: number) => Promise<void>;
}

declare type BuiltinEnvironment = 'node' | 'jsdom' | 'happy-dom' | 'edge-runtime';

export declare type CancelReason = 'keyboard-input' | 'test-failure' | (string & Record<string, never>);

export { chai_2 as chai }

declare type ChainableBenchmarkAPI = ChainableFunction<'skip' | 'only' | 'todo', (name: string | Function, fn?: BenchFunction, options?: BenchOptions) => void>;

declare type ChainableFunction<T extends string, F extends (...args: any) => any, C = object> = F & {
    [x in T]: ChainableFunction<T, F, C>;
} & {
    fn: (this: Record<T, any>, ...args: Parameters<F>) => ReturnType<F>;
} & C;

declare type ChainableSuiteAPI<ExtraContext = object> = ChainableFunction<'concurrent' | 'sequential' | 'only' | 'skip' | 'todo' | 'shuffle', SuiteCollectorCallable<ExtraContext>, {
    each: TestEachFunction;
}>;

declare type ChainableTestAPI<ExtraContext = object> = ChainableFunction<'concurrent' | 'sequential' | 'only' | 'skip' | 'todo' | 'fails', TestCollectorCallable<ExtraContext>, {
    each: TestEachFunction;
    for: TestForFunction<ExtraContext>;
}>;

declare type Classes<T> = {
    [K in keyof T]: T[K] extends new (...args: any[]) => any ? K : never;
}[keyof T] & (string | symbol);

declare type ColorName = keyof typeof colorsMap;

/**
 * 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;
    };
}

declare type Colors_2 = ColorsMethods & {
    isColorSupported: boolean;
    reset: (input: unknown) => string;
};

declare const colorsMap: {
    readonly reset: readonly [0, 0];
    readonly bold: readonly [1, 22, "\u001B[22m\u001B[1m"];
    readonly dim: readonly [2, 22, "\u001B[22m\u001B[2m"];
    readonly italic: readonly [3, 23];
    readonly underline: readonly [4, 24];
    readonly inverse: readonly [7, 27];
    readonly hidden: readonly [8, 28];
    readonly strikethrough: readonly [9, 29];
    readonly black: readonly [30, 39];
    readonly red: readonly [31, 39];
    readonly green: readonly [32, 39];
    readonly yellow: readonly [33, 39];
    readonly blue: readonly [34, 39];
    readonly magenta: readonly [35, 39];
    readonly cyan: readonly [36, 39];
    readonly white: readonly [37, 39];
    readonly gray: readonly [90, 39];
    readonly bgBlack: readonly [40, 49];
    readonly bgRed: readonly [41, 49];
    readonly bgGreen: readonly [42, 49];
    readonly bgYellow: readonly [43, 49];
    readonly bgBlue: readonly [44, 49];
    readonly bgMagenta: readonly [45, 49];
    readonly bgCyan: readonly [46, 49];
    readonly bgWhite: readonly [47, 49];
    readonly blackBright: readonly [90, 39];
    readonly redBright: readonly [91, 39];
    readonly greenBright: readonly [92, 39];
    readonly yellowBright: readonly [93, 39];
    readonly blueBright: readonly [94, 39];
    readonly magentaBright: readonly [95, 39];
    readonly cyanBright: readonly [96, 39];
    readonly whiteBright: readonly [97, 39];
    readonly bgBlackBright: readonly [100, 49];
    readonly bgRedBright: readonly [101, 49];
    readonly bgGreenBright: readonly [102, 49];
    readonly bgYellowBright: readonly [103, 49];
    readonly bgBlueBright: readonly [104, 49];
    readonly bgMagentaBright: readonly [105, 49];
    readonly bgCyanBright: readonly [106, 49];
    readonly bgWhiteBright: readonly [107, 49];
};

declare type ColorsMethods = {
    [Key in ColorName]: Formatter;
};

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;
    spacingInner: string;
    spacingOuter: string;
}

/** @deprecated do not use, internal helper */
export declare type Constructable = Constructable_4;

declare interface Constructable_2 {
    new (...args: any[]): any;
}

declare interface Constructable_3 {
    new (...args: any[]): any;
}

declare interface Constructable_4 {
    new (...args: any[]): any;
}

/**
 * A union type of the parameters allowed for any overload
 * of constructor {@linkcode ConstructorType}.
 */
declare type ConstructorOverloadParameters<ConstructorType> = ConstructorOverloadsUnion<ConstructorType> extends InferConstructor<infer Ctor> ? ConstructorParameters<Ctor> : never;

/**
 * Get a union of overload variants for a constructor
 * {@linkcode ConstructorType}. Does a check for whether we can do the
 * one-shot 10-overload matcher (which works for ts\>5.3), and if not,
 * falls back to the more complicated utility.
 */
declare type ConstructorOverloadsUnion<ConstructorType> = IsNever<TSPost53ConstructorOverloadsInfoUnion<new (a: 1) => any>> extends true ? TSPre53ConstructorOverloadsInfoUnion<ConstructorType> : TSPost53ConstructorOverloadsInfoUnion<ConstructorType>;

export declare interface ContextRPC {
    pool: string;
    worker: string;
    workerId: number;
    config: SerializedConfig;
    projectName: string;
    files: string[];
    environment: ContextTestEnvironment;
    providedContext: Record<string, any>;
    invalidates?: string[];
}

export declare interface ContextTestEnvironment {
    name: string;
    transformMode?: TransformMode;
    options: Record<string, any> | null;
}

declare function createColors(isTTY?: boolean): Colors_2;

export declare function createExpect(test?: TaskPopulated): ExpectStatic;

/** @deprecated use `RunnerCustomCase` instead */
export declare type Custom = RunnerCustomCase;

/**
 * For versions of TypeScript below 5.3, we need to check for 10 overloads,
 * then 9, then 8, etc., to get a union of the overload variants.
 */
declare type DecreasingConstructorOverloadsInfoUnion<ConstructorType> = ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
    new (...args: infer A3): infer R3;
    new (...args: infer A4): infer R4;
    new (...args: infer A5): infer R5;
    new (...args: infer A6): infer R6;
    new (...args: infer A7): infer R7;
    new (...args: infer A8): infer R8;
    new (...args: infer A9): infer R9;
    new (...args: infer A10): infer R10;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) | (new (...p: A10) => R10) : ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
    new (...args: infer A3): infer R3;
    new (...args: infer A4): infer R4;
    new (...args: infer A5): infer R5;
    new (...args: infer A6): infer R6;
    new (...args: infer A7): infer R7;
    new (...args: infer A8): infer R8;
    new (...args: infer A9): infer R9;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) : ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
    new (...args: infer A3): infer R3;
    new (...args: infer A4): infer R4;
    new (...args: infer A5): infer R5;
    new (...args: infer A6): infer R6;
    new (...args: infer A7): infer R7;
    new (...args: infer A8): infer R8;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) : ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
    new (...args: infer A3): infer R3;
    new (...args: infer A4): infer R4;
    new (...args: infer A5): infer R5;
    new (...args: infer A6): infer R6;
    new (...args: infer A7): infer R7;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) : ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
    new (...args: infer A3): infer R3;
    new (...args: infer A4): infer R4;
    new (...args: infer A5): infer R5;
    new (...args: infer A6): infer R6;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) : ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
    new (...args: infer A3): infer R3;
    new (...args: infer A4): infer R4;
    new (...args: infer A5): infer R5;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) : ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
    new (...args: infer A3): infer R3;
    new (...args: infer A4): infer R4;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) : ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
    new (...args: infer A3): infer R3;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) : ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) : ConstructorType extends new (...args: infer A1) => infer R1 ? (new (...p: A1) => R1) : never;

/**
 * For versions of TypeScript below 5.3, we need to check for 10 overloads,
 * then 9, then 8, etc., to get a union of the overload variants.
 */
declare type DecreasingOverloadsInfoUnion<F> = F extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
    (...args: infer A3): infer R3;
    (...args: infer A4): infer R4;
    (...args: infer A5): infer R5;
    (...args: infer A6): infer R6;
    (...args: infer A7): infer R7;
    (...args: infer A8): infer R8;
    (...args: infer A9): infer R9;
    (...args: infer A10): infer R10;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) | ((...p: A10) => R10) : F extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
    (...args: infer A3): infer R3;
    (...args: infer A4): infer R4;
    (...args: infer A5): infer R5;
    (...args: infer A6): infer R6;
    (...args: infer A7): infer R7;
    (...args: infer A8): infer R8;
    (...args: infer A9): infer R9;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) : F extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
    (...args: infer A3): infer R3;
    (...args: infer A4): infer R4;
    (...args: infer A5): infer R5;
    (...args: infer A6): infer R6;
    (...args: infer A7): infer R7;
    (...args: infer A8): infer R8;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) : F extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
    (...args: infer A3): infer R3;
    (...args: infer A4): infer R4;
    (...args: infer A5): infer R5;
    (...args: infer A6): infer R6;
    (...args: infer A7): infer R7;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) : F extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
    (...args: infer A3): infer R3;
    (...args: infer A4): infer R4;
    (...args: infer A5): infer R5;
    (...args: infer A6): infer R6;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) : F extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
    (...args: infer A3): infer R3;
    (...args: infer A4): infer R4;
    (...args: infer A5): infer R5;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) : F extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
    (...args: infer A3): infer R3;
    (...args: infer A4): infer R4;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) : F extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
    (...args: infer A3): infer R3;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) : F extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) : F extends (...args: infer A1) => infer R1 ? ((...p: A1) => R1) : never;

/**
 * Represents a deeply branded type.
 *
 * Recursively walk a type and replace it with a branded type related to the
 * original. This is useful for equality-checking stricter than
 * `A extends B ? B extends A ? true : false : false`, because it detects the
 * difference between a few edge-case types that vanilla TypeScript
 * doesn't by default:
 * - `any` vs `unknown`
 * - `{ readonly a: string }` vs `{ a: string }`
 * - `{ a?: string }` vs `{ a: string | undefined }`
 *
 * __Note__: not very performant for complex types - this should only be used
 * when you know you need it. If doing an equality check, it's almost always
 * better to use {@linkcode StrictEqualUsingTSInternalIdenticalToOperator}.
 */
declare type DeepBrand<T> = IsNever<T> extends true ? {
    type: 'never';
} : IsAny<T> extends true ? {
    type: 'any';
} : IsUnknown<T> extends true ? {
    type: 'unknown';
} : T extends string | number | boolean | symbol | bigint | null | undefined | void ? {
    type: 'primitive';
    value: T;
} : T extends new (...args: any[]) => any ? {
    type: 'constructor';
    params: ConstructorOverloadParameters<T>;
    instance: DeepBrand<InstanceType<Extract<T, new (...args: any) => any>>>;
} : T extends (...args: infer P) => infer R ? NumOverloads<T> extends 1 ? {
    type: 'function';
    params: DeepBrand<P>;
    return: DeepBrand<R>;
    this: DeepBrand<ThisParameterType<T>>;
    props: DeepBrand<Omit<T, keyof Function>>;
} : UnionToTuple<OverloadsInfoUnion<T>> extends infer OverloadsTuple ? {
    type: 'overloads';
    overloads: {
        [K in keyof OverloadsTuple]: DeepBrand<OverloadsTuple[K]>;
    };
} : never : T extends any[] ? {
    type: 'array';
    items: {
        [K in keyof T]: T[K];
    };
} : {
    type: 'object';
    properties: {
        [K in keyof T]: DeepBrand<T[K]>;
    };
    readonly: ReadonlyKeys<T>;
    required: RequiredKeys<T>;
    optional: OptionalKeys<T>;
    constructorParams: DeepBrand<ConstructorOverloadParameters<T>>;
};

declare const _default: Colors_2;

/**
 * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
 * Suites can contain both tests and other suites, enabling complex test structures.
 *
 * @param {string} name - The name of the suite, used for identification and reporting.
 * @param {Function} fn - A function that defines the tests and suites within this suite.
 * @example
 * ```ts
 * // Define a suite with two tests
 * describe('Math operations', () => {
 *   test('should add two numbers', () => {
 *     expect(add(1, 2)).toBe(3);
 *   });
 *
 *   test('should subtract two numbers', () => {
 *     expect(subtract(5, 2)).toBe(3);
 *   });
 * });
 * ```
 * @example
 * ```ts
 * // Define nested suites
 * describe('String operations', () => {
 *   describe('Trimming', () => {
 *     test('should trim whitespace from start and end', () => {
 *       expect('  hello  '.trim()).toBe('hello');
 *     });
 *   });
 *
 *   describe('Concatenation', () => {
 *     test('should concatenate two strings', () => {
 *       expect('hello' + ' ' + 'world').toBe('hello world');
 *     });
 *   });
 * });
 * ```
 */
export declare const describe: SuiteAPI;

/**
 * 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.
 */

/**
 * @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): string | undefined;

export 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;
    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;

/** @deprecated don't use `DoneCallback` since it's not supported */
export declare type DoneCallback = DoneCallback_2;

declare type DoneCallback_2 = (error?: any) => void;

declare interface EachFunctionReturn<T extends any[]> {
    /**
     * @deprecated Use options as the second argument instead
     */
    (name: string | Function, fn: (...args: T) => Awaitable_2<void>, options: TestOptions): void;
    (name: string | Function, fn: (...args: T) => Awaitable_2<void>, options?: number | TestOptions): void;
    (name: string | Function, options: TestOptions, fn: (...args: T) => Awaitable_2<void>): void;
}

declare interface Environment {
    name: string;
    transformMode: 'web' | 'ssr';
    setupVM?: (options: Record<string, any>) => Awaitable_3<VmEnvironmentReturn>;
    setup: (global: any, options: Record<string, any>) => Awaitable_3<EnvironmentReturn>;
}

declare interface EnvironmentReturn {
    teardown: (global: any) => Awaitable_3<void>;
}

/**
 * Represents an equality type that returns {@linkcode Right} if
 * {@linkcode Left} is `true`,
 * otherwise returns the negation of {@linkcode Right}.
 */
declare type Eq<Left extends boolean, Right extends boolean> = Left extends true ? Right : Not<Right>;

/**
 * @deprecated Use `TestError` instead
 */
export declare interface ErrorWithDiff {
    message: string;
    name?: string;
    cause?: unknown;
    nameStr?: string;
    stack?: string;
    stackStr?: string;
    stacks?: ParsedStack[];
    showDiff?: boolean;
    actual?: any;
    expected?: any;
    operator?: string;
    type?: string;
    frame?: string;
    diff?: string;
    codeFrame?: string;
}

declare type ESModuleExports = Record<string, unknown>;

export declare const expect: ExpectStatic;

declare type ExpectAny<T> = {
    [expectAny]: T;
    result: IsAny<T>;
};

/**
 * @internal
 */
declare const expectAny: unique symbol;

declare type ExpectArray<T> = {
    [expectArray]: T;
    result: ExtendsExcludingAnyOrNever<T, any[]>;
};

/**
 * @internal
 */
declare const expectArray: unique symbol;

declare type ExpectationResult = SyncExpectationResult | AsyncExpectationResult;

declare type ExpectBigInt<T> = {
    [expectBigInt]: T;
    result: ExtendsExcludingAnyOrNever<T, bigint>;
};

/**
 * @internal
 */
declare const expectBigInt: unique symbol;

declare type ExpectBoolean<T> = {
    [expectBoolean]: T;
    result: ExtendsExcludingAnyOrNever<T, boolean>;
};

/**
 * @internal
 */
declare const expectBoolean: unique symbol;

declare type ExpectFunction<T> = {
    [expectFunction]: T;
    result: ExtendsExcludingAnyOrNever<T, (...args: any[]) => any>;
};

/**
 * @internal
 */
declare const expectFunction: unique symbol;

declare type ExpectNever<T> = {
    [expectNever]: T;
    result: IsNever<T>;
};

/**
 * @internal
 */
declare const expectNever: unique symbol;

declare type ExpectNull<T> = {
    [expectNull]: T;
    result: ExtendsExcludingAnyOrNever<T, null>;
};

/**
 * @internal
 */
declare const expectNull: unique symbol;

declare type ExpectNullable<T> = {
    [expectNullable]: T;
    result: Not<StrictEqualUsingBranding<T, NonNullable<T>>>;
};

/**
 * @internal
 */
declare const expectNullable: unique symbol;

declare type ExpectNumber<T> = {
    [expectNumber]: T;
    result: ExtendsExcludingAnyOrNever<T, number>;
};

/**
 * @internal
 */
declare const expectNumber: unique symbol;

declare type ExpectObject<T> = {
    [expectObject]: T;
    result: ExtendsExcludingAnyOrNever<T, object>;
};

/**
 * @internal
 */
declare const expectObject: unique symbol;

export declare interface ExpectStatic extends Chai.ExpectStatic, AsymmetricMatchersContaining {
    <T>(actual: T, message?: string): Assertion<T>;
    extend: (expects: MatchersObject) => void;
    anything: () => any;
    any: (constructor: unknown) => any;
    getState: () => MatcherState;
    setState: (state: Partial<MatcherState>) => void;
    not: AsymmetricMatchersContaining;
}

declare type ExpectString<T> = {
    [expectString]: T;
    result: ExtendsExcludingAnyOrNever<T, string>;
};

/**
 * @internal
 */
declare const expectString: unique symbol;

declare type ExpectSymbol<T> = {
    [expectSymbol]: T;
    result: ExtendsExcludingAnyOrNever<T, symbol>;
};

/**
 * @internal
 */
declare const expectSymbol: unique symbol;

/**
 * Represents a conditional type that selects either
 * {@linkcode PositiveExpectTypeOf} or {@linkcode NegativeExpectTypeOf} based
 * on the value of the `positive` property in the {@linkcode Options} type.
 */
export declare type ExpectTypeOf<Actual, Options extends {
    positive: boolean;
}> = Options['positive'] extends true ? PositiveExpectTypeOf<Actual> : NegativeExpectTypeOf<Actual>;

/**
 * Represents a function that allows asserting the expected type of a value.
 */
declare type _ExpectTypeOf = {
    /**
     * Asserts the expected type of a value.
     *
     * @param actual - The actual value being asserted.
     * @returns An object representing the expected type assertion.
     */
    <Actual>(actual: Actual): ExpectTypeOf<Actual, {
        positive: true;
        branded: false;
    }>;
    /**
     * Asserts the expected type of a value without providing an actual value.
     *
     * @returns An object representing the expected type assertion.
     */
    <Actual>(): ExpectTypeOf<Actual, {
        positive: true;
        branded: false;
    }>;
};

/**
 * Similar to Jest's `expect`, but with type-awareness.
 * Gives you access to a number of type-matchers that let you make assertions about the
 * form of a reference or generic type parameter.
 *
 * @example
 * ```ts
 * import { foo, bar } from '../foo'
 * import { expectTypeOf } from 'expect-type'
 *
 * test('foo types', () => {
 *   // make sure `foo` has type { a: number }
 *   expectTypeOf(foo).toMatchTypeOf({ a: 1 })
 *   expectTypeOf(foo).toHaveProperty('a').toBeNumber()
 *
 *   // make sure `bar` is a function taking a string:
 *   expectTypeOf(bar).parameter(0).toBeString()
 *   expectTypeOf(bar).returns.not.toBeAny()
 * })
 * ```
 *
 * @description
 * See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples.
 */
export declare const expectTypeOf: _ExpectTypeOf;

declare type ExpectUndefined<T> = {
    [expectUndefined]: T;
    result: ExtendsExcludingAnyOrNever<T, undefined>;
};

/**
 * @internal
 */
declare const expectUndefined: unique symbol;

declare type ExpectUnknown<T> = {
    [expectUnknown]: T;
    result: IsUnknown<T>;
};

/**
 * @internal
 */
declare const expectUnknown: unique symbol;

declare type ExpectVoid<T> = {
    [expectVoid]: T;
    result: ExtendsExcludingAnyOrNever<T, void>;
};

/**
 * @internal
 */
declare const expectVoid: unique symbol;

declare interface ExtendedAPI<ExtraContext> {
    skipIf: (condition: any) => ChainableTestAPI<ExtraContext>;
    runIf: (condition: any) => ChainableTestAPI<ExtraContext>;
}

export declare type ExtendedContext<T extends RunnerCustomCase | RunnerTestCase> = TaskContext<T> & TestContext;

/**
 * Checks if one type extends another. Note: this is not quite the same as `Left extends Right` because:
 * 1. If either type is `never`, the result is `true` iff the other type is also `never`.
 * 2. Types are wrapped in a 1-tuple so that union types are not distributed - instead we consider `string | number` to _not_ extend `number`. If we used `Left extends Right` directly you would get `Extends<string | number, number>` => `false | true` => `boolean`.
 */
declare type Extends<Left, Right> = IsNever<Left> extends true ? IsNever<Right> : [Left] extends [Right] ? true : false;

/**
 * Checks if the {@linkcode Left} type extends the {@linkcode Right} type,
 * excluding `any` or `never`.
 */
declare type ExtendsExcludingAnyOrNever<Left, Right> = IsAny<Left> extends true ? IsAny<Right> : Extends<Left, Right>;

declare type ExtractEachCallbackArgs<T extends ReadonlyArray<any>> = {
    1: [T[0]];
    2: [T[0], T[1]];
    3: [T[0], T[1], T[2]];
    4: [T[0], T[1], T[2], T[3]];
    5: [T[0], T[1], T[2], T[3], T[4]];
    6: [T[0], T[1], T[2], T[3], T[4], T[5]];
    7: [T[0], T[1], T[2], T[3], T[4], T[5], T[6]];
    8: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7]];
    9: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], T[8]];
    10: [T[0], T[1], T[2], T[3], T[4], T[5], T[6], T[7], T[8], T[9]];
    fallback: Array<T extends ReadonlyArray<infer U> ? U : any>;
}[T extends Readonly<[any]> ? 1 : T extends Readonly<[any, any]> ? 2 : T extends Readonly<[any, any, any]> ? 3 : T extends Readonly<[any, any, any, any]> ? 4 : T extends Readonly<[any, any, any, any, any]> ? 5 : T extends Readonly<[any, any, any, any, any, any]> ? 6 : T extends Readonly<[any, any, any, any, any, any, any]> ? 7 : T extends Readonly<[any, any, any, any, any, any, any, any]> ? 8 : T extends Readonly<[any, any, any, any, any, any, any, any, any]> ? 9 : T extends Readonly<[any, any, any, any, any, any, any, any, any, any]> ? 10 : 'fallback'];

/**
 * Names of clock methods that may be faked by install.
 */
declare type FakeMethod =
| "setTimeout"
| "clearTimeout"
| "setImmediate"
| "clearImmediate"
| "setInterval"
| "clearInterval"
| "Date"
| "nextTick"
| "hrtime"
| "requestAnimationFrame"
| "cancelAnimationFrame"
| "requestIdleCallback"
| "cancelIdleCallback"
| "performance"
| "queueMicrotask";

declare interface FakeTimerInstallOpts {
    /**
     * Installs fake timers with the specified unix epoch (default: 0)
     */
    now?: number | Date | undefined;

    /**
     * An array with names of global methods and APIs to fake.
     * For instance, `vi.useFakeTimer({ toFake: ['setTimeout', 'performance'] })` will fake only `setTimeout()` and `performance.now()`
     * @default ['setTimeout', 'clearTimeout', 'setImmediate', 'clearImmediate', 'setInterval', 'clearInterval', 'Date']
     */
    toFake?: FakeMethod[] | undefined;

    /**
     * The maximum number of timers that will be run when calling runAll()
     * @default 10000
     */
    loopLimit?: number | undefined;

    /**
     * Tells @sinonjs/fake-timers to increment mocked time automatically based on the real system time shift (e.g. the mocked time will be incremented by
     * 20ms for every 20ms change in the real system time) (default: false)
     */
    shouldAdvanceTime?: boolean | undefined;

    /**
     * Relevant only when using with shouldAdvanceTime: true. increment mocked time by advanceTimeDelta ms every advanceTimeDelta ms change
     * in the real system time (default: 20)
     */
    advanceTimeDelta?: number | undefined;

    /**
     * Tells FakeTimers to clear 'native' (i.e. not fake) timers by delegating to their respective handlers.
     * @default true
     */
    shouldClearNativeTimers?: boolean | undefined;
}

/** @deprecated use `RunnerTestFile` instead */
declare type File_2 = RunnerTestFile;
export { File_2 as File }

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 FixtureItem extends FixtureOptions {
    prop: string;
    value: any;
    /**
     * Indicates whether the fixture is a function
     */
    isFn: boolean;
    /**
     * The dependencies(fixtures) of current fixture function.
     */
    deps?: FixtureItem[];
}

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>, ExtraContext = object> = {
    [K in keyof T]: Fixture<T, K, ExtraContext & ExtendedContext<RunnerTestCase>> | [Fixture<T, K, ExtraContext & ExtendedContext<RunnerTestCase>>, FixtureOptions?];
};

/**
 * the task function
 */
declare type Fn = () => any | Promise<any>;

declare function fn<T extends Procedure = Procedure>(implementation?: T): Mock<T>;

declare interface FnOptions {
    /**
     * An optional function that is run before iterations of this task begin
     */
    beforeAll?: (this: BenchTask) => void | Promise<void>;
    /**
     * An optional function that is run before each iteration of this task
     */
    beforeEach?: (this: BenchTask) => void | Promise<void>;
    /**
     * An optional function that is run after each iteration of this task
     */
    afterEach?: (this: BenchTask) => void | Promise<void>;
    /**
     * An optional function that is run after all iterations of this task end
     */
    afterAll?: (this: BenchTask) => void | Promise<void>;
}

declare interface Formatter {
    (input?: unknown): string;
    open: string;
    close: string;
}

declare function getDefaultColors(): Colors_2;

declare function getMatcherUtils(): {
    EXPECTED_COLOR: tinyrainbow.Formatter;
    RECEIVED_COLOR: tinyrainbow.Formatter;
    INVERTED_COLOR: tinyrainbow.Formatter;
    BOLD_WEIGHT: tinyrainbow.Formatter;
    DIM_COLOR: tinyrainbow.Formatter;
    diff: typeof diff;
    matcherHint: typeof matcherHint;
    printReceived: typeof printReceived;
    printExpected: typeof printExpected;
    printDiffOrStringify: typeof printDiffOrStringify;
};

export declare function getRunningMode(): "watch" | "run";

declare type Hook = (task: BenchTask, mode: 'warmup' | 'run') => void | Promise<void>;

/**
 * @deprecated
 */
export declare type HookCleanupCallback = unknown;

/**
 * @deprecated
 */
export declare type HookListener<T extends any[], Return = void> = (...args: T) => Awaitable_2<Return>;

declare type Indent = (arg0: string) => string;

/**
 * Allows inferring any constructor using the `infer` keyword.
 */
declare type InferConstructor<ConstructorType extends new (...args: any) => any> = ConstructorType;

/**
 * Allows inferring any function using the `infer` keyword.
 */
declare type InferFunctionType<FunctionType extends (...args: any) => any> = FunctionType;

/**
 * Gives access to injected context provided from the main thread.
 * This usually returns a value provided by `globalSetup` or an external library.
 */
export declare function inject<T extends keyof ProvidedContext & string>(key: T): ProvidedContext[T];

/**
 * @internal
 */
declare type Inverted<T> = {
    [inverted]: T;
};

/**
 * @internal
 */
declare const inverted: unique symbol;

/**
 * Checks if the given type is `any`.
 */
declare type IsAny<T> = [T] extends [Secret] ? Not<IsNever<T>> : false;

/**
 * Get a boolean indicates whether the task is running in the first time.
 * Could only be `false` in watch mode.
 *
 * Currently only works with `isolate: false`
 *
 * @experimental
 */
export declare function isFirstRun(): boolean;

/**
 * Checks if the given type is `never`.
 */
declare type IsNever<T> = [T] extends [never] ? true : false;

declare function isSupported(isTTY?: boolean): boolean;

/**
 * Determines if the given type is `unknown`.
 */
declare type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny<T>> : false;

/**
 * Same as {@linkcode IsUselessOverloadInfo}, but for constructors.
 */
declare type IsUselessConstructorOverloadInfo<FunctionType> = StrictEqualUsingTSInternalIdenticalToOperator<FunctionType, UnknownConstructor>;

/**
 * `true` iff {@linkcode FunctionType} is
 * equivalent to `(...args: unknown[]) => unknown`,
 * which is what an overload variant looks like for a non-existent overload.
 * This is useful because older versions of TypeScript end up with
 * 9 "useless" overloads and one real one for parameterless/generic functions.
 *
 * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related}
 */
declare type IsUselessOverloadInfo<FunctionType> = StrictEqualUsingTSInternalIdenticalToOperator<FunctionType, UnknownFunction>;

export declare function isWatchMode(): boolean;

/**
 * Defines a test case with a given name and test function. The test function can optionally be configured with test options.
 *
 * @param {string | Function} name - The name of the test or a function that will be used as a test name.
 * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
 * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
 * @throws {Error} If called inside another test function.
 * @example
 * ```ts
 * // Define a simple test
 * it('adds two numbers', () => {
 *   expect(add(1, 2)).toBe(3);
 * });
 * ```
 * @example
 * ```ts
 * // Define a test with options
 * it('subtracts two numbers', { retry: 3 }, () => {
 *   expect(subtract(5, 2)).toBe(3);
 * });
 * ```
 */
export declare const it: TestAPI;

export declare interface JestAssertion<T = any> extends jest.Matchers<void, T> {
    /**
     * 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;
    /**
     * 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 `precision` 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);
     */
    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();
     */
    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);
     */
    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;
    /**
     * Ensure that a mock function is called with specific arguments on an Nth call.
     *
     * Alias for `expect.toHaveBeenNthCalledWith`.
     *
     * @example
     * expect(mockFunc).nthCalledWith(2, 'secondArg');
     */
    nthCalledWith: <E extends any[]>(nthCall: 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;
    /**
     * If you have a mock function, you can use `.lastCalledWith`
     * to test what arguments it was last called with.
     *
     * Alias for `expect.toHaveBeenLastCalledWith`.
     *
     * @example
     * expect(mockFunc).lastCalledWith('lastArg');
     */
    lastCalledWith: <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);
     */
    toThrow: (expected?: string | Constructable_2 | RegExp | Error) => 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);
     */
    toThrowError: (expected?: string | Constructable_2 | RegExp | Error) => 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();
     */
    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);
     */
    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');
     */
    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 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.
     *
     * Alias for `expect.toHaveLastReturnedWith`.
     *
     * @example
     * expect(mockFunc).lastReturnedWith('lastValue');
     */
    lastReturnedWith: <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;
    /**
     * 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.
     *
     * Alias for `expect.toHaveNthReturnedWith`.
     *
     * @example
     * expect(mockFunc).nthReturnedWith(2, 'nthValue');
     */
    nthReturnedWith: <E>(nthCall: number, value: E) => void;
}

/**
 * Get the last element of a union.
 * First, converts to a union of `() => T` functions,
 * then uses {@linkcode UnionToIntersection} to get the last one.
 */
declare type LastOf<Union> = UnionToIntersection<Union extends any ? () => Union : never> extends () => infer R ? R : never;

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 type MatchersObject<T extends MatcherState = MatcherState> = Record<string, RawMatcherFn<T>>;

declare interface MatcherState {
    customTesters: Array<Tester>;
    assertionCalls: number;
    currentTestName?: string;
    dontThrow?: () => void;
    error?: Error;
    equals: (a: unknown, b: unknown, customTesters?: Array<Tester>, strictCheck?: boolean) => boolean;
    expand?: boolean;
    expectedAssertionsNumber?: number | null;
    expectedAssertionsNumberErrorGen?: (() => Error) | null;
    isExpectingAssertions?: boolean;
    isExpectingAssertionsError?: Error | null;
    isNot: boolean;
    promise: string;
    suppressedErrors: Array<Error>;
    testPath?: string;
    utils: ReturnType<typeof getMatcherUtils> & {
        diff: typeof diff;
        stringify: typeof stringify;
        iterableEquality: Tester;
        subsetEquality: Tester;
    };
    soft?: boolean;
    poll?: boolean;
}

declare type MaybeMocked<T> = T extends Procedure ? MockedFunction<T> : T extends object ? MockedObject<T> : T;

declare type MaybeMockedConstructor<T> = T extends new (...args: Array<any>) => infer R ? Mock<(...args: ConstructorParameters<T>) => R> : T;

declare type MaybeMockedDeep<T> = T extends Procedure ? MockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;

declare type MaybePartiallyMocked<T> = T extends Procedure ? PartiallyMockedFunction<T> : T extends object ? MockedObject<T> : T;

declare type MaybePartiallyMockedDeep<T> = T extends Procedure ? PartiallyMockedFunctionDeep<T> : T extends object ? MockedObjectDeep<T> : T;

declare type Methods<T> = keyof {
    [K in keyof T as T[K] extends Procedure ? K : never]: T[K];
};

/**
 * @internal
 */
declare type Mismatch = {
    [mismatch]: 'mismatch';
};

/**
 * @internal
 */
declare const mismatch: unique symbol;

/**
 * Represents the type of mismatched arguments between
 * the actual result and the expected result.
 *
 * If {@linkcode ActualResult} and {@linkcode ExpectedResult} are equivalent,
 * the type resolves to an empty tuple `[]`, indicating no mismatch.
 * If they are not equivalent, it resolves to a tuple containing the element
 * {@linkcode Mismatch}, signifying a discrepancy between
 * the expected and actual results.
 */
declare type MismatchArgs<ActualResult extends boolean, ExpectedResult extends boolean> = Eq<ActualResult, ExpectedResult> extends true ? [] : [Mismatch];

/**
 * Helper for showing end-user a hint why their type assertion is failing.
 * This swaps "leaf" types with a literal message about what the actual and
 * expected types are. Needs to check for `Not<IsAny<Actual>>` because
 * otherwise `LeafTypeOf<Actual>` returns `never`, which extends everything 🤔
 */
declare type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, Not<IsAny<Actual>>]> extends true ? And<[Extends<any[], Actual>, Extends<any[], Expected>]> extends true ? Array<MismatchInfo<Extract<Actual, any[]>[number], Extract<Expected, any[]>[number]>> : {
    [K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never>;
} : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `Expected: ${PrintType<Expected>}, Actual: ${PrintType<Exclude<Actual, Expected>>}`;

export declare interface Mock<T extends Procedure = Procedure> extends MockInstance<T> {
    new (...args: Parameters<T>): ReturnType<T>;
    (...args: Parameters<T>): ReturnType<T>;
}

export declare interface MockContext<T extends Procedure> {
    /**
     * This is an array containing all arguments for each call. One item of the array is the arguments of that call.
     *
     * @see https://vitest.dev/api/mock#mock-calls
     * @example
     * const fn = vi.fn()
     *
     * fn('arg1', 'arg2')
     * fn('arg3')
     *
     * fn.mock.calls === [
     *   ['arg1', 'arg2'], // first call
     *   ['arg3'], // second call
     * ]
     */
    calls: Parameters<T>[];
    /**
     * This is an array containing all instances that were instantiated when mock was called with a `new` keyword. Note that this is an actual context (`this`) of the function, not a return value.
     * @see https://vitest.dev/api/mock#mock-instances
     */
    instances: ReturnType<T>[];
    /**
     * An array of `this` values that were used during each call to the mock function.
     * @see https://vitest.dev/api/mock#mock-contexts
     */
    contexts: ThisParameterType<T>[];
    /**
     * The order of mock's execution. This returns an array of numbers which are shared between all defined mocks.
     *
     * @see https://vitest.dev/api/mock#mock-invocationcallorder
     * @example
     * const fn1 = vi.fn()
     * const fn2 = vi.fn()
     *
     * fn1()
     * fn2()
     * fn1()
     *
     * fn1.mock.invocationCallOrder === [1, 3]
     * fn2.mock.invocationCallOrder === [2]
     */
    invocationCallOrder: number[];
    /**
     * This is an array containing all values that were `returned` from the function.
     *
     * The `value` property contains the returned value or thrown error. If the function returned a `Promise`, then `result` will always be `'return'` even if the promise was rejected.
     *
     * @see https://vitest.dev/api/mock#mock-results
     * @example
     * const fn = vi.fn()
     *   .mockReturnValueOnce('result')
     *   .mockImplementationOnce(() => { throw new Error('thrown error') })
     *
     * const result = fn()
     *
     * try {
     *   fn()
     * }
     * catch {}
     *
     * fn.mock.results === [
     *   {
     *     type: 'return',
     *     value: 'result',
     *   },
     *   {
     *     type: 'throw',
     *     value: Error,
     *   },
     * ]
     */
    results: MockResult<ReturnType<T>>[];
    /**
     * An array containing all values that were `resolved` or `rejected` from the function.
     *
     * This array will be empty if the function was never resolved or rejected.
     *
     * @see https://vitest.dev/api/mock#mock-settledresults
     * @example
     * const fn = vi.fn().mockResolvedValueOnce('result')
     *
     * const result = fn()
     *
     * fn.mock.settledResults === []
     * fn.mock.results === [
     *   {
     *     type: 'return',
     *     value: Promise<'result'>,
     *   },
     * ]
     *
     * await result
     *
     * fn.mock.settledResults === [
     *   {
     *     type: 'fulfilled',
     *     value: 'result',
     *   },
     * ]
     */
    settledResults: MockSettledResult<Awaited<ReturnType<T>>>[];
    /**
     * This contains the arguments of the last call. If spy wasn't called, will return `undefined`.
     * @see https://vitest.dev/api/mock#mock-lastcall
     */
    lastCall: Parameters<T> | undefined;
}

export declare type Mocked<T> = {
    [P in keyof T]: T[P] extends Procedure ? MockInstance<T[P]> : T[P] extends Constructable_3 ? MockedClass<T[P]> : T[P];
} & T;

export declare type MockedClass<T extends Constructable_3> = MockInstance<(...args: ConstructorParameters<T>) => InstanceType<T>> & {
    prototype: T extends {
        prototype: any;
    } ? Mocked<T['prototype']> : never;
} & T;

export declare type MockedFunction<T extends Procedure> = Mock<T> & {
    [K in keyof T]: T[K];
};

declare type MockedFunctionDeep<T extends Procedure> = Mock<T> & MockedObjectDeep<T>;

export declare type MockedObject<T> = MaybeMockedConstructor<T> & {
    [K in Methods<T>]: T[K] extends Procedure ? MockedFunction<T[K]> : T[K];
} & {
    [K in Properties<T>]: T[K];
};

declare type MockedObjectDeep<T> = MaybeMockedConstructor<T> & {
    [K in Methods<T>]: T[K] extends Procedure ? MockedFunctionDeep<T[K]> : T[K];
} & {
    [K in Properties<T>]: MaybeMockedDeep<T[K]>;
};

declare type MockFactoryWithHelper<M = unknown> = (importOriginal: <T extends M = M>() => Promise<T>) => Promisable<Partial<M>>;

export declare interface MockInstance<T extends Procedure = Procedure> {
    /**
     * Use it to return the name assigned to the mock with the `.mockName(name)` method. By default, it will return `vi.fn()`.
     * @see https://vitest.dev/api/mock#getmockname
     */
    getMockName(): string;
    /**
     * Sets the internal mock name. This is useful for identifying the mock when an assertion fails.
     * @see https://vitest.dev/api/mock#mockname
     */
    mockName(name: string): this;
    /**
     * Current context of the mock. It stores information about all invocation calls, instances, and results.
     */
    mock: MockContext<T>;
    /**
     * Clears all information about every call. After calling it, all properties on `.mock` will return to their initial state. This method does not reset implementations. It is useful for cleaning up mocks between different assertions.
     *
     * To automatically call this method before each test, enable the [`clearMocks`](https://vitest.dev/config/#clearmocks) setting in the configuration.
     * @see https://vitest.dev/api/mock#mockclear
     */
    mockClear(): this;
    /**
     * Performs the same actions as `mockClear` and sets the inner implementation to an empty function (returning `undefined` when invoked). This also resets all "once" implementations. It is useful for completely resetting a mock to its default state.
     *
     * To automatically call this method before each test, enable the [`mockReset`](https://vitest.dev/config/#mockreset) setting in the configuration.
     * @see https://vitest.dev/api/mock#mockreset
     */
    mockReset(): this;
    /**
     * Does what `mockReset` does and restores inner implementation to the original function.
     *
     * Note that restoring mock from `vi.fn()` will set implementation to an empty function that returns `undefined`. Restoring a `vi.fn(impl)` will restore implementation to `impl`.
     * @see https://vitest.dev/api/mock#mockrestore
     */
    mockRestore(): void;
    /**
     * Performs the same actions as `mockReset` and restores the inner implementation to the original function.
     *
     * Note that restoring a mock created with `vi.fn()` will set the implementation to an empty function that returns `undefined`. Restoring a mock created with `vi.fn(impl)` will restore the implementation to `impl`.
     *
     * To automatically call this method before each test, enable the [`restoreMocks`](https://vitest.dev/config/#restoremocks) setting in the configuration.
     * @see https://vitest.dev/api/mock#getmockimplementation
     */
    getMockImplementation(): NormalizedPrecedure<T> | undefined;
    /**
     * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function.
     * @see https://vitest.dev/api/mock#mockimplementation
     * @example
     * const increment = vi.fn().mockImplementation(count => count + 1);
     * expect(increment(3)).toBe(4);
     */
    mockImplementation(fn: NormalizedPrecedure<T>): this;
    /**
     * Accepts a function to be used as the mock implementation. TypeScript expects the arguments and return type to match those of the original function. This method can be chained to produce different results for multiple function calls.
     *
     * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
     * @see https://vitest.dev/api/mock#mockimplementationonce
     * @example
     * const fn = vi.fn(count => count).mockImplementationOnce(count => count + 1);
     * expect(fn(3)).toBe(4);
     * expect(fn(3)).toBe(3);
     */
    mockImplementationOnce(fn: NormalizedPrecedure<T>): this;
    /**
     * Overrides the original mock implementation temporarily while the callback is being executed.
     *
     * Note that this method takes precedence over the [`mockImplementationOnce`](https://vitest.dev/api/mock#mockimplementationonce).
     * @see https://vitest.dev/api/mock#withimplementation
     * @example
     * const myMockFn = vi.fn(() => 'original')
     *
     * myMockFn.withImplementation(() => 'temp', () => {
     *   myMockFn() // 'temp'
     * })
     *
     * myMockFn() // 'original'
     */
    withImplementation<T2>(fn: NormalizedPrecedure<T>, cb: () => T2): T2 extends Promise<unknown> ? Promise<this> : this;
    /**
     * Use this if you need to return the `this` context from the method without invoking the actual implementation.
     * @see https://vitest.dev/api/mock#mockreturnthis
     */
    mockReturnThis(): this;
    /**
     * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
     * @see https://vitest.dev/api/mock#mockreturnvalue
     * @example
     * const mock = vi.fn()
     * mock.mockReturnValue(42)
     * mock() // 42
     * mock.mockReturnValue(43)
     * mock() // 43
     */
    mockReturnValue(value: ReturnType<T>): this;
    /**
     * Accepts a value that will be returned whenever the mock function is called. TypeScript will only accept values that match the return type of the original function.
     *
     * When the mocked function runs out of implementations, it will invoke the default implementation set with `vi.fn(() => defaultValue)` or `.mockImplementation(() => defaultValue)` if they were called.
     * @example
     * const myMockFn = vi
     *   .fn()
     *   .mockReturnValue('default')
     *   .mockReturnValueOnce('first call')
     *   .mockReturnValueOnce('second call')
     *
     * // 'first call', 'second call', 'default'
     * console.log(myMockFn(), myMockFn(), myMockFn())
     */
    mockReturnValueOnce(value: ReturnType<T>): this;
    /**
     * Accepts a value that will be resolved when the async function is called. TypeScript will only accept values that match the return type of the original function.
     * @example
     * const asyncMock = vi.fn().mockResolvedValue(42)
     * asyncMock() // Promise<42>
     */
    mockResolvedValue(value: Awaited<ReturnType<T>>): this;
    /**
     * Accepts a value that will be resolved during the next function call. TypeScript will only accept values that match the return type of the original function. If chained, each consecutive call will resolve the specified value.
     * @example
     * const myMockFn = vi
     *   .fn()
     *   .mockResolvedValue('default')
     *   .mockResolvedValueOnce('first call')
     *   .mockResolvedValueOnce('second call')
     *
     * // Promise<'first call'>, Promise<'second call'>, Promise<'default'>
     * console.log(myMockFn(), myMockFn(), myMockFn())
     */
    mockResolvedValueOnce(value: Awaited<ReturnType<T>>): this;
    /**
     * Accepts an error that will be rejected when async function is called.
     * @example
     * const asyncMock = vi.fn().mockRejectedValue(new Error('Async error'))
     * await asyncMock() // throws Error<'Async error'>
     */
    mockRejectedValue(error: unknown): this;
    /**
     * Accepts a value that will be rejected during the next function call. If chained, each consecutive call will reject the specified value.
     * @example
     * const asyncMock = vi
     *   .fn()
     *   .mockResolvedValueOnce('first call')
     *   .mockRejectedValueOnce(new Error('Async error'))
     *
     * await asyncMock() // first call
     * await asyncMock() // throws Error<'Async error'>
     */
    mockRejectedValueOnce(error: unknown): this;
}

declare interface MockOptions {
    spy?: boolean;
}

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;
}

/** @deprecated not used */
export declare interface ModuleCache {
    promise?: Promise<any>;
    exports?: any;
    code?: string;
}

export declare interface ModuleGraphData {
    graph: Record<string, string[]>;
    externalized: string[];
    inlined: string[];
}

/** @deprecated do not use, internal helper */
export declare type MutableArray<T extends readonly any[]> = MutableArray_2<T>;

declare type MutableArray_2<T extends readonly any[]> = {
    -readonly [k in keyof T]: T[k];
};

/**
 * Checks that {@linkcode Left} and {@linkcode Right} extend each other.
 * Not quite the same as an equality check since `any` can make it resolve
 * to `true`. So should only be used when {@linkcode Left} and
 * {@linkcode Right} are known to avoid `any`.
 */
declare type MutuallyExtends<Left, Right> = And<[Extends<Left, Right>, Extends<Right, Left>]>;

/**
 * Represents the negative expectation type for the {@linkcode Actual} type.
 */
declare interface NegativeExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
    positive: false;
}> {
    toEqualTypeOf: {
        /**
         * Uses TypeScript's internal technique to check for type "identicalness".
         *
         * It will check if the types are fully equal to each other.
         * It will not fail if two objects have different values, but the same type.
         * It will fail however if an object is missing a property.
         *
         * **_Unexpected failure_**? For a more permissive but less performant
         * check that accommodates for equivalent intersection types,
         * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}.
         * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
         *
         * @example
         * <caption>Using generic type argument syntax</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
         *
         * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
         * ```
         *
         * @example
         * <caption>Using inferred type syntax by passing a value</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
         *
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
         * ```
         *
         * @param value - The value to compare against the expected type.
         * @param MISMATCH - The mismatch arguments.
         * @returns `true`.
         */
        <Expected>(value: Expected & AValue, ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
        /**
         * Uses TypeScript's internal technique to check for type "identicalness".
         *
         * It will check if the types are fully equal to each other.
         * It will not fail if two objects have different values, but the same type.
         * It will fail however if an object is missing a property.
         *
         * **_Unexpected failure_**? For a more permissive but less performant
         * check that accommodates for equivalent intersection types,
         * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}.
         * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
         *
         * @example
         * <caption>Using generic type argument syntax</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
         *
         * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
         * ```
         *
         * @example
         * <caption>Using inferred type syntax by passing a value</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
         *
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
         * ```
         *
         * @param MISMATCH - The mismatch arguments.
         * @returns `true`.
         */
        <Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true;
    };
    toMatchTypeOf: {
        /**
         * A less strict version of
         * {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()}
         * that allows for extra properties.
         * This is roughly equivalent to an `extends` constraint
         * in a function type argument.
         *
         * @example
         * <caption>Using generic type argument syntax</caption>
         * ```ts
         * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
         * ```
         *
         * @example
         * <caption>Using inferred type syntax by passing a value</caption>
         * ```ts
         * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
         * ```
         *
         * @param value - The value to compare against the expected type.
         * @param MISMATCH - The mismatch arguments.
         * @returns `true`.
         */
        <Expected>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
        ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
        /**
         * A less strict version of
         * {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()}
         * that allows for extra properties.
         * This is roughly equivalent to an `extends` constraint
         * in a function type argument.
         *
         * @example
         * <caption>Using generic type argument syntax</caption>
         * ```ts
         * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
         * ```
         *
         * @example
         * <caption>Using inferred type syntax by passing a value</caption>
         * ```ts
         * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
         * ```
         *
         * @param MISMATCH - The mismatch arguments.
         * @returns `true`.
         */
        <Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true;
    };
    /**
     * Checks whether an object has a given property.
     *
     * @example
     * <caption>check that properties exist</caption>
     * ```ts
     * const obj = { a: 1, b: '' }
     *
     * expectTypeOf(obj).toHaveProperty('a')
     *
     * expectTypeOf(obj).not.toHaveProperty('c')
     * ```
     *
     * @param key - The property key to check for.
     * @param MISMATCH - The mismatch arguments.
     * @returns `true`.
     */
    toHaveProperty: <KeyType extends string | number | symbol>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, false>) => true;
}

declare interface NewPlugin {
    serialize: (val: any, config: Config, indentation: string, depth: number, refs: Refs, printer: Printer) => string;
    test: Test_2;
}

declare type NoopEventListener = () => any | Promise<any>;

declare type NormalizedPrecedure<T extends Procedure> = (...args: Parameters<T>) => ReturnType<T>;

/**
 * Negates a boolean type.
 */
declare type Not<T extends boolean> = T extends true ? false : true;

/** @deprecated do not use, internal helper */
export declare type Nullable<T> = Nullable_2<T>;

declare type Nullable_2<T> = T | null | undefined;

/**
 * Calculates the number of overloads for a given function type.
 */
declare type NumOverloads<FunctionType> = UnionToTuple<OverloadsInfoUnion<FunctionType>>['length'];

declare interface OldPlugin {
    print: (val: unknown, print: Print, indent: Indent, options: PluginOptions, colors: Colors) => string;
    test: Test_2;
}

/**
 * Registers a callback function to be executed when a test fails within the current suite.
 * This function allows for custom actions to be performed in response to test failures, such as logging, cleanup, or additional diagnostics.
 *
 * **Note:** The `onTestFailed` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
 *
 * @param {Function} fn - The callback function to be executed upon a test failure. The function receives the test result (including errors).
 * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
 * @throws {Error} Throws an error if the function is not called within a test.
 * @returns {void}
 * @example
 * ```ts
 * // Example of using onTestFailed to log failure details
 * onTestFailed(({ errors }) => {
 *   console.log(`Test failed: ${test.name}`, errors);
 * });
 * ```
 */
export declare const onTestFailed: TaskHook<OnTestFailedHandler>;

export declare type OnTestFailedHandler = (result: RunnerTaskResult) => Awaitable_2<void>;

/**
 * Registers a callback function to be executed when the current test finishes, regardless of the outcome (pass or fail).
 * This function is ideal for performing actions that should occur after every test execution, such as cleanup, logging, or resetting shared resources.
 *
 * This hook is useful if you have access to a resource in the test itself and you want to clean it up after the test finishes. It is a more compact way to clean up resources than using the combination of `beforeEach` and `afterEach`.
 *
 * **Note:** The `onTestFinished` hooks are running in reverse order of their registration. You can configure this by changing the `sequence.hooks` option in the config file.
 *
 * @param {Function} fn - The callback function to be executed after a test finishes. The function can receive parameters providing details about the completed test, including its success or failure status.
 * @param {number} [timeout] - Optional timeout in milliseconds for the hook. If not provided, the default hook timeout from the runner's configuration is used.
 * @throws {Error} Throws an error if the function is not called within a test.
 * @returns {void}
 * @example
 * ```ts
 * // Example of using onTestFinished for cleanup
 * const db = await connectToDatabase();
 * onTestFinished(async () => {
 *   await db.disconnect();
 * });
 * ```
 */
export declare const onTestFinished: TaskHook<OnTestFinishedHandler>;

export declare type OnTestFinishedHandler = (result: RunnerTaskResult) => Awaitable_2<void>;

/**
 * Gets the keys of an object type that are optional.
 */
declare type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;

declare type OptionsReceived = PrettyFormatOptions;

/**
 * A union type of the parameters allowed for any
 * overload of function {@linkcode FunctionType}.
 */
declare type OverloadParameters<FunctionType> = OverloadsInfoUnion<FunctionType> extends InferFunctionType<infer Fn> ? Parameters<Fn> : never;

/**
 * A union type of the return types for any overload of
 * function {@linkcode FunctionType}.
 */
declare type OverloadReturnTypes<FunctionType> = OverloadsInfoUnion<FunctionType> extends InferFunctionType<infer Fn> ? ReturnType<Fn> : never;

/**
 * Get a union of overload variants for a function {@linkcode FunctionType}.
 * Does a check for whether we can do the one-shot
 * 10-overload matcher (which works for ts\>5.3), and if not,
 * falls back to the more complicated utility.
 */
declare type OverloadsInfoUnion<FunctionType> = IsNever<TSPost53OverloadsInfoUnion<(a: 1) => 2>> extends true ? TSPre53OverloadsInfoUnion<FunctionType> : TSPost53OverloadsInfoUnion<FunctionType>;

/**
 * Creates a new overload (an intersection type) from an existing one,
 * which only includes variant(s) which can accept
 * {@linkcode Args} as parameters.
 */
declare type OverloadsNarrowedByParameters<FunctionType, Args extends OverloadParameters<FunctionType>> = UnionToIntersection<SelectOverloadsInfo<OverloadsInfoUnion<FunctionType>, Args>>;

export declare interface ParsedStack {
    method: string;
    file: string;
    line: number;
    column: number;
}

declare interface ParsedStack_2 {
    method: string;
    file: string;
    line: number;
    column: number;
}

declare type PartiallyMockedFunction<T extends Procedure> = PartialMock<T> & {
    [K in keyof T]: T[K];
};

declare type PartiallyMockedFunctionDeep<T extends Procedure> = PartialMock<T> & MockedObjectDeep<T>;

declare type PartialMaybePromise<T> = T extends Promise<Awaited<T>> ? Promise<Partial<Awaited<T>>> : Partial<T>;

declare interface PartialMock<T extends Procedure = Procedure> extends MockInstance<(...args: Parameters<T>) => PartialMaybePromise<ReturnType<T>>> {
    new (...args: Parameters<T>): ReturnType<T>;
    (...args: Parameters<T>): ReturnType<T>;
}

declare type Plugin_2 = NewPlugin | OldPlugin;

declare interface PluginOptions {
    edgeSpacing: string;
    min: boolean;
    spacing: string;
}

declare type Plugins = Array<Plugin_2>;

/**
 * Represents the positive assertion methods available for type checking in the
 * {@linkcode expectTypeOf()} utility.
 */
declare interface PositiveExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, {
    positive: true;
    branded: false;
}> {
    toEqualTypeOf: {
        /**
         * Uses TypeScript's internal technique to check for type "identicalness".
         *
         * It will check if the types are fully equal to each other.
         * It will not fail if two objects have different values, but the same type.
         * It will fail however if an object is missing a property.
         *
         * **_Unexpected failure_**? For a more permissive but less performant
         * check that accommodates for equivalent intersection types,
         * use {@linkcode branded | .branded.toEqualTypeOf()}.
         * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
         *
         * @example
         * <caption>Using generic type argument syntax</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
         *
         * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
         * ```
         *
         * @example
         * <caption>Using inferred type syntax by passing a value</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
         *
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
         * ```
         *
         * @param value - The value to compare against the expected type.
         * @param MISMATCH - The mismatch arguments.
         * @returns `true`.
         */
        <Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
        ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
        /**
         * Uses TypeScript's internal technique to check for type "identicalness".
         *
         * It will check if the types are fully equal to each other.
         * It will not fail if two objects have different values, but the same type.
         * It will fail however if an object is missing a property.
         *
         * **_Unexpected failure_**? For a more permissive but less performant
         * check that accommodates for equivalent intersection types,
         * use {@linkcode branded | .branded.toEqualTypeOf()}.
         * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
         *
         * @example
         * <caption>Using generic type argument syntax</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
         *
         * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
         * ```
         *
         * @example
         * <caption>Using inferred type syntax by passing a value</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
         *
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
         * ```
         *
         * @param MISMATCH - The mismatch arguments.
         * @returns `true`.
         */
        <Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true;
    };
    toMatchTypeOf: {
        /**
         * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()}
         * that allows for extra properties.
         * This is roughly equivalent to an `extends` constraint
         * in a function type argument.
         *
         * @example
         * <caption>Using generic type argument syntax</caption>
         * ```ts
         * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
         * ```
         *
         * @example
         * <caption>Using inferred type syntax by passing a value</caption>
         * ```ts
         * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
         * ```
         *
         * @param value - The value to compare against the expected type.
         * @param MISMATCH - The mismatch arguments.
         * @returns `true`.
         */
        <Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`.
        ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
        /**
         * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()}
         * that allows for extra properties.
         * This is roughly equivalent to an `extends` constraint
         * in a function type argument.
         *
         * @example
         * <caption>Using generic type argument syntax</caption>
         * ```ts
         * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>()
         * ```
         *
         * @example
         * <caption>Using inferred type syntax by passing a value</caption>
         * ```ts
         * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 })
         * ```
         *
         * @param MISMATCH - The mismatch arguments.
         * @returns `true`.
         */
        <Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true;
    };
    /**
     * Checks whether an object has a given property.
     *
     * @example
     * <caption>check that properties exist</caption>
     * ```ts
     * const obj = { a: 1, b: '' }
     *
     * expectTypeOf(obj).toHaveProperty('a')
     *
     * expectTypeOf(obj).not.toHaveProperty('c')
     * ```
     *
     * @param key - The property key to check for.
     * @param MISMATCH - The mismatch arguments.
     * @returns `true`.
     */
    toHaveProperty: <KeyType extends keyof Actual>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, true>) => KeyType extends keyof Actual ? PositiveExpectTypeOf<Actual[KeyType]> : true;
    /**
     * Inverts the result of the following assertions.
     *
     * @example
     * ```ts
     * expectTypeOf({ a: 1 }).not.toMatchTypeOf({ b: 1 })
     * ```
     */
    not: NegativeExpectTypeOf<Actual>;
    /**
     * Intersection types can cause issues with
     * {@linkcode toEqualTypeOf | .toEqualTypeOf()}:
     * ```ts
     * // ❌ The following line doesn't compile, even though the types are arguably the same.
     * expectTypeOf<{ a: 1 } & { b: 2 }>().toEqualTypeOf<{ a: 1; b: 2 }>()
     * ```
     * This helper works around this problem by using
     * a more permissive but less performant check.
     *
     * __Note__: This comes at a performance cost, and can cause the compiler
     * to 'give up' if used with excessively deep types, so use sparingly.
     *
     * @see {@link https://github.com/mmkal/expect-type/pull/21 | Reference}
     */
    branded: {
        /**
         * Uses TypeScript's internal technique to check for type "identicalness".
         *
         * It will check if the types are fully equal to each other.
         * It will not fail if two objects have different values, but the same type.
         * It will fail however if an object is missing a property.
         *
         * **_Unexpected failure_**? For a more permissive but less performant
         * check that accommodates for equivalent intersection types,
         * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}.
         * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}.
         *
         * @example
         * <caption>Using generic type argument syntax</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>()
         *
         * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>()
         * ```
         *
         * @example
         * <caption>Using inferred type syntax by passing a value</caption>
         * ```ts
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 })
         *
         * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 })
         * ```
         *
         * @param MISMATCH - The mismatch arguments.
         * @returns `true`.
         */
        toEqualTypeOf: <Expected extends StrictEqualUsingBranding<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingBranding<Actual, Expected>, true>) => true;
    };
}

declare interface PrettyFormatOptions {
    callToJSON?: boolean;
    escapeRegex?: boolean;
    escapeString?: boolean;
    highlight?: boolean;
    indent?: number;
    maxDepth?: number;
    maxWidth?: number;
    min?: boolean;
    printBasicPrototype?: boolean;
    printFunctionName?: boolean;
    compareKeys?: CompareKeys;
    plugins?: Plugins;
}

declare type Print = (arg0: unknown) => string;

declare function printDiffOrStringify(expected: unknown, received: unknown, options?: DiffOptions): 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;

/**
 * Determines the printable type representation for a given type.
 */
declare type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever<T> extends true ? 'never' : IsAny<T> extends true ? never : boolean extends T ? 'boolean' : T extends boolean ? `literal boolean: ${T}` : string extends T ? 'string' : T extends string ? `literal string: ${T}` : number extends T ? 'number' : T extends number ? `literal number: ${T}` : bigint extends T ? 'bigint' : T extends bigint ? `literal bigint: ${T}` : T extends null ? 'null' : T extends undefined ? 'undefined' : T extends (...args: any[]) => any ? 'function' : '...';

declare type Procedure = (...args: any[]) => any;

declare type Promisable<T> = T | Promise<T>;

declare type Promisify<O> = {
    [K in keyof O]: O[K] extends (...args: infer A) => infer R ? O extends R ? Promisify<O[K]> : (...args: A) => Promise<R> : O[K];
};

declare type PromisifyAssertion<T> = Promisify<Assertion<T>>;

declare type PromisifyFn<T> = ReturnType_2<T> extends Promise<any> ? T : (...args: ArgumentsType_3<T>) => Promise<Awaited<ReturnType_2<T>>>;

declare type Properties<T> = {
    [K in keyof T]: T[K] extends Procedure ? never : K;
}[keyof T] & (string | symbol);

export declare interface ProvidedContext {
}

declare interface RawMatcherFn<T extends MatcherState = MatcherState> {
    (this: T, received: any, ...expected: Array<any>): ExpectationResult;
}

declare interface RawSnapshotInfo {
    file: string;
    readonly?: boolean;
    content?: string;
}

/**
 * Determines if two types, are equivalent in a `readonly` manner.
 *
 * @internal
 */
declare type ReadonlyEquivalent<X, Y> = Extends<(<T>() => T extends X ? true : false), (<T>() => T extends Y ? true : false)>;

/**
 * Extracts the keys from a type that are not `readonly`.
 */
declare type ReadonlyKeys<T> = Extract<{
    [K in keyof T]-?: ReadonlyEquivalent<{
        [_K in K]: T[K];
    }, {
        -readonly [_K in K]: T[K];
    }> extends true ? never : K;
}[keyof T], keyof T>;

declare type Refs = Array<unknown>;

declare type RemoveEventListenerOptionsArgument = Parameters<typeof EventTarget.prototype.removeEventListener>[2];

/**
 * Extracts the keys from a type that are required (not optional).
 */
declare type RequiredKeys<T> = Extract<{
    [K in keyof T]-?: {} extends Pick<T, K> ? never : K;
}[keyof T], keyof T>;

/** @deprecated do not use it */
export declare type ResolvedTestEnvironment = ResolvedTestEnvironment_2;

declare interface ResolvedTestEnvironment_2 {
    environment: Environment;
    options: Record<string, any> | null;
}

declare type ReturnType_2<T> = T extends (...args: any) => infer R ? R : never;

export declare type RunMode = 'run' | 'skip' | 'only' | 'todo';

export declare interface RunnerCustomCase<ExtraContext = object> extends TaskPopulated {
    type: 'custom';
    /**
     * Task context that will be passed to the test function.
     */
    context: TaskContext<RunnerCustomCase> & ExtraContext & TestContext;
}

export declare interface RunnerRPC {
    onCancel: (reason: CancelReason) => void;
}

export declare type RunnerTask = RunnerTestCase | RunnerTestSuite | RunnerCustomCase | RunnerTestFile;

export declare interface RunnerTaskBase {
    /**
     * Unique task identifier. Based on the file id and the position of the task.
     * The id of the file task is based on the file path relative to root and project name.
     * It will not change between runs.
     * @example `1201091390`, `1201091390_0`, `1201091390_0_1`
     */
    id: string;
    /**
     * Task name provided by the user. If no name was provided, it will be an empty string.
     */
    name: string;
    /**
     * Task mode.
     * - **skip**: task is skipped
     * - **only**: only this task and other tasks with `only` mode will run
     * - **todo**: task is marked as a todo, alias for `skip`
     * - **run**: task will run or already ran
     */
    mode: RunMode;
    /**
     * Custom metadata for the task. JSON reporter will save this data.
     */
    meta: TaskMeta;
    /**
     * Whether the task was produced with `.each()` method.
     */
    each?: boolean;
    /**
     * Whether the task should run concurrently with other tasks.
     */
    concurrent?: boolean;
    /**
     * Whether the tasks of the suite run in a random order.
     */
    shuffle?: boolean;
    /**
     * Suite that this task is part of. File task or the global suite will have no parent.
     */
    suite?: RunnerTestSuite;
    /**
     * Result of the task. Suite and file tasks will only have the result if there
     * was an error during collection or inside `afterAll`/`beforeAll`.
     */
    result?: RunnerTaskResult;
    /**
     * The amount of times the task should be retried if it fails.
     * @default 0
     */
    retry?: number;
    /**
     * The amount of times the task should be repeated after the successful run.
     * If the task fails, it will not be retried unless `retry` is specified.
     * @default 0
     */
    repeats?: number;
    /**
     * Location of the task in the file. This field is populated only if
     * `includeTaskLocation` option is set. It is generated by calling `new Error`
     * and parsing the stack trace, so the location might differ depending on the runtime.
     */
    location?: {
        line: number;
        column: number;
    };
}

/**
 * The result of calling a task.
 */
export declare interface RunnerTaskResult {
    /**
     * 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.
     */
    errors?: ErrorWithDiff[];
    /**
     * How long in milliseconds the task took to run.
     */
    duration?: number;
    /**
     * Time in milliseconds when the task started running.
     */
    startTime?: number;
    /**
     * Heap size in bytes after the task finished.
     * Only available if `logHeapUsage` option is set and `process.memoryUsage` is defined.
     */
    heap?: number;
    /**
     * State of related to this task hooks. Useful during reporting.
     */
    hooks?: Partial<Record<keyof SuiteHooks_2, TaskState>>;
    /**
     * The amount of times the task was retried. The task is retried only if it
     * failed and `retry` option is set.
     */
    retryCount?: number;
    /**
     * The amount of times the task was repeated. The task is repeated only if
     * `repeats` option is set. This number also contains `retryCount`.
     */
    repeatCount?: number;
}

/**
 * The tuple representing a single task update.
 * Usually reported after the task finishes.
 */
export declare type RunnerTaskResultPack = [
/**
 * Unique task identifier from `task.id`.
 */
id: string,
/**
 * The result of running the task from `task.result`.
 */
result: RunnerTaskResult | undefined,
/**
 * Custom metadata from `task.meta`.
 */
meta: TaskMeta
];

export declare interface RunnerTestCase<ExtraContext = object> extends TaskPopulated {
    type: 'test';
    /**
     * Test context that will be passed to the test function.
     */
    context: TaskContext<RunnerTestCase> & ExtraContext & TestContext;
}

export declare interface RunnerTestFile extends RunnerTestSuite {
    /**
     * The name of the pool that the file belongs to.
     * @default 'forks'
     */
    pool?: string;
    /**
     * The path to the file in UNIX format.
     */
    filepath: string;
    /**
     * The name of the workspace project the file belongs to.
     */
    projectName: string | undefined;
    /**
     * The time it took to collect all tests in the file.
     * This time also includes importing all the file dependencies.
     */
    collectDuration?: number;
    /**
     * The time it took to import the setup file.
     */
    setupDuration?: number;
    /**
     * Whether the file is initiated without running any tests.
     * This is done to populate state on the server side by Vitest.
     */
    local?: boolean;
}

export declare interface RunnerTestSuite extends RunnerTaskBase {
    type: 'suite';
    /**
     * File task. It's the root task of the file.
     */
    file: RunnerTestFile;
    /**
     * An array of tasks that are part of the suite.
     */
    tasks: RunnerTask[];
}

/**
 * This utils allows computational intensive tasks to only be ran once
 * across test reruns to improve the watch mode performance.
 *
 * Currently only works with `poolOptions.<pool>.isolate: false`
 *
 * @experimental
 */
export declare function runOnce<T>(fn: () => T, key?: string): T;

export declare type RuntimeConfig = Pick<SerializedConfig, 'allowOnly' | 'testTimeout' | 'hookTimeout' | 'clearMocks' | 'mockReset' | 'restoreMocks' | 'fakeTimers' | 'maxConcurrency' | 'expect' | 'printConsoleTrace'> & {
    sequence?: {
        hooks?: SequenceHooks;
    };
};

/** @deprecated internal type, don't use it */
export declare type RuntimeContext = RuntimeContext_2;

declare interface RuntimeContext_2 {
    tasks: (SuiteCollector | RunnerTestCase)[];
    currentSuite: SuiteCollector | null;
}

declare type RuntimeOptions = Partial<RuntimeConfig>;

export declare interface RuntimeRPC {
    fetch: (id: string, transformMode: TransformMode) => Promise<{
        externalize?: string;
        id?: string;
    }>;
    transform: (id: string, transformMode: TransformMode) => Promise<{
        code?: string;
    }>;
    resolveId: (id: string, importer: string | undefined, transformMode: TransformMode) => Promise<{
        external?: boolean | 'absolute' | 'relative';
        id: string;
        /** @deprecated */
        meta?: Record<string, any> | null;
        /** @deprecated */
        moduleSideEffects?: boolean | 'no-treeshake' | null;
        /** @deprecated */
        syntheticNamedExports?: boolean | string | null;
    } | null>;
    /**
     * @deprecated unused
     */
    getSourceMap: (id: string, force?: boolean) => Promise<any>;
    onFinished: (files: RunnerTestFile[], errors?: unknown[]) => void;
    onPathsCollected: (paths: string[]) => void;
    onUserConsoleLog: (log: UserConsoleLog) => void;
    onUnhandledError: (err: unknown, type: string) => void;
    onCollected: (files: RunnerTestFile[]) => Promise<void>;
    onAfterSuiteRun: (meta: AfterSuiteRunMeta) => void;
    onTaskUpdate: (pack: RunnerTaskResultPack[]) => Promise<void>;
    onCancel: (reason: CancelReason) => void;
    getCountOfFailedTests: () => number;
    snapshotSaved: (snapshot: SnapshotResult) => void;
    resolveSnapshotPath: (testPath: string) => string;
}

/**
 * Checks if the result of an expecter matches the specified options, and
 * resolves to a fairly readable error message if not.
 */
declare type Scolder<Expecter extends {
    result: boolean;
}, Options extends {
    positive: boolean;
}> = Expecter['result'] extends Options['positive'] ? () => true : Options['positive'] extends true ? Expecter : Inverted<Expecter>;

/**
 * @internal
 */
declare type Secret = typeof secret;

/**
 * @internal
 */
declare const secret: unique symbol;

/**
 * Takes an overload variants {@linkcode Union},
 * produced from {@linkcode OverloadsInfoUnion} and rejects
 * the ones incompatible with parameters {@linkcode Args}.
 */
declare type SelectOverloadsInfo<Union extends UnknownFunction, Args extends unknown[]> = Union extends InferFunctionType<infer Fn> ? (Args extends Parameters<Fn> ? Fn : never) : never;

declare type SequenceHooks = 'stack' | 'list' | 'parallel';

declare type SequenceSetupFiles = 'list' | 'parallel';

/** @deprecated use `SerializedTestSpecification` instead */
export declare type SerializableSpec = SerializedTestSpecification;

/**
 * Config that tests have access to.
 */
export declare interface SerializedConfig {
    name: string | undefined;
    globals: boolean;
    base: string | undefined;
    snapshotEnvironment?: string;
    disableConsoleIntercept: boolean | undefined;
    runner: string | undefined;
    isolate: boolean;
    mode: 'test' | 'benchmark';
    bail: number | undefined;
    environmentOptions?: Record<string, any>;
    root: string;
    setupFiles: string[];
    passWithNoTests: boolean;
    testNamePattern: RegExp | undefined;
    allowOnly: boolean;
    testTimeout: number;
    hookTimeout: number;
    clearMocks: boolean;
    mockReset: boolean;
    restoreMocks: boolean;
    unstubGlobals: boolean;
    unstubEnvs: boolean;
    fakeTimers: FakeTimerInstallOpts;
    maxConcurrency: number;
    defines: Record<string, any>;
    expect: {
        requireAssertions?: boolean;
        poll?: {
            timeout?: number;
            interval?: number;
        };
    };
    printConsoleTrace: boolean | undefined;
    sequence: {
        shuffle?: boolean;
        concurrent?: boolean;
        seed: number;
        hooks: SequenceHooks;
        setupFiles: SequenceSetupFiles;
    };
    poolOptions: {
        forks: {
            singleFork: boolean;
            isolate: boolean;
        };
        threads: {
            singleThread: boolean;
            isolate: boolean;
        };
        vmThreads: {
            singleThread: boolean;
        };
        vmForks: {
            singleFork: boolean;
        };
    };
    deps: {
        web: {
            transformAssets?: boolean;
            transformCss?: boolean;
            transformGlobPattern?: RegExp | RegExp[];
        };
        optimizer: {
            web: {
                enabled: boolean;
            };
            ssr: {
                enabled: boolean;
            };
        };
        interopDefault: boolean | undefined;
        moduleDirectories: string[] | undefined;
    };
    snapshotOptions: {
        updateSnapshot: SnapshotUpdateState;
        expand: boolean | undefined;
        snapshotFormat: PrettyFormatOptions | undefined;
        /**
         * only exists for tests, not available in the main process
         */
        snapshotEnvironment: SnapshotEnvironment;
    };
    pool: string;
    snapshotSerializers: string[];
    chaiConfig: {
        includeStack?: boolean;
        showDiff?: boolean;
        truncateThreshold?: number;
    } | undefined;
    diff: string | undefined;
    retry: number;
    includeTaskLocation: boolean | undefined;
    inspect: boolean | string | undefined;
    inspectBrk: boolean | string | undefined;
    inspector: {
        enabled?: boolean;
        port?: number;
        host?: string;
        waitForDebugger?: boolean;
    };
    watch: boolean;
    env: Record<string, any>;
    browser: {
        name: string;
        headless: boolean;
        isolate: boolean;
        fileParallelism: boolean;
        ui: boolean;
        viewport: {
            width: number;
            height: number;
        };
        locators: {
            testIdAttribute: string;
        };
        screenshotFailures: boolean;
    };
    standalone: boolean;
    logHeapUsage: boolean | undefined;
    coverage: SerializedCoverageConfig;
    benchmark?: {
        includeSamples: boolean;
    };
}

export declare interface SerializedCoverageConfig {
    provider: 'istanbul' | 'v8' | 'custom' | undefined;
    reportsDirectory: string;
    htmlReporter: {
        subdir: string | undefined;
    } | undefined;
    enabled: boolean;
    customProviderModule: string | undefined;
}

export declare interface SerializedError {
    message: string;
    stack?: string;
    name?: string;
    stacks?: ParsedStack[];
    cause?: SerializedError;
    [key: string]: unknown;
}

export declare type SerializedTestSpecification = [
project: {
    name: string | undefined;
    root: string;
},
file: string,
options: {
    pool: string;
}
];

export { should }

export declare type SnapshotData = Record<string, string>;

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_2) => ParsedStack_2;
}

export declare interface SnapshotMatchOptions {
    testName: string;
    received: unknown;
    key?: string;
    inlineSnapshot?: string;
    isInline: boolean;
    error?: Error;
    rawSnapshot?: RawSnapshotInfo;
}

export declare interface SnapshotResult {
    filepath: string;
    added: number;
    fileDeleted: boolean;
    matched: number;
    unchecked: number;
    uncheckedKeys: Array<string>;
    unmatched: number;
    updated: number;
}

export declare type SnapshotSerializer = Plugin_2;

export declare interface SnapshotStateOptions {
    updateSnapshot: SnapshotUpdateState;
    snapshotEnvironment: SnapshotEnvironment;
    expand?: boolean;
    snapshotFormat?: OptionsReceived;
    resolveSnapshotPath?: (path: string, extension: string) => string;
}

export 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;
}

export declare type SnapshotUpdateState = 'all' | 'new' | 'none';

declare interface SourceMap {
    file: string;
    mappings: string;
    names: string[];
    sources: string[];
    sourcesContent?: string[];
    version: number;
    toString: () => string;
    toUrl: () => string;
}

declare function spyOn<T, S extends Properties<Required<T>>>(obj: T, methodName: S, accessType: 'get'): MockInstance<() => T[S]>;

declare function spyOn<T, G extends Properties<Required<T>>>(obj: T, methodName: G, accessType: 'set'): MockInstance<(arg: T[G]) => void>;

declare function spyOn<T, M extends Classes<Required<T>> | Methods<Required<T>>>(obj: T, methodName: M): Required<T>[M] extends {
    new (...args: infer A): infer R;
} ? MockInstance<(this: R, ...args: A) => R> : T[M] extends Procedure ? MockInstance<T[M]> : never;

/**
 * Checks if two types are strictly equal using branding.
 */
declare type StrictEqualUsingBranding<Left, Right> = MutuallyExtends<DeepBrand<Left>, DeepBrand<Right>>;

/**
 * Checks if two types are strictly equal using
 * the TypeScript internal identical-to operator.
 *
 * @see {@link https://github.com/microsoft/TypeScript/issues/55188#issuecomment-1656328122 | much history}
 */
declare type StrictEqualUsingTSInternalIdenticalToOperator<L, R> = (<T>() => T extends (L & T) | T ? true : false) extends <T>() => T extends (R & T) | T ? true : false ? IsNever<L> extends IsNever<R> ? true : false : false;

declare function stringify(object: unknown, maxDepth?: number, { maxLength, ...options }?: StringifyOptions): string;

declare interface StringifyOptions extends PrettyFormatOptions {
    maxLength?: number;
}

/** @deprecated use `RunnerTestSuite` instead */
export declare type Suite = RunnerTestSuite;

/**
 * Creates a suite of tests, allowing for grouping and hierarchical organization of tests.
 * Suites can contain both tests and other suites, enabling complex test structures.
 *
 * @param {string} name - The name of the suite, used for identification and reporting.
 * @param {Function} fn - A function that defines the tests and suites within this suite.
 * @example
 * ```ts
 * // Define a suite with two tests
 * suite('Math operations', () => {
 *   test('should add two numbers', () => {
 *     expect(add(1, 2)).toBe(3);
 *   });
 *
 *   test('should subtract two numbers', () => {
 *     expect(subtract(5, 2)).toBe(3);
 *   });
 * });
 * ```
 * @example
 * ```ts
 * // Define nested suites
 * suite('String operations', () => {
 *   suite('Trimming', () => {
 *     test('should trim whitespace from start and end', () => {
 *       expect('  hello  '.trim()).toBe('hello');
 *     });
 *   });
 *
 *   suite('Concatenation', () => {
 *     test('should concatenate two strings', () => {
 *       expect('hello' + ' ' + 'world').toBe('hello world');
 *     });
 *   });
 * });
 * ```
 */
export declare const suite: SuiteAPI;

export declare type SuiteAPI<ExtraContext = object> = ChainableSuiteAPI<ExtraContext> & {
    skipIf: (condition: any) => ChainableSuiteAPI<ExtraContext>;
    runIf: (condition: any) => ChainableSuiteAPI<ExtraContext>;
};

export declare interface SuiteCollector<ExtraContext = object> {
    readonly name: string;
    readonly mode: RunMode;
    options?: TestOptions;
    type: 'collector';
    test: TestAPI<ExtraContext>;
    tasks: (RunnerTestSuite | RunnerCustomCase<ExtraContext> | RunnerTestCase<ExtraContext> | SuiteCollector<ExtraContext>)[];
    task: (name: string, options?: TaskCustomOptions) => RunnerCustomCase<ExtraContext>;
    collect: (file: RunnerTestFile) => Promise<RunnerTestSuite>;
    clear: () => void;
    on: <T extends keyof SuiteHooks_2<ExtraContext>>(name: T, ...fn: SuiteHooks_2<ExtraContext>[T]) => void;
}

declare interface SuiteCollectorCallable<ExtraContext = object> {
    /**
     * @deprecated Use options as the second argument instead
     */
    <OverrideExtraContext extends ExtraContext = ExtraContext>(name: string | Function, fn: SuiteFactory<OverrideExtraContext>, options: TestOptions): SuiteCollector<OverrideExtraContext>;
    <OverrideExtraContext extends ExtraContext = ExtraContext>(name: string | Function, fn?: SuiteFactory<OverrideExtraContext>, options?: number | TestOptions): SuiteCollector<OverrideExtraContext>;
    <OverrideExtraContext extends ExtraContext = ExtraContext>(name: string | Function, options: TestOptions, fn?: SuiteFactory<OverrideExtraContext>): SuiteCollector<OverrideExtraContext>;
}

export declare type SuiteFactory<ExtraContext = object> = (test: TestAPI<ExtraContext>) => Awaitable_2<void>;

/** @deprecated internal type, don't use it */
export declare type SuiteHooks = SuiteHooks_2;

declare interface SuiteHooks_2<ExtraContext = object> {
    beforeAll: BeforeAllListener[];
    afterAll: AfterAllListener[];
    beforeEach: BeforeEachListener<ExtraContext>[];
    afterEach: AfterEachListener<ExtraContext>[];
}

declare interface SyncExpectationResult {
    pass: boolean;
    message: () => string;
    actual?: any;
    expected?: any;
}

/** @deprecated use `RunnerTask` instead */
export declare type Task = RunnerTask;

/** @deprecated use `RunnerTaskBase` instead */
export declare type TaskBase = RunnerTaskBase;

/**
 * Context that's always available in the test function.
 */
export declare interface TaskContext<Task extends RunnerCustomCase | RunnerTestCase = RunnerCustomCase | RunnerTestCase> {
    /**
     * Metadata of the current test
     */
    task: Readonly<Task>;
    /**
     * Extract hooks on test failed
     */
    onTestFailed: (fn: OnTestFailedHandler) => void;
    /**
     * Extract hooks on test failed
     */
    onTestFinished: (fn: OnTestFinishedHandler) => void;
    /**
     * Mark tests as skipped. All execution after this call will be skipped.
     * This function throws an error, so make sure you are not catching it accidentally.
     */
    skip: () => void;
}

export declare interface TaskCustomOptions extends TestOptions {
    /**
     * Whether the task was produced with `.each()` method.
     */
    each?: boolean;
    /**
     * Custom metadata for the task that will be assigned to `task.meta`.
     */
    meta?: Record<string, unknown>;
    /**
     * Task fixtures.
     */
    fixtures?: FixtureItem[];
    /**
     * Function that will be called when the task is executed.
     * If nothing is provided, the runner will try to get the function using `getFn(task)`.
     * If the runner cannot find the function, the task will be marked as failed.
     */
    handler?: (context: TaskContext<RunnerCustomCase>) => Awaitable_2<void>;
}

declare type TaskEventListener = (e: Event & {
    task: BenchTask;
}) => any | Promise<any>;

/**
 * task events
 */
declare type TaskEvents = 'abort' | 'complete' | 'error' | 'reset' | 'start' | 'warmup' | 'cycle';

declare type TaskEventsMap = {
    abort: NoopEventListener;
    start: TaskEventListener;
    error: TaskEventListener;
    cycle: TaskEventListener;
    complete: TaskEventListener;
    warmup: TaskEventListener;
    reset: TaskEventListener;
};

declare interface TaskHook<HookListener> {
    (fn: HookListener, timeout?: number): void;
}

/**
 * Custom metadata that can be used in reporters.
 */
export declare interface TaskMeta {
}

declare interface TaskPopulated extends RunnerTaskBase {
    /**
     * File task. It's the root task of the file.
     */
    file: RunnerTestFile;
    /**
     * Whether the task was skipped by calling `t.skip()`.
     */
    pending?: boolean;
    /**
     * Whether the task should succeed if it fails. If the task fails, it will be marked as passed.
     */
    fails?: boolean;
    /**
     * Hooks that will run if the task fails. The order depends on the `sequence.hooks` option.
     */
    onFailed?: OnTestFailedHandler[];
    /**
     * Hooks that will run after the task finishes. The order depends on the `sequence.hooks` option.
     */
    onFinished?: OnTestFinishedHandler[];
    /**
     * Store promises (from async expects) to wait for them before finishing the test
     */
    promises?: Promise<any>[];
}

/** @deprecated use `RunnerTaskResult` instead */
export declare type TaskResult = RunnerTaskResult;

/** @deprecated use `RunnerTaskResultPack` instead */
export declare type TaskResultPack = RunnerTaskResultPack;

export declare type TaskState = RunMode | 'pass' | 'fail';

/** @deprecated use `RunnerTestCase` instead */
export declare type Test = RunnerTestCase;

/**
 * Defines a test case with a given name and test function. The test function can optionally be configured with test options.
 *
 * @param {string | Function} name - The name of the test or a function that will be used as a test name.
 * @param {TestOptions | TestFunction} [optionsOrFn] - Optional. The test options or the test function if no explicit name is provided.
 * @param {number | TestOptions | TestFunction} [optionsOrTest] - Optional. The test function or options, depending on the previous parameters.
 * @throws {Error} If called inside another test function.
 * @example
 * ```ts
 * // Define a simple test
 * test('should add two numbers', () => {
 *   expect(add(1, 2)).toBe(3);
 * });
 * ```
 * @example
 * ```ts
 * // Define a test with options
 * test('should subtract two numbers', { retry: 3 }, () => {
 *   expect(subtract(5, 2)).toBe(3);
 * });
 * ```
 */
export declare const test: TestAPI;

declare type Test_2 = (arg0: any) => boolean;

export declare type TestAPI<ExtraContext = object> = ChainableTestAPI<ExtraContext> & ExtendedAPI<ExtraContext> & {
    extend: <T extends Record<string, any> = object>(fixtures: Fixtures<T, ExtraContext>) => TestAPI<{
        [K in keyof T | keyof ExtraContext]: K extends keyof T ? T[K] : K extends keyof ExtraContext ? ExtraContext[K] : never;
    }>;
};

declare interface TestCollectorCallable<C = object> {
    /**
     * @deprecated Use options as the second argument instead
     */
    <ExtraContext extends C>(name: string | Function, fn: TestFunction<ExtraContext>, options: TestOptions): void;
    <ExtraContext extends C>(name: string | Function, fn?: TestFunction<ExtraContext>, options?: number | TestOptions): void;
    <ExtraContext extends C>(name: string | Function, options?: TestOptions, fn?: TestFunction<ExtraContext>): void;
}

/**
 * User's custom test context.
 */
export declare interface TestContext {
}

declare interface TestEachFunction {
    <T extends any[] | [any]>(cases: ReadonlyArray<T>): EachFunctionReturn<T>;
    <T extends ReadonlyArray<any>>(cases: ReadonlyArray<T>): EachFunctionReturn<ExtractEachCallbackArgs<T>>;
    <T>(cases: ReadonlyArray<T>): EachFunctionReturn<T[]>;
    (...args: [TemplateStringsArray, ...any]): EachFunctionReturn<any[]>;
}

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 interface TestError_2 extends SerializedError {
    cause?: TestError_2;
    diff?: string;
    actual?: string;
    expected?: string;
}
export { TestError_2 as TestError }

declare interface TestForFunction<ExtraContext> {
    <T>(cases: ReadonlyArray<T>): TestForFunctionReturn<T, ExtendedContext<RunnerTestCase> & ExtraContext>;
    (strings: TemplateStringsArray, ...values: any[]): TestForFunctionReturn<any, ExtendedContext<RunnerTestCase> & ExtraContext>;
}

declare interface TestForFunctionReturn<Arg, Context> {
    (name: string | Function, fn: (arg: Arg, context: Context) => Awaitable_2<void>): void;
    (name: string | Function, options: TestOptions, fn: (args: Arg, context: Context) => Awaitable_2<void>): void;
}

export declare type TestFunction<ExtraContext = object> = (context: ExtendedContext<RunnerTestCase> & ExtraContext) => Awaitable_2<any> | void;

export declare interface TestOptions {
    /**
     * Test timeout.
     */
    timeout?: number;
    /**
     * Times to retry the test if fails. Useful for making flaky tests more stable.
     * When retries is up, the last test error will be thrown.
     *
     * @default 0
     */
    retry?: number;
    /**
     * How many times the test will run again.
     * Only inner tests will repeat if set on `describe()`, nested `describe()` will inherit parent's repeat by default.
     *
     * @default 0
     */
    repeats?: number;
    /**
     * Whether suites and tests run concurrently.
     * Tests inherit `concurrent` from `describe()` and nested `describe()` will inherit from parent's `concurrent`.
     */
    concurrent?: boolean;
    /**
     * Whether tests run sequentially.
     * Tests inherit `sequential` from `describe()` and nested `describe()` will inherit from parent's `sequential`.
     */
    sequential?: boolean;
    /**
     * Whether the test should be skipped.
     */
    skip?: boolean;
    /**
     * Should this test be the only one running in a suite.
     */
    only?: boolean;
    /**
     * Whether the test should be skipped and marked as a todo.
     */
    todo?: boolean;
    /**
     * Whether the test is expected to fail. If it does, the test will pass, otherwise it will fail.
     */
    fails?: boolean;
}

declare namespace tinyrainbow {
    export {
        Formatter,
        createColors,
        getDefaultColors,
        isSupported,
        Colors_2 as Colors,
        _default as default
    }
}

declare type TransformMode = 'web' | 'ssr';

export declare interface TransformResultWithSource {
    code: string;
    map: SourceMap | {
        mappings: '';
    } | null;
    etag?: string;
    deps?: string[];
    dynamicDeps?: string[];
    source?: string;
}

declare type Truthy<T> = T extends false | '' | 0 | null | undefined ? never : T;

/**
 * The simple(ish) way to get overload info from a constructor
 * {@linkcode ConstructorType}. Recent versions of TypeScript will match any
 * constructor against a generic 10-overload type, filling in slots with
 * duplicates of the constructor. So, we can just match against a single type
 * and get all the overloads.
 *
 * For older versions of TypeScript,
 * we'll need to painstakingly do ten separate matches.
 */
declare type TSPost53ConstructorOverloadsInfoUnion<ConstructorType> = ConstructorType extends {
    new (...args: infer A1): infer R1;
    new (...args: infer A2): infer R2;
    new (...args: infer A3): infer R3;
    new (...args: infer A4): infer R4;
    new (...args: infer A5): infer R5;
    new (...args: infer A6): infer R6;
    new (...args: infer A7): infer R7;
    new (...args: infer A8): infer R8;
    new (...args: infer A9): infer R9;
    new (...args: infer A10): infer R10;
} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) | (new (...p: A10) => R10) : never;

/**
 * The simple(ish) way to get overload info from a function
 * {@linkcode FunctionType}. Recent versions of TypeScript will match any
 * function against a generic 10-overload type, filling in slots with
 * duplicates of the function. So, we can just match against a single type
 * and get all the overloads.
 *
 * For older versions of TypeScript, we'll need to painstakingly do
 * ten separate matches.
 */
declare type TSPost53OverloadsInfoUnion<FunctionType> = FunctionType extends {
    (...args: infer A1): infer R1;
    (...args: infer A2): infer R2;
    (...args: infer A3): infer R3;
    (...args: infer A4): infer R4;
    (...args: infer A5): infer R5;
    (...args: infer A6): infer R6;
    (...args: infer A7): infer R7;
    (...args: infer A8): infer R8;
    (...args: infer A9): infer R9;
    (...args: infer A10): infer R10;
} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) | ((...p: A10) => R10) : never;

/**
 * For older versions of TypeScript, we need two separate workarounds to
 * get constructor overload info. First, we need need to use
 * {@linkcode DecreasingConstructorOverloadsInfoUnion} to get the overload
 * info for constructors with 1-10 overloads. Then, we need to filter out the
 * "useless" overloads that are present in older versions of TypeScript,
 * for parameterless constructors. To do this we use
 * {@linkcode IsUselessConstructorOverloadInfo} to remove useless overloads.
 *
 * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related}
 */
declare type TSPre53ConstructorOverloadsInfoUnion<ConstructorType> = Tuplify<DecreasingConstructorOverloadsInfoUnion<ConstructorType>> extends infer Tup ? Tup extends [infer Ctor] ? IsUselessConstructorOverloadInfo<Ctor> extends true ? never : Ctor : never : never;

/**
 * For older versions of TypeScript, we need two separate workarounds
 * to get overload info. First, we need need to use
 * {@linkcode DecreasingOverloadsInfoUnion} to get the overload info for
 * functions with 1-10 overloads. Then, we need to filter out the
 * "useless" overloads that are present in older versions of TypeScript,
 * for parameterless functions. To do this we use
 * {@linkcode IsUselessOverloadInfo} to remove useless overloads.
 *
 * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related}
 */
declare type TSPre53OverloadsInfoUnion<FunctionType> = Tuplify<DecreasingOverloadsInfoUnion<FunctionType>> extends infer Tup ? Tup extends [infer Fn] ? IsUselessOverloadInfo<Fn> extends true ? never : Fn : never : never;

/**
 * Old versions of TypeScript can sometimes seem to refuse to separate out
 * union members unless you put them each in a pointless tuple and add an
 * extra `infer X` expression. There may be a better way to work around this
 * problem, but since it's not a problem in newer versions of TypeScript,
 * it's not a priority right now.
 */
declare type Tuplify<Union> = Union extends infer X ? [X] : never;

/**
 * Intermediate type for {@linkcode UnionToTuple} which pushes the
 * "last" union member to the end of a tuple, and recursively prepends
 * the remainder of the union.
 */
declare type TuplifyUnion<Union, LastElement = LastOf<Union>> = IsNever<Union> extends true ? [] : [...TuplifyUnion<Exclude<Union, LastElement>>, LastElement];

export declare interface UncheckedSnapshot {
    filePath: string;
    keys: Array<string>;
}

/**
 * Convert a union to an intersection.
 * `A | B | C` -\> `A & B & C`
 */
declare type UnionToIntersection<Union> = (Union extends any ? (distributedUnion: Union) => void : never) extends (mergedIntersection: infer Intersection) => void ? Intersection : never;

/**
 * Convert a union like `1 | 2 | 3` to a tuple like `[1, 2, 3]`.
 */
declare type UnionToTuple<Union> = TuplifyUnion<Union>;

/**
 * A constructor function with `unknown` parameters and return type.
 */
declare type UnknownConstructor = new (...args: unknown[]) => unknown;

/**
 * A function with `unknown` parameters and return type.
 */
declare type UnknownFunction = (...args: unknown[]) => unknown;

declare type Use<T> = (value: T) => Promise<void>;

/**
 * Subjective "useful" keys from a type. For objects it's just `keyof` but for
 * tuples/arrays it's the number keys.
 *
 * @example
 * ```ts
 * UsefulKeys<{ a: 1; b: 2 }> // 'a' | 'b'
 *
 * UsefulKeys<['a', 'b']> // '0' | '1'
 *
 * UsefulKeys<string[]> // number
 * ```
 */
declare type UsefulKeys<T> = T extends any[] ? {
    [K in keyof T]: K;
}[number] : keyof T;

export declare interface UserConsoleLog {
    content: string;
    origin?: string;
    browser?: boolean;
    type: 'stdout' | 'stderr';
    taskId?: string;
    time: number;
    size: number;
}

export declare const vi: VitestUtils;

export declare const vitest: VitestUtils;

declare type VitestAssertion<A, T> = {
    [K in keyof A]: A[K] extends Chai.Assertion ? Assertion<T> : A[K] extends (...args: any[]) => any ? A[K] : VitestAssertion<A[K], T>;
} & ((type: string, message?: string) => Assertion);

/** @deprecated import from `vitest/node` instead */
export declare type VitestEnvironment = VitestEnvironment_2;

declare type VitestEnvironment_2 = BuiltinEnvironment | (string & Record<never, never>);

export declare interface VitestUtils {
    /**
     * Checks if fake timers are enabled.
     */
    isFakeTimers: () => boolean;
    /**
     * This method wraps all further calls to timers until [`vi.useRealTimers()`](https://vitest.dev/api/vi#vi-userealtimers) is called.
     */
    useFakeTimers: (config?: FakeTimerInstallOpts) => VitestUtils;
    /**
     * Restores mocked timers to their original implementations. All timers that were scheduled before will be discarded.
     */
    useRealTimers: () => VitestUtils;
    /**
     * This method will call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call.
     * It will not fire any timer that was initiated during its call.
     */
    runOnlyPendingTimers: () => VitestUtils;
    /**
     * This method will asynchronously call every timer that was initiated after [`vi.useFakeTimers`](https://vitest.dev/api/vi#vi-usefaketimers) call, even asynchronous ones.
     * It will not fire any timer that was initiated during its call.
     */
    runOnlyPendingTimersAsync: () => Promise<VitestUtils>;
    /**
     * This method will invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimers` will be fired.
     * If you have an infinite interval, it will throw after 10,000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)).
     */
    runAllTimers: () => VitestUtils;
    /**
     * This method will asynchronously invoke every initiated timer until the timer queue is empty. It means that every timer called during `runAllTimersAsync` will be fired even asynchronous timers.
     * If you have an infinite interval, it will throw after 10 000 tries (can be configured with [`fakeTimers.loopLimit`](https://vitest.dev/config/#faketimers-looplimit)).
     */
    runAllTimersAsync: () => Promise<VitestUtils>;
    /**
     * Calls every microtask that was queued by `process.nextTick`. This will also run all microtasks scheduled by themselves.
     */
    runAllTicks: () => VitestUtils;
    /**
     * This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first.
     */
    advanceTimersByTime: (ms: number) => VitestUtils;
    /**
     * This method will invoke every initiated timer until the specified number of milliseconds is passed or the queue is empty - whatever comes first. This will include and await asynchronously set timers.
     */
    advanceTimersByTimeAsync: (ms: number) => Promise<VitestUtils>;
    /**
     * Will call next available timer. Useful to make assertions between each timer call. You can chain call it to manage timers by yourself.
     */
    advanceTimersToNextTimer: () => VitestUtils;
    /**
     * Will call next available timer and wait until it's resolved if it was set asynchronously. Useful to make assertions between each timer call.
     */
    advanceTimersToNextTimerAsync: () => Promise<VitestUtils>;
    /**
     * Similar to [`vi.advanceTimersByTime`](https://vitest.dev/api/vi#vi-advancetimersbytime), but will advance timers by the milliseconds needed to execute callbacks currently scheduled with `requestAnimationFrame`.
     */
    advanceTimersToNextFrame: () => VitestUtils;
    /**
     * Get the number of waiting timers.
     */
    getTimerCount: () => number;
    /**
     * If fake timers are enabled, this method simulates a user changing the system clock (will affect date related API like `hrtime`, `performance.now` or `new Date()`) - however, it will not fire any timers.
     * If fake timers are not enabled, this method will only mock `Date.*` and `new Date()` calls.
     */
    setSystemTime: (time: number | string | Date) => VitestUtils;
    /**
     * Returns mocked current date that was set using `setSystemTime`. If date is not mocked the method will return `null`.
     */
    getMockedSystemTime: () => Date | null;
    /**
     * When using `vi.useFakeTimers`, `Date.now` calls are mocked. If you need to get real time in milliseconds, you can call this function.
     */
    getRealSystemTime: () => number;
    /**
     * Removes all timers that are scheduled to run. These timers will never run in the future.
     */
    clearAllTimers: () => VitestUtils;
    /**
     * Creates a spy on a method or getter/setter of an object similar to [`vi.fn()`](https://vitest.dev/api/vi#vi-fn). It returns a [mock function](https://vitest.dev/api/mock).
     * @example
     * ```ts
     * const cart = {
     *   getApples: () => 42
     * }
     *
     * const spy = vi.spyOn(cart, 'getApples').mockReturnValue(10)
     *
     * expect(cart.getApples()).toBe(10)
     * expect(spy).toHaveBeenCalled()
     * expect(spy).toHaveReturnedWith(10)
     * ```
     */
    spyOn: typeof spyOn;
    /**
     * Creates a spy on a function, though can be initiated without one. Every time a function is invoked, it stores its call arguments, returns, and instances. Also, you can manipulate its behavior with [methods](https://vitest.dev/api/mock).
     *
     * If no function is given, mock will return `undefined`, when invoked.
     * @example
     * ```ts
     * const getApples = vi.fn(() => 0)
     *
     * getApples()
     *
     * expect(getApples).toHaveBeenCalled()
     * expect(getApples).toHaveReturnedWith(0)
     *
     * getApples.mockReturnValueOnce(5)
     *
     * expect(getApples()).toBe(5)
     * expect(getApples).toHaveNthReturnedWith(2, 5)
     * ```
     */
    fn: typeof fn;
    /**
     * Wait for the callback to execute successfully. If the callback throws an error or returns a rejected promise it will continue to wait until it succeeds or times out.
     *
     * This is very useful when you need to wait for some asynchronous action to complete, for example, when you start a server and need to wait for it to start.
     * @example
     * ```ts
     * const server = createServer()
     *
     * await vi.waitFor(
     *   () => {
     *     if (!server.isReady)
     *       throw new Error('Server not started')
     *
     *     console.log('Server started')
     *   }, {
     *     timeout: 500, // default is 1000
     *     interval: 20, // default is 50
     *   }
     * )
     * ```
     */
    waitFor: typeof waitFor;
    /**
     * This is similar to [`vi.waitFor`](https://vitest.dev/api/vi#vi-waitfor), but if the callback throws any errors, execution is immediately interrupted and an error message is received.
     *
     * If the callback returns a falsy value, the next check will continue until a truthy value is returned. This is useful when you need to wait for something to exist before taking the next step.
     * @example
     * ```ts
     * const element = await vi.waitUntil(
     *   () => document.querySelector('.element'),
     *   {
     *     timeout: 500, // default is 1000
     *     interval: 20, // default is 50
     *   }
     * )
     *
     * // do something with the element
     * expect(element.querySelector('.element-child')).toBeTruthy()
     * ```
     */
    waitUntil: typeof waitUntil;
    /**
     * Run the factory before imports are evaluated. You can return a value from the factory
     * to reuse it inside your [`vi.mock`](https://vitest.dev/api/vi#vi-mock) factory and tests.
     *
     * If used with [`vi.mock`](https://vitest.dev/api/vi#vi-mock), both will be hoisted in the order they are defined in.
     */
    hoisted: <T>(factory: () => T) => T;
    /**
     * Mocks every import call to the module even if it was already statically imported.
     *
     * The call to `vi.mock` is hoisted to the top of the file, so you don't have access to variables declared in the global file scope
     * unless they are defined with [`vi.hoisted`](https://vitest.dev/api/vi#vi-hoisted) before this call.
     *
     * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
     * @param path Path to the module. Can be aliased, if your Vitest config supports it
     * @param factory Mocked module factory. The result of this function will be an exports object
     */
    mock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
    mock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
    /**
     * Removes module from mocked registry. All calls to import will return the original module even if it was mocked before.
     *
     * This call is hoisted to the top of the file, so it will only unmock modules that were defined in `setupFiles`, for example.
     * @param path Path to the module. Can be aliased, if your Vitest config supports it
     */
    unmock(path: string): void;
    unmock(module: Promise<unknown>): void;
    /**
     * Mocks every subsequent [dynamic import](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import) call.
     *
     * Unlike [`vi.mock`](https://vitest.dev/api/vi#vi-mock), this method will not mock statically imported modules because it is not hoisted to the top of the file.
     *
     * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
     * @param path Path to the module. Can be aliased, if your Vitest config supports it
     * @param factory Mocked module factory. The result of this function will be an exports object
     */
    doMock(path: string, factory?: MockFactoryWithHelper | MockOptions): void;
    doMock<T>(module: Promise<T>, factory?: MockFactoryWithHelper<T> | MockOptions): void;
    /**
     * Removes module from mocked registry. All subsequent calls to import will return original module.
     *
     * Unlike [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock), this method is not hoisted to the top of the file.
     * @param path Path to the module. Can be aliased, if your Vitest config supports it
     */
    doUnmock(path: string): void;
    doUnmock(module: Promise<unknown>): void;
    /**
     * Imports module, bypassing all checks if it should be mocked.
     * Can be useful if you want to mock module partially.
     * @example
     * ```ts
     * vi.mock('./example.js', async () => {
     *  const axios = await vi.importActual<typeof import('./example.js')>('./example.js')
     *
     *  return { ...axios, get: vi.fn() }
     * })
     * ```
     * @param path Path to the module. Can be aliased, if your config supports it
     */
    importActual: <T = ESModuleExports>(path: string) => Promise<T>;
    /**
     * Imports a module with all of its properties and nested properties mocked.
     *
     * Mocking algorithm is described in [documentation](https://vitest.dev/guide/mocking#modules).
     * @example
     * ```ts
     * const example = await vi.importMock<typeof import('./example.js')>('./example.js')
     * example.calc.mockReturnValue(10)
     * expect(example.calc()).toBe(10)
     * ```
     * @param path Path to the module. Can be aliased, if your config supports it
     * @returns Fully mocked module
     */
    importMock: <T = ESModuleExports>(path: string) => Promise<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'
     * vi.mock('./example.js')
     *
     * test('1 + 1 equals 10' async () => {
     *  vi.mocked(example.calc).mockReturnValue(10)
     *  expect(example.calc(1, '+', 1)).toBe(10)
     * })
     * ```
     * @param item Anything that can be mocked
     * @param deep If the object is deeply mocked
     * @param options If the object is partially or deeply mocked
     */
    mocked: (<T>(item: T, deep?: false) => MaybeMocked<T>) & (<T>(item: T, deep: true) => MaybeMockedDeep<T>) & (<T>(item: T, options: {
        partial?: false;
        deep?: false;
    }) => MaybeMocked<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>) & (<T>(item: T) => MaybeMocked<T>);
    /**
     * Checks that a given parameter is a mock function. If you are using TypeScript, it will also narrow down its type.
     */
    isMockFunction: (fn: any) => fn is MockInstance;
    /**
     * Calls [`.mockClear()`](https://vitest.dev/api/mock#mockclear) on every mocked function. This will only empty `.mock` state, it will not reset implementation.
     *
     * It is useful if you need to clean up mock between different assertions.
     */
    clearAllMocks: () => VitestUtils;
    /**
     * Calls [`.mockReset()`](https://vitest.dev/api/mock#mockreset) on every mocked function. This will empty `.mock` state, reset "once" implementations and force the base implementation to return `undefined` when invoked.
     *
     * This is useful when you want to completely reset a mock to the default state.
     */
    resetAllMocks: () => VitestUtils;
    /**
     * Calls [`.mockRestore()`](https://vitest.dev/api/mock#mockrestore) on every mocked function. This will restore all original implementations.
     */
    restoreAllMocks: () => VitestUtils;
    /**
     * Makes value available on global namespace.
     * Useful, if you want to have global variables available, like `IntersectionObserver`.
     * You can return it back to original value with `vi.unstubAllGlobals`, or by enabling `unstubGlobals` config option.
     */
    stubGlobal: (name: string | symbol | number, value: unknown) => VitestUtils;
    /**
     * Changes the value of `import.meta.env` and `process.env`.
     * You can return it back to original value with `vi.unstubAllEnvs`, or by enabling `unstubEnvs` config option.
     */
    stubEnv: <T extends string>(name: T, value: T extends 'PROD' | 'DEV' | 'SSR' ? boolean : string | undefined) => VitestUtils;
    /**
     * Reset the value to original value that was available before first `vi.stubGlobal` was called.
     */
    unstubAllGlobals: () => VitestUtils;
    /**
     * Reset environmental variables to the ones that were available before first `vi.stubEnv` was called.
     */
    unstubAllEnvs: () => VitestUtils;
    /**
     * Resets modules registry by clearing the cache of all modules. This allows modules to be reevaluated when reimported.
     * Top-level imports cannot be re-evaluated. Might be useful to isolate modules where local state conflicts between tests.
     *
     * This method does not reset mocks registry. To clear mocks registry, use [`vi.unmock`](https://vitest.dev/api/vi#vi-unmock) or [`vi.doUnmock`](https://vitest.dev/api/vi#vi-dounmock).
     */
    resetModules: () => VitestUtils;
    /**
     * Wait for all imports to load. Useful, if you have a synchronous call that starts
     * importing a module that you cannot await otherwise.
     * Will also wait for new imports, started during the wait.
     */
    dynamicImportSettled: () => Promise<void>;
    /**
     * Updates runtime config. You can only change values that are used when executing tests.
     */
    setConfig: (config: RuntimeOptions) => void;
    /**
     * If config was changed with `vi.setConfig`, this will reset it to the original state.
     */
    resetConfig: () => void;
}

declare interface VmEnvironmentReturn {
    getVmContext: () => {
        [key: string]: any;
    };
    teardown: () => Awaitable_3<void>;
}

declare function waitFor<T>(callback: WaitForCallback<T>, options?: number | WaitForOptions): Promise<T>;

declare type WaitForCallback<T> = () => T | Promise<T>;

declare interface WaitForOptions {
    /**
     * @description Time in ms between each check callback
     * @default 50ms
     */
    interval?: number;
    /**
     * @description Time in ms after which the throw a timeout error
     * @default 1000ms
     */
    timeout?: number;
}

declare function waitUntil<T>(callback: WaitUntilCallback<T>, options?: number | WaitUntilOptions): Promise<Truthy<T>>;

declare type WaitUntilCallback<T> = () => T | Promise<T>;

declare interface WaitUntilOptions extends Pick<WaitForOptions, 'interval' | 'timeout'> {
}

export declare interface WebSocketEvents {
    onCollected?: (files?: RunnerTestFile[]) => Awaitable_3<void>;
    onFinished?: (files: RunnerTestFile[], errors: unknown[], coverage?: unknown) => Awaitable_3<void>;
    onTaskUpdate?: (packs: RunnerTaskResultPack[]) => Awaitable_3<void>;
    onUserConsoleLog?: (log: UserConsoleLog) => Awaitable_3<void>;
    onPathsCollected?: (paths?: string[]) => Awaitable_3<void>;
    onSpecsCollected?: (specs?: SerializedTestSpecification[]) => Awaitable_3<void>;
    onFinishedReportCoverage: () => void;
}

export declare interface WebSocketHandlers {
    onTaskUpdate: (packs: RunnerTaskResultPack[]) => void;
    getFiles: () => RunnerTestFile[];
    getTestFiles: () => Promise<SerializedTestSpecification[]>;
    getPaths: () => string[];
    getConfig: () => SerializedConfig;
    getModuleGraph: (projectName: string, id: string, browser?: boolean) => Promise<ModuleGraphData>;
    getTransformResult: (projectName: string, id: string, browser?: boolean) => Promise<TransformResultWithSource | undefined>;
    readTestFile: (id: string) => Promise<string | null>;
    saveTestFile: (id: string, content: string) => Promise<void>;
    rerun: (files: string[]) => Promise<void>;
    updateSnapshot: (file?: RunnerTestFile) => Promise<void>;
    getUnhandledErrors: () => unknown[];
}

export declare type WebSocketRPC = BirpcReturn<WebSocketEvents, WebSocketHandlers>;

export { }
declare global {
  namespace Chai {
    export interface Assertion {
      containSubset: (expected: any) => Assertion;
    }
    export interface Assert {
      containSubset: (val: any, exp: any, msg?: string) => void;
    }
  }
}
declare interface SnapshotMatcher<T> {
  <U extends { [P in keyof T]: any }>(snapshot: Partial<U>, message?: string): void;
  (message?: string): void;
}
declare interface InlineSnapshotMatcher<T> {
  <U extends { [P in keyof T]: any }>(
    properties: Partial<U>,
    snapshot?: string,
    message?: string
  ): void;
  (message?: string): void;
}
declare interface MatcherState {
  environment: VitestEnvironment;
  snapshotState: SnapshotState;
}
export declare interface ExpectPollOptions {
  interval?: number;
  timeout?: number;
  message?: string;
}
export declare interface ExpectStatic {
  unreachable: (message?: string) => never;
  soft: <T>(actual: T, message?: string) => Assertion<T>;
  poll: <T>(actual: () => T, options?: ExpectPollOptions) => PromisifyAssertion<Awaited<T>>;
  addEqualityTesters: (testers: Array<Tester>) => void;
  assertions: (expected: number) => void;
  hasAssertions: () => void;
  addSnapshotSerializer: (plugin: Plugin) => void;
}
export declare interface Assertion<T> {
  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>;
}
export declare interface TestContext {
  expect: ExpectStatic;
}
export declare interface TaskMeta {
  typecheck?: boolean;
  benchmark?: boolean;
  failScreenshotPath?: string;
}
export declare interface RunnerTestFile {
  prepareDuration?: number;
  environmentLoad?: number;
}
export declare interface RunnerTaskBase {
  logs?: UserConsoleLog[];
}
export declare interface RunnerTaskResult {
  benchmark?: BenchmarkResult;
}
