Documentation
¶
Overview ¶
Package tscov collects JavaScript and TypeScript coverage by running the package's own test runner with a JSON coverage reporter, then parsing the Istanbul `coverage-final.json` (or, as a fallback, `lcov.info`) it produces.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseIstanbul ¶
ParseIstanbul parses an Istanbul coverage-final.json document. Paths inside the document are absolute; files outside root are skipped.
func ParseLcov ¶
ParseLcov parses an lcov.info document. It is the fallback when a runner wrote only the lcov reporter.
lcov records a function's declaration line and hit count, but no body range, so functions parsed from lcov report lines as unmeasured rather than attributing arbitrary lines to them.
Types ¶
type Options ¶
type Options struct {
// Root is the absolute scan root, used to make reported paths relative.
Root string
// WorkDir receives one coverage directory per package.
WorkDir string
// Printer receives progress and diagnostics.
Printer *ui.Printer
}
Options configures a collection run.
type Result ¶
type Result struct {
Dir string
Rel string
Runner string
Files []model.FileCoverage
Warnings []string
Command string
ExitCode int
Output string
Err error
}
Result is the outcome for one Node package. A Result is always returned, even when the runner failed: cover100 reports what it can and records the failure as a warning instead of discarding the package.