Documentation
¶
Index ¶
- Variables
- func Command() cli.Command
- func Discover(root string, globs []string) ([]string, error)
- func Run(ctx context.Context, o Options) int
- func Serve(ctx context.Context, root string, suite Suite, port int, dist bool, ...) int
- func SuiteNames() []string
- type BrowserReport
- type ErrInfo
- type FileError
- type FileReport
- type Options
- type Server
- type Suite
- type TestResult
Constants ¶
This section is empty.
Variables ¶
var Suites = map[string]Suite{ "main": { Name: "main", Globs: []string{"test/tests/**/*.js"}, TimeoutMS: 2000, // contains filtered or unexported fields }, }
Suites are the browser suites of the repository. The "e2e" suite is not here: it drives the example app, see internal/e2e.
Functions ¶
func Discover ¶
Discover lists the files below root (as slash separated paths relative to root) that match any of the globs, sorted. node_modules and .git are skipped.
func Run ¶
Run executes the suite in every requested browser and returns the exit code: 0 when every test passed in every browser that ran, 1 when a test failed or nothing could run.
func Serve ¶
func Serve(ctx context.Context, root string, suite Suite, port int, dist bool, out, errw io.Writer) int
Serve serves the repository root until ctx ends. Pages are at http://localhost:PORT/<path>, for example /test/manual/sse.html.
func SuiteNames ¶
func SuiteNames() []string
SuiteNames lists the names of the browser suites plus the e2e suite.
Types ¶
type BrowserReport ¶
type BrowserReport struct {
Browser string
Label string
Files []FileReport
Duration time.Duration
}
BrowserReport is the outcome of a suite in one browser.
func (BrowserReport) Totals ¶
func (b BrowserReport) Totals() (files, passed, failed, skipped int)
Totals of a browser report.
type ErrInfo ¶
type ErrInfo struct {
Name string `json:"name"`
Message string `json:"message"`
Stack string `json:"stack"`
}
ErrInfo is a failure as the page reports it.
type FileError ¶
FileError is a failure that belongs to the file and not to one test: a hook, a module that did not load, a timeout, a crashed page.
type FileReport ¶
type FileReport struct {
File string
Tests []TestResult
Errors []FileError
Duration time.Duration
Logs []string
}
FileReport is the outcome of one test file in one browser.
func (FileReport) Counts ¶
func (f FileReport) Counts() (passed, failed, skipped int)
Counts of a report.
type Options ¶
type Options struct {
Root string
Suite Suite
Files []string // overrides the globs of the suite when not empty
Browsers []string
Concurrency int
Grep string
Dist bool // serve the built dist/ files in place of src/
Port int
Timeout time.Duration // per test file
Verbose bool
Headed bool
Logs bool
ChromePath string
// Open starts a browser; nil means browsers.Open. Tests replace it.
Open func(ctx context.Context, name string, opts browsers.Options) (browsers.Browser, error)
Out io.Writer
Err io.Writer
IsTTY bool
Env func(string) string
}
Options configure a browser run of a suite.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server serves the files of the repository the tests need, the vendored mocha and chai, the test pages and the endpoint where pages report their results. It answers only to the host names of the loopback address it listens on, and never follows a symlink out of the repository root.
type Suite ¶
type Suite struct {
Name string
// Globs select the test files, relative to the repository root.
Globs []string
// Timeout is the mocha timeout of one test in milliseconds.
TimeoutMS int
// contains filtered or unexported fields
}
Suite describes one test suite: which files it runs and the page every file runs in.