@tresdoce-nestjs-toolkit/test-utils
Version:
Tresdoce NestJS Toolkit - Utilities para testing
37 lines (36 loc) • 1.81 kB
TypeScript
import { StartedDockerComposeEnvironment } from 'testcontainers';
import { ComposeDownOptions } from 'testcontainers/build/container-runtime';
/**
* Options for customizing how `initDockerCompose` waits for containers to become ready.
*/
type InitDockerComposeOptions = {
/**
* Explicit container names that should use `Wait.forHealthCheck()` as wait strategy.
* The values must be real container names, not docker-compose service names.
*/
healthCheckWaitStrategyNames?: string[];
/**
* When `true`, applies `Wait.forHealthCheck()` as the default wait strategy
* for every container started by the compose environment.
*/
useDefaultHealthCheckWaitStrategy?: boolean;
};
/**
* Creates a Jest-compatible global setup function that boots a docker-compose environment.
*
* @param _services - Optional subset of docker-compose services to start.
* @param _composeFilePath - Directory where the compose file is located.
* @param _composeFile - Compose file name.
* @param _startupTimeout - Maximum startup time in milliseconds.
* @param _options - Additional wait strategy configuration.
* @returns An async function that starts the compose environment.
*/
export declare const initDockerCompose: (_services?: Array<string>, _composeFilePath?: string, _composeFile?: string, _startupTimeout?: number, _options?: InitDockerComposeOptions) => () => Promise<StartedDockerComposeEnvironment | undefined>;
/**
* Creates a Jest-compatible global teardown function that stops the docker-compose environment.
*
* @param _options - Optional docker compose down options.
* @returns An async function that tears down the compose environment.
*/
export declare const closeDockerCompose: (_options?: Partial<ComposeDownOptions>) => () => Promise<void>;
export {};