333
schangxiang@126.com
2025-09-19 18966e02fb573c7e2bb0c6426ed792b38b910940
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Type definitions for istanbul-lib-report 1.1
// Project: https://istanbul.js.org, https://github.com/istanbuljs/istanbuljs
// Definitions by: Jason Cheatham <https://github.com/jason0x43>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
 
import { CoverageMap, FileCoverage, CoverageSummary } from 'istanbul-lib-coverage';
 
export function createContext(options?: Partial<ContextOptions>): Context;
export function getDefaultWatermarks(): Watermarks;
 
export const summarizers: {
    flat(coverageMap: CoverageMap): Tree;
    nested(coverageMap: CoverageMap): Tree;
    pkg(coverageMap: CoverageMap): Tree;
};
 
export interface ContextOptions {
    dir: string;
    watermarks: Watermarks;
    sourceFinder(filepath: string): string;
}
 
export interface Context extends ContextOptions {
    data: any;
    writer: FileWriter;
}
 
export interface ContentWriter {
    write(str: string): void;
    colorize(str: string, cls?: string): string;
    println(str: string): void;
    close(): void;
}
 
export interface FileWriter {
    writeForDir(subdir: string): FileWriter;
    copyFile(source: string, dest: string): void;
    writeFile(file: string | null): ContentWriter;
}
 
export interface Watermarks {
    statements: number[];
    functions: number[];
    branches: number[];
    lines: number[];
}
 
export interface Node {
    getQualifiedName(): string;
    getRelativeName(): string;
    isRoot(): boolean;
    getParent(): Node;
    getChildren(): Node[];
    isSummary(): boolean;
    getCoverageSummary(filesOnly: boolean): CoverageSummary;
    getFileCoverage(): FileCoverage;
    visit(visitor: Visitor, state: any): void;
}
 
export interface ReportNode extends Node {
    path: string;
    parent: ReportNode | null;
    fileCoverage: FileCoverage;
    children: ReportNode[];
    addChild(child: ReportNode): void;
    asRelative(p: string): string;
    visit(visitor: Visitor<ReportNode>, state: any): void;
}
 
export interface Visitor<N extends Node = Node> {
    onStart(root: N, state: any): void;
    onSummary(root: N, state: any): void;
    onDetail(root: N, state: any): void;
    onSummaryEnd(root: N, state: any): void;
    onEnd(root: N, state: any): void;
}
 
export interface Tree<N extends Node = Node> {
    getRoot(): N;
    visit(visitor: Partial<Visitor<N>>, state: any): void;
}