• Version 3.0.3
  • Published
  • 7.92 kB
  • 1 dependency
  • MIT license


npm i @types/istanbul-lib-report
yarn add @types/istanbul-lib-report
pnpm add @types/istanbul-lib-report


TypeScript definitions for istanbul-lib-report



function createContext

createContext: (options?: Partial<ContextOptions>) => Context;
  • returns a reporting context for the supplied options

function getDefaultWatermarks

getDefaultWatermarks: () => Watermarks;
  • returns the default watermarks that would be used when not overridden


class ConsoleWriter

class ConsoleWriter extends ContentWriter {}
  • a content writer that writes to the console

method write

write: (str: string) => void;

    class ContentWriter

    class ContentWriter {}
    • Base class for writing content

    method close

    close: () => void;
    • closes this content writer. Should be called after all writes are complete.

    method colorize

    colorize: (str: string, clazz?: string) => string;
    • 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.

    method println

    println: (str: string) => void;
    • writes a string appended with a newline to the destination

    class FileContentWriter

    class FileContentWriter extends ContentWriter {}
    • a content writer that writes to a file


    constructor(fileDescriptor: number);

      method write

      write: (str: string) => void;

        class FileWriter

        class FileWriter {}
        • utility for writing files under a specific directory


        constructor(baseDir: string);

          method copyFile

          copyFile: (source: string, dest: string, header?: string) => void;
          • copies a file from a source directory to a destination name

          method getOutput

          static getOutput: () => string;

            method resetOutput

            static resetOutput: () => void;

              method startCapture

              static startCapture: () => void;

                method stopCapture

                static stopCapture: () => void;

                  method writeFile

                  writeFile: (file: string | null) => ContentWriter;
                  • returns a content writer for writing content to the supplied file.

                  method writeForDir

                  writeForDir: (subdir: string) => FileWriter;
                  • returns a FileWriter that is rooted at the supplied subdirectory

                  class ReportBase

                  class ReportBase {}


                    constructor(options?: Partial<ReportBaseOptions>);

                      method execute

                      execute: (context: Context) => void;


                        interface Context

                        interface Context {}

                          property data

                          data: any;

                            property dir

                            dir: string;

                              property watermarks

                              watermarks: Watermarks;

                                property writer

                                writer: FileWriter;

                                  method classForPercent

                                  classForPercent: (type: keyof Watermarks, value: number) => string;
                                  • returns the coverage class given a coverage types and a percentage value.

                                  method getSource

                                  getSource: (filepath: string) => string;
                                  • returns the source code for the specified file path or throws if the source could not be found.

                                  method getTree

                                  getTree: (summarizer?: Summarizers) => Tree;

                                    method getVisitor

                                    getVisitor: <N extends Node = Node>(visitor: Partial<Visitor<N>>) => Visitor<N>;
                                    • returns a full visitor given a partial one.

                                    method getWriter

                                    getWriter: () => FileWriter;
                                    • returns a FileWriter implementation for reporting use. Also available as the writer property on the context.

                                    method getXmlWriter

                                    getXmlWriter: (contentWriter: ContentWriter) => XmlWriter;
                                    • returns an XML writer for the supplied content writer

                                    method sourceFinder

                                    sourceFinder: (filepath: string) => string;

                                      interface ContextOptions

                                      interface ContextOptions {}

                                        property coverageMap

                                        coverageMap: CoverageMap;

                                          property defaultSummarizer

                                          defaultSummarizer: Summarizers;

                                            property dir

                                            dir: string;

                                              property watermarks

                                              watermarks: Partial<Watermarks>;

                                                method sourceFinder

                                                sourceFinder: (filepath: string) => string;

                                                  interface Node

                                                  interface Node {}

                                                    method isRoot

                                                    isRoot: () => boolean;

                                                      method visit

                                                      visit: (visitor: Visitor, state: any) => void;

                                                        interface ReportBaseOptions

                                                        interface ReportBaseOptions {}

                                                          property summarizer

                                                          summarizer: Summarizers;

                                                            interface ReportNode

                                                            interface ReportNode extends Node {}

                                                              property children

                                                              children: ReportNode[];

                                                                property fileCoverage

                                                                fileCoverage: FileCoverage;

                                                                  property parent

                                                                  parent: ReportNode | null;

                                                                    property path

                                                                    path: string;

                                                                      method addChild

                                                                      addChild: (child: ReportNode) => void;

                                                                        method asRelative

                                                                        asRelative: (p: string) => string;

                                                                          method getChildren

                                                                          getChildren: () => Node[];

                                                                            method getCoverageSummary

                                                                            getCoverageSummary: (filesOnly: boolean) => CoverageSummary;

                                                                              method getFileCoverage

                                                                              getFileCoverage: () => FileCoverage;

                                                                                method getParent

                                                                                getParent: () => Node;

                                                                                  method getQualifiedName

                                                                                  getQualifiedName: () => string;

                                                                                    method getRelativeName

                                                                                    getRelativeName: () => string;

                                                                                      method isSummary

                                                                                      isSummary: () => boolean;

                                                                                        method visit

                                                                                        visit: (visitor: Visitor<ReportNode>, state: any) => void;

                                                                                          interface Tree

                                                                                          interface Tree<N extends Node = Node> {}

                                                                                            method getRoot

                                                                                            getRoot: () => N;

                                                                                              method visit

                                                                                              visit: (visitor: Partial<Visitor<N>>, state: any) => void;

                                                                                                interface Visitor

                                                                                                interface Visitor<N extends Node = Node> {}

                                                                                                  method onDetail

                                                                                                  onDetail: (root: N, state: any) => void;

                                                                                                    method onEnd

                                                                                                    onEnd: (root: N, state: any) => void;

                                                                                                      method onStart

                                                                                                      onStart: (root: N, state: any) => void;

                                                                                                        method onSummary

                                                                                                        onSummary: (root: N, state: any) => void;

                                                                                                          method onSummaryEnd

                                                                                                          onSummaryEnd: (root: N, state: any) => void;

                                                                                                            interface Watermarks

                                                                                                            interface Watermarks {}

                                                                                                              property branches

                                                                                                              branches: Watermark;

                                                                                                                property functions

                                                                                                                functions: Watermark;

                                                                                                                  property lines

                                                                                                                  lines: Watermark;

                                                                                                                    property statements

                                                                                                                    statements: Watermark;

                                                                                                                      interface XmlWriter

                                                                                                                      interface XmlWriter {}

                                                                                                                        method closeAll

                                                                                                                        closeAll: () => void;
                                                                                                                        • closes all open tags and ends the document

                                                                                                                        method closeTag

                                                                                                                        closeTag: (name: string) => void;
                                                                                                                        • closes an open XML tag.

                                                                                                                        method indent

                                                                                                                        indent: (str: string) => string;

                                                                                                                          method inlineTag

                                                                                                                          inlineTag: (name: string, attrs?: any, content?: string) => void;
                                                                                                                          • writes a tag and its value opening and closing it at the same time

                                                                                                                          method openTag

                                                                                                                          openTag: (name: string, attrs?: any) => void;
                                                                                                                          • writes the opening XML tag with the supplied attributes

                                                                                                                          Type Aliases

                                                                                                                          type Summarizers

                                                                                                                          type Summarizers = 'flat' | 'nested' | 'pkg' | 'defaultSummarizer';

                                                                                                                            type Watermark

                                                                                                                            type Watermark = [number, number];

                                                                                                                              Package Files (1)

                                                                                                                              Dependencies (1)

                                                                                                                              Dev Dependencies (0)

                                                                                                                              No dev dependencies.

                                                                                                                              Peer Dependencies (0)

                                                                                                                              No peer dependencies.


                                                                                                                              To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                              You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/istanbul-lib-report.

                                                                                                                              • Markdown
                                                                                                                              • HTML
                                                                                                                                <a href="https://www.jsdocs.io/package/@types/istanbul-lib-report"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>