@suites/unit
Version:
62 lines (61 loc) • 2.66 kB
TypeScript
import type { Type } from '@suites/types.common';
import { SuitesError } from '@suites/types.common';
import type { TestBedBuilder } from '@suites/core.unit';
/**
* Thrown when Suites cannot find a compatible adapter package for the DI framework or mocking library.
*
* This occurs when the required adapter package is not installed or cannot be resolved.
* Install the appropriate adapter package to resolve this error.
*
* @since 3.0.0
* @see {@link https://suites.dev/docs/get-started/installation | Installation Guide}
*/
export declare class AdapterNotFoundError extends SuitesError {
constructor(message: string);
}
/**
* Registry of supported mocking library adapter packages.
*
* Maps mocking library names to their corresponding Suites adapter package names.
* Suites automatically detects which library is installed and loads the appropriate adapter.
*
* @since 3.0.0
*/
export declare const SuitesDoublesAdapters: {
readonly jest: "@suites/doubles.jest";
readonly sinon: "@suites/doubles.sinon";
readonly vitest: "@suites/doubles.vitest";
readonly bun: "@suites/doubles.bun";
readonly deno: "@suites/doubles.deno";
readonly node: "@suites/doubles.node";
};
/**
* Registry of supported dependency injection framework adapter packages.
*
* Maps DI framework names to their corresponding Suites adapter package names.
* Suites automatically detects which DI framework is installed and loads the appropriate adapter.
*
* @since 3.0.0
*/
export declare const SuitesDIAdapters: {
readonly nestjs: "@suites/di.nestjs";
readonly inversify: "@suites/di.inversify";
readonly tsyringe: "@suites/di.tsyringe";
};
/**
* Factory function for creating TestBedBuilder instances with automatic adapter resolution.
*
* This function resolves and configures the appropriate DI and mocking library adapters
* based on what's installed in the project, then creates a builder for the specified target class.
*
* @internal This is used internally by TestBed.solitary() and TestBed.sociable()
* @template TClass The type of the class to be tested
* @param diAdapters - Registry of DI framework adapters
* @param doublesAdapters - Registry of mocking library adapters
* @param targetClass - The class for which to create the test environment
* @returns Factory object with a create method for building TestBedBuilder instances
* @since 3.0.0
*/
export declare function testBedBuilderFactory<TClass>(diAdapters: typeof SuitesDIAdapters, doublesAdapters: typeof SuitesDoublesAdapters, targetClass: Type<TClass>): {
create: <TBuilder>(testbedBuilderType: Type<TestBedBuilder<TClass>>) => TBuilder;
};