UNPKG

@re-shell/cli

Version:

Full-stack development platform uniting microservices and microfrontends. Build complete applications with .NET (ASP.NET Core Web API, Minimal API), Java (Spring Boot, Quarkus, Micronaut, Vert.x), Rust (Actix-Web, Warp, Rocket, Axum), Python (FastAPI, Dja

148 lines (147 loc) 4.16 kB
import { EventEmitter } from 'events'; import { ChildProcess } from 'child_process'; export interface IntegrationTestConfig { scenarios: TestScenario[]; parallel?: boolean; maxConcurrency?: number; timeout?: number; retries?: number; cleanupAfterEach?: boolean; captureOutput?: boolean; recordVideo?: boolean; generateReport?: boolean; } export interface TestScenario { name: string; description?: string; steps: TestStep[]; setup?: SetupStep[]; teardown?: TeardownStep[]; expectations: Expectation[]; tags?: string[]; skip?: boolean; only?: boolean; timeout?: number; } export interface TestStep { type: 'command' | 'file' | 'http' | 'process' | 'wait' | 'custom'; action: string; args?: any; description?: string; expectedOutput?: string | RegExp; expectedExitCode?: number; timeout?: number; retries?: number; continueOnFailure?: boolean; } export interface SetupStep { type: 'directory' | 'file' | 'env' | 'service' | 'custom'; action: string; config?: any; } export interface TeardownStep { type: 'cleanup' | 'service' | 'process' | 'custom'; action: string; force?: boolean; } export interface Expectation { type: 'file' | 'directory' | 'output' | 'process' | 'http' | 'custom'; target: string; condition: 'exists' | 'contains' | 'matches' | 'equals' | 'custom'; value?: any; timeout?: number; } export interface TestResult { scenario: string; success: boolean; duration: number; steps: StepResult[]; expectations: ExpectationResult[]; error?: Error; output?: string; artifacts?: TestArtifact[]; } export interface StepResult { step: string; success: boolean; duration: number; output?: string; error?: string; retries?: number; } export interface ExpectationResult { expectation: string; success: boolean; actual?: any; expected?: any; error?: string; } export interface TestArtifact { type: 'log' | 'screenshot' | 'video' | 'file'; path: string; timestamp: Date; } export interface TestReport { summary: TestSummary; results: TestResult[]; artifacts: TestArtifact[]; duration: number; timestamp: Date; } export interface TestSummary { total: number; passed: number; failed: number; skipped: number; duration: number; coverage?: number; } export interface TestEnvironment { id: string; workDir: string; env: Record<string, string>; processes: Map<string, ChildProcess>; artifacts: TestArtifact[]; } export declare class IntegrationTestFramework extends EventEmitter { private config; private environments; private results; constructor(config: IntegrationTestConfig); run(): Promise<TestReport>; runScenario(scenario: TestScenario): Promise<TestResult>; private createEnvironment; private runSetup; private runStep; private executeStep; private executeCommand; private executeFileOperation; private executeHttpRequest; private executeProcessOperation; private executeCustomStep; private checkExpectation; private checkFileExpectation; private checkDirectoryExpectation; private checkOutputExpectation; private checkProcessExpectation; private checkHttpExpectation; private checkCustomExpectation; private runTeardown; private startService; private runCustomSetup; private runCustomTeardown; private cleanupEnvironment; private cleanup; private filterScenarios; private runSequential; private runParallel; private chunkArray; private generateReport; private wait; addScenario(scenario: TestScenario): void; getResults(): TestResult[]; getReport(): TestReport | null; } export declare function createTestScenario(config: Partial<TestScenario>): TestScenario; export declare function createCommandStep(command: string, options?: Partial<TestStep>): TestStep; export declare function createFileExpectation(path: string, condition: 'exists' | 'contains' | 'matches' | 'equals', value?: any): Expectation;