1.0.0-alpha.1
.createReportSource(a, coverageMap, [opts])
returns a report source for the supplied coverage map and options
returns a report source for the supplied coverage map and options
CoverageMap
a
:
coverage map
[Object
]
opts
(default null
)
:
report source options
ReportSource
.summarizers
standard summary functions
standard summary functions
.getDefaultWatermarks
returns the default watermarks that would be used when not overridden
returns the default watermarks that would be used when not overridden
Object
:
an object with statements
, functions
, branches
,
and line
keys. Each value is a 2 element array that has the low and
high watermark as percentages.
Extends ContentWriter
a content writer that writes to the console
abstract interface for writing content
#colorize(str, clazz)
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.
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.
String
:
the colorized form of the string
#println(str)
writes a string appended with a newline to the destination
writes a string appended with a newline to the destination
String
str
:
the string to write
#write(str)
writes a string as-is to the destination
writes a string as-is to the destination
String
str
:
the string to write
A reporting context that is passed to report implementations
[Object
]
opts
(default null
)
:
opts options
[String
]
opts.dir
(default 'coverage'
)
opts.dir the reporting directory
[Object
]
opts.watermarks
(default null
)
opts.watermarks watermarks for statements, lines, branches and functions
[Function
]
opts.sourceFinder
(default fsLookup
)
opts.sourceFinder a function that returns source code given a file path. Defaults to filesystem lookups based on path.
#getXMLWriter(contentWriter)
returns an XML writer for the supplied content writer
returns an XML writer for the supplied content writer
ContentWriter
contentWriter
:
the content writer to which the returned XML writer writes data
XMLWriter
Extends ContentWriter
a content writer that writes to a file
Number
fd
:
the file descriptor
utility for writing files under a specific directory
String
baseDir
:
the base directory under which files should be written
#writeFile(file)
returns a content writer for writing content to the supplied file.
returns a content writer for writing content to the supplied file.
String
or file
:
the relative path to the file or the special
values "-"
or null
for writing to the console
ContentWriter
#writerForDir(subdir)
returns a FileWriter that is rooted at the supplied subdirectory
returns a FileWriter that is rooted at the supplied subdirectory
String
subdir
:
the subdirectory under which to root the returned FileWriter
FileWriter
abstract base class for a coverage tree.
An object with methods that are called during the traversal of the coverage tree. A visitor has the following methods that are called during tree traversal.
onStart(root, state)
- called before traversal beginsonSummary(node, state)
- called for every summary nodeonDetail(node, state)
- called for every detail nodeonSummaryEnd(node, state)
- called after all children have been visited for
a summary node.onEnd(root, state)
- called after traversal endsa partial visitor that only implements the methods of interest
The visitor object supplies the missing methods as noops. For example, reports
that only need the final coverage summary need implement onStart
and nothing
else. Reports that use only detailed coverage information need implement onDetail
and nothing else.
a utility class to produce well-formed, indented XML
ContentWriter
contentWriter
:
the content writer that this utility wraps
#closeTag(name)
closes an open XML tag.
closes an open XML tag.
String
name
:
tag name to close. This must match the writer's notion of the tag that is currently open.