Documentation
¶
Overview ¶
Package detect finds the coverage collection targets under a directory: Go modules (a go.mod file) and Node packages (a package.json file).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Project ¶
type Project struct {
// Dir is the absolute directory holding the manifest.
Dir string
// Rel is Dir relative to the scan root, slash-separated; "." for the root
// itself.
Rel string
Kind Kind
// Go module path, read from the go.mod module directive.
ModulePath string
// Node package metadata.
PackageName string
TestScript string
HasTestScript bool
// Runner is "vitest", "jest" or "" when no known runner could be inferred.
Runner string
// HasNodeModules reports whether a node_modules directory sits beside the
// manifest, which determines whether a local runner binary can be used.
HasNodeModules bool
}
Project is one coverage collection target.
type Result ¶
type Result struct {
Root string
Projects []Project
// HasTypeScript and HasJavaScript record whether the tree contains files of
// those kinds at all, independent of whether any of them are runnable.
HasTypeScript bool
HasJavaScript bool
}
Result is the outcome of a scan.
func Scan ¶
Scan walks root and returns every Go module and Node package it finds.
Hidden directories are skipped (which covers .git, .cover100 and editor state), as are node_modules and vendor. Unreadable subtrees are skipped rather than failing the scan: a permission error deep in a tree should not prevent collecting coverage from everything else.
func (*Result) NodePackages ¶
NodePackages returns the detected Node projects that declare a test script.