@pulzar/core
Version:
Next-generation Node.js framework for ultra-fast web applications with zero-reflection DI, GraphQL, WebSockets, events, and edge runtime support
81 lines • 1.91 kB
TypeScript
import type { FastifyInstance } from "fastify";
export interface TestContext {
app?: FastifyInstance;
server?: any;
port?: number;
baseUrl?: string;
cleanup?: Array<() => Promise<void>>;
}
export interface TestConfig {
port?: number;
timeout?: number;
enableLogs?: boolean;
cleanupAfterEach?: boolean;
setupDatabase?: boolean;
enableAuth?: boolean;
}
export declare class TestSetup {
private config;
private context;
constructor(config?: Partial<TestConfig>);
/**
* Setup test environment
*/
setup(): Promise<TestContext>;
/**
* Cleanup test environment
*/
cleanup(): Promise<void>;
/**
* Create test application
*/
private createTestApp;
/**
* Start test server
*/
private startTestServer;
/**
* Setup test database
*/
private setupDatabase;
/**
* Disable logging for tests
*/
private disableLogs;
/**
* Add custom cleanup function
*/
addCleanup(fn: () => Promise<void>): void;
/**
* Get test context
*/
getContext(): TestContext;
}
/**
* Setup global test environment
*/
export declare function setupTestEnvironment(config?: Partial<TestConfig>): Promise<TestContext>;
/**
* Cleanup global test environment
*/
export declare function cleanupTestEnvironment(): Promise<void>;
/**
* Get current test context
*/
export declare function getTestContext(): TestContext;
/**
* Create a test suite with automatic setup/cleanup
*/
export declare function createTestSuite(config?: Partial<TestConfig>): {
getContext: () => TestContext;
addCleanup: (fn: () => Promise<void>) => void;
};
/**
* Vitest global setup
*/
export declare function globalSetup(): Promise<void>;
/**
* Vitest global teardown
*/
export declare function globalTeardown(): Promise<void>;
//# sourceMappingURL=setup.d.ts.map