UNPKG

2.22 kBTypeScriptView Raw
1// Type definitions for istanbul-reports 3.0
2// Project: https://github.com/istanbuljs/istanbuljs, https://istanbul.js.org
3// Definitions by: Jason Cheatham <https://github.com/jason0x43>
4// Elena Shcherbakova <https://github.com/not-a-doctor>
5// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
6// TypeScript Version: 2.4
7
8import { Node, ReportBase } from 'istanbul-lib-report';
9
10export function create<T extends keyof ReportOptions>(name: T, options?: Partial<ReportOptions[T]>): ReportBase;
11
12export interface FileOptions {
13 file: string;
14}
15
16export interface ProjectOptions {
17 projectRoot: string;
18}
19
20export interface ReportOptions {
21 clover: CloverOptions;
22 cobertura: CoberturaOptions;
23 'html-spa': HtmlSpaOptions;
24 html: HtmlOptions;
25 json: JsonOptions;
26 'json-summary': JsonSummaryOptions;
27 lcov: LcovOptions;
28 lcovonly: LcovOnlyOptions;
29 none: never;
30 teamcity: TeamcityOptions;
31 text: TextOptions;
32 'text-lcov': TextLcovOptions;
33 'text-summary': TextSummaryOptions;
34}
35
36export type ReportType = keyof ReportOptions;
37
38export interface CloverOptions extends FileOptions, ProjectOptions {}
39
40export interface CoberturaOptions extends FileOptions, ProjectOptions {}
41
42export interface HtmlSpaOptions extends HtmlOptions {
43 metricsToShow: Array<'lines' | 'branches' | 'functions' | 'statements'>;
44}
45export interface HtmlOptions {
46 verbose: boolean;
47 skipEmpty: boolean;
48 subdir: string;
49 linkMapper: LinkMapper;
50}
51
52export type JsonOptions = FileOptions;
53export type JsonSummaryOptions = FileOptions;
54
55export interface LcovOptions extends FileOptions, ProjectOptions {}
56export interface LcovOnlyOptions extends FileOptions, ProjectOptions {}
57
58export interface TeamcityOptions extends FileOptions {
59 blockName: string;
60}
61
62export interface TextOptions extends FileOptions {
63 maxCols: number;
64 skipEmpty: boolean;
65 skipFull: boolean;
66}
67export type TextLcovOptions = ProjectOptions;
68export type TextSummaryOptions = FileOptions;
69
70export interface LinkMapper {
71 getPath(node: string | Node): string;
72 relativePath(source: string | Node, target: string | Node): string;
73 assetPath(node: Node, name: string): string;
74}