tscov

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

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

func ParseIstanbul(data []byte, root string) ([]model.FileCoverage, []string, error)

ParseIstanbul parses an Istanbul coverage-final.json document. Paths inside the document are absolute; files outside root are skipped.

func ParseLcov

func ParseLcov(data []byte, root string) ([]model.FileCoverage, []string, error)

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.

func Run

func Run(ctx context.Context, p detect.Project, opts Options, index int) *Result

Run executes the package's tests with coverage and parses the report.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL