Documentation
¶
Overview ¶
Package serve starts cover100's local static server and opens the report in the user's browser.
The server is bound to loopback only: the report describes a private codebase, and nothing about viewing it requires exposing it to the network.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenBrowser ¶
OpenBrowser opens url in the platform's default browser. It returns an error only when no launcher could be started; a launcher that starts but fails is the user's environment, not a cover100 failure, so the URL is always printed.
Types ¶
type Options ¶
type Options struct {
// Assets is a filesystem rooted at the public directory.
Assets fs.FS
// DataPath is the absolute path of the report JSON to serve.
DataPath string
// DataRoute is the URL path the report is served at, e.g. "/coverage.json".
DataRoute string
// Host defaults to 127.0.0.1.
Host string
// Port is the preferred port; the server walks forward from it when busy.
Port int
// Printer receives the bound URL and diagnostics.
Printer *ui.Printer
}
Options configures the server.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a running static server.
func Start ¶
Start binds the server and returns it ready to Serve. The returned URL is the address the browser should open, including the data query parameter.