@types/istanbul-lib-report
Advanced tools
Comparing version 1.1.1 to 3.0.0
@@ -1,4 +0,5 @@ | ||
// Type definitions for istanbul-lib-report 1.1 | ||
// Type definitions for istanbul-lib-report 3.0 | ||
// Project: https://istanbul.js.org, https://github.com/istanbuljs/istanbuljs | ||
// Definitions by: Jason Cheatham <https://github.com/jason0x43> | ||
// Zacharias Björngren <https://github.com/zache> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
@@ -9,75 +10,183 @@ // TypeScript Version: 2.4 | ||
/** | ||
* returns a reporting context for the supplied options | ||
*/ | ||
export function createContext(options?: Partial<ContextOptions>): Context; | ||
/** | ||
* returns the default watermarks that would be used when not | ||
* overridden | ||
*/ | ||
export function getDefaultWatermarks(): Watermarks; | ||
export class ReportBase { | ||
constructor(options?: Partial<ReportBaseOptions>); | ||
execute(context: Context): void; | ||
} | ||
export const summarizers: { | ||
flat(coverageMap: CoverageMap): Tree; | ||
nested(coverageMap: CoverageMap): Tree; | ||
pkg(coverageMap: CoverageMap): Tree; | ||
}; | ||
export interface ReportBaseOptions { | ||
summarizer: Summarizers; | ||
} | ||
export type Summarizers = 'flat' | 'nested' | 'pkg' | 'defaultSummarizer'; | ||
export interface ContextOptions { | ||
dir: string; | ||
watermarks: Watermarks; | ||
sourceFinder(filepath: string): string; | ||
coverageMap: CoverageMap; | ||
defaultSummarizer: Summarizers; | ||
dir: string; | ||
watermarks: Partial<Watermarks>; | ||
sourceFinder(filepath: string): string; | ||
} | ||
export interface Context extends ContextOptions { | ||
data: any; | ||
writer: FileWriter; | ||
export interface Context { | ||
data: any; | ||
dir: string; | ||
sourceFinder(filepath: string): string; | ||
watermarks: Watermarks; | ||
writer: FileWriter; | ||
/** | ||
* returns the coverage class given a coverage | ||
* types and a percentage value. | ||
*/ | ||
classForPercent(type: keyof Watermarks, value: number): string; | ||
/** | ||
* returns the source code for the specified file path or throws if | ||
* the source could not be found. | ||
*/ | ||
getSource(filepath: string): string; | ||
getTree(summarizer?: Summarizers): Tree; | ||
/** | ||
* returns a full visitor given a partial one. | ||
*/ | ||
getVisitor<N extends Node = Node>(visitor: Partial<Visitor<N>>): Visitor<N>; | ||
/** | ||
* returns a FileWriter implementation for reporting use. Also available | ||
* as the `writer` property on the context. | ||
*/ | ||
getWriter(): FileWriter; | ||
/** | ||
* returns an XML writer for the supplied content writer | ||
*/ | ||
getXmlWriter(contentWriter: ContentWriter): XmlWriter; | ||
} | ||
export interface ContentWriter { | ||
write(str: string): void; | ||
colorize(str: string, cls?: string): string; | ||
println(str: string): void; | ||
close(): void; | ||
/** | ||
* Base class for writing content | ||
*/ | ||
export class ContentWriter { | ||
/** | ||
* returns the colorized version of a string. Typically, | ||
* content writers that write to files will return the | ||
* same string and ones writing to a tty will wrap it in | ||
* appropriate escape sequences. | ||
*/ | ||
colorize(str: string, clazz?: string): string; | ||
/** | ||
* writes a string appended with a newline to the destination | ||
*/ | ||
println(str: string): void; | ||
/** | ||
* closes this content writer. Should be called after all writes are complete. | ||
*/ | ||
close(): void; | ||
} | ||
export interface FileWriter { | ||
writeForDir(subdir: string): FileWriter; | ||
copyFile(source: string, dest: string): void; | ||
writeFile(file: string | null): ContentWriter; | ||
/** | ||
* a content writer that writes to a file | ||
*/ | ||
export class FileContentWriter extends ContentWriter { | ||
constructor(fileDescriptor: number); | ||
write(str: string): void; | ||
} | ||
/** | ||
* a content writer that writes to the console | ||
*/ | ||
export class ConsoleWriter extends ContentWriter { | ||
write(str: string): void; | ||
} | ||
/** | ||
* utility for writing files under a specific directory | ||
*/ | ||
export class FileWriter { | ||
constructor(baseDir: string); | ||
static startCapture(): void; | ||
static stopCapture(): void; | ||
static getOutput(): string; | ||
static resetOutput(): void; | ||
/** | ||
* returns a FileWriter that is rooted at the supplied subdirectory | ||
*/ | ||
writeForDir(subdir: string): FileWriter; | ||
/** | ||
* copies a file from a source directory to a destination name | ||
*/ | ||
copyFile(source: string, dest: string, header?: string): void; | ||
/** | ||
* returns a content writer for writing content to the supplied file. | ||
*/ | ||
writeFile(file: string | null): ContentWriter; | ||
} | ||
export interface XmlWriter { | ||
indent(str: string): string; | ||
/** | ||
* writes the opening XML tag with the supplied attributes | ||
*/ | ||
openTag(name: string, attrs?: any): void; | ||
/** | ||
* closes an open XML tag. | ||
*/ | ||
closeTag(name: string): void; | ||
/** | ||
* writes a tag and its value opening and closing it at the same time | ||
*/ | ||
inlineTag(name: string, attrs?: any, content?: string): void; | ||
/** | ||
* closes all open tags and ends the document | ||
*/ | ||
closeAll(): void; | ||
} | ||
export type Watermark = [number, number]; | ||
export interface Watermarks { | ||
statements: number[]; | ||
functions: number[]; | ||
branches: number[]; | ||
lines: number[]; | ||
statements: Watermark; | ||
functions: Watermark; | ||
branches: Watermark; | ||
lines: Watermark; | ||
} | ||
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; | ||
isRoot(): boolean; | ||
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; | ||
path: string; | ||
parent: ReportNode | null; | ||
fileCoverage: FileCoverage; | ||
children: ReportNode[]; | ||
addChild(child: ReportNode): void; | ||
asRelative(p: string): string; | ||
getQualifiedName(): string; | ||
getRelativeName(): string; | ||
getParent(): Node; | ||
getChildren(): Node[]; | ||
isSummary(): boolean; | ||
getFileCoverage(): FileCoverage; | ||
getCoverageSummary(filesOnly: boolean): CoverageSummary; | ||
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; | ||
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; | ||
getRoot(): N; | ||
visit(visitor: Partial<Visitor<N>>, state: any): void; | ||
} |
{ | ||
"name": "@types/istanbul-lib-report", | ||
"version": "1.1.1", | ||
"version": "3.0.0", | ||
"description": "TypeScript definitions for istanbul-lib-report", | ||
@@ -11,6 +11,11 @@ "license": "MIT", | ||
"githubUsername": "jason0x43" | ||
}, | ||
{ | ||
"name": "Zacharias Björngren", | ||
"url": "https://github.com/zache", | ||
"githubUsername": "zache" | ||
} | ||
], | ||
"main": "", | ||
"types": "index", | ||
"types": "index.d.ts", | ||
"repository": { | ||
@@ -25,4 +30,4 @@ "type": "git", | ||
}, | ||
"typesPublisherContentHash": "64af305d196bdbb3cc44bc664daf0546df5c55bce234d53c29f97d0883da2f32", | ||
"typeScriptVersion": "2.4" | ||
"typesPublisherContentHash": "f8b2f5e15a24d9f52a96c5cfadb0f582bf6200ce8643e15422c3c8f1a2bb1c63", | ||
"typeScriptVersion": "2.8" | ||
} |
@@ -5,13 +5,13 @@ # Installation | ||
# Summary | ||
This package contains type definitions for istanbul-lib-report ( https://istanbul.js.org ). | ||
This package contains type definitions for istanbul-lib-report (https://istanbul.js.org). | ||
# Details | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-lib-report | ||
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/istanbul-lib-report. | ||
Additional Details | ||
* Last updated: Thu, 25 Apr 2019 23:07:44 GMT | ||
* Dependencies: @types/istanbul-lib-coverage | ||
### Additional Details | ||
* Last updated: Tue, 21 Jan 2020 01:00:06 GMT | ||
* Dependencies: [@types/istanbul-lib-coverage](https://npmjs.com/package/@types/istanbul-lib-coverage) | ||
* Global values: none | ||
# Credits | ||
These definitions were written by Jason Cheatham <https://github.com/jason0x43>. | ||
These definitions were written by Jason Cheatham (https://github.com/jason0x43), and Zacharias Björngren (https://github.com/zache). |
8226
174