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

126 lines (125 loc) 3.68 kB
import { EventEmitter } from 'events'; export interface CoverageConfig { targetCoverage: number; includePatterns?: string[]; excludePatterns?: string[]; reporters?: CoverageReporter[]; thresholds?: CoverageThresholds; collectFrom?: string[]; coverageDirectory?: string; failOnLowCoverage?: boolean; generateBadge?: boolean; trackHistory?: boolean; } export interface CoverageThresholds { branches?: number; functions?: number; lines?: number; statements?: number; global?: number; } export interface CoverageReporter { type: 'text' | 'json' | 'html' | 'lcov' | 'cobertura' | 'teamcity' | 'text-summary' | 'json-summary'; options?: any; } export interface CoverageResult { success: boolean; coverage: CoverageMetrics; uncoveredFiles: UncoveredFile[]; suggestions: string[]; report: CoverageReport; badge?: string; history?: CoverageHistory[]; } export interface CoverageMetrics { lines: CoverageMetric; statements: CoverageMetric; functions: CoverageMetric; branches: CoverageMetric; overall: number; } export interface CoverageMetric { total: number; covered: number; skipped: number; percentage: number; } export interface UncoveredFile { file: string; lines: UncoveredLine[]; functions: string[]; branches: string[]; coverage: number; } export interface UncoveredLine { line: number; code: string; hits: number; } export interface CoverageReport { summary: string; detailed: FileCoverage[]; timestamp: Date; duration: number; } export interface FileCoverage { file: string; lines: CoverageMetric; statements: CoverageMetric; functions: CoverageMetric; branches: CoverageMetric; uncoveredLines: number[]; } export interface CoverageHistory { date: Date; coverage: number; metrics: CoverageMetrics; commit?: string; branch?: string; } export interface TestFile { path: string; testCount: number; coverage: number; missing: string[]; } export declare class UnitTestCoverage extends EventEmitter { private config; private historyPath; constructor(config: CoverageConfig); analyze(projectPath: string): Promise<CoverageResult>; generateMissingTests(projectPath: string): Promise<TestFile[]>; createTestTemplate(sourceFile: string): Promise<string>; private runCoverage; private analyzeUncoveredCode; private analyzeFileCoverageData; private generateSuggestions; private createDetailedReport; private checkThresholds; private generateCoverageBadge; private trackCoverageHistory; private findSourceFiles; private getTestFilePath; private analyzeFileCoverage; private identifyMissingTests; private countTests; private extractFunctions; private extractClassName; private getImportPath; private generateTestCase; private buildCoverageConfig; private buildCoverageFlags; private parseCoverageData; private parseMetric; private calculateOverall; private calculateMetric; private getUncoveredLines; private getLineCode; private generateSummary; private createEmptyMetrics; generateCoverageReport(projectPath: string): Promise<string>; checkCoverageThreshold(projectPath: string): Promise<boolean>; getUncoveredCode(projectPath: string): Promise<UncoveredFile[]>; } export declare function analyzeCoverage(projectPath: string, config?: Partial<CoverageConfig>): Promise<CoverageResult>; export declare function generateMissingTests(projectPath: string, config?: Partial<CoverageConfig>): Promise<TestFile[]>;