types

package
v2.20.2 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2024 License: MIT Imports: 17 Imported by: 83

Documentation

Index

Constants

View Source
const GINKGO_FOCUS_EXIT_CODE = 197
View Source
const GINKGO_TIME_FORMAT = "01/02/06 15:04:05.999"
View Source
const VERSION = "2.20.2"

Variables

View Source
var (
	SpecComponentTypeInvalid                 = NodeTypeInvalid
	SpecComponentTypeContainer               = NodeTypeContainer
	SpecComponentTypeIt                      = NodeTypeIt
	SpecComponentTypeBeforeEach              = NodeTypeBeforeEach
	SpecComponentTypeJustBeforeEach          = NodeTypeJustBeforeEach
	SpecComponentTypeAfterEach               = NodeTypeAfterEach
	SpecComponentTypeJustAfterEach           = NodeTypeJustAfterEach
	SpecComponentTypeBeforeSuite             = NodeTypeBeforeSuite
	SpecComponentTypeSynchronizedBeforeSuite = NodeTypeSynchronizedBeforeSuite
	SpecComponentTypeAfterSuite              = NodeTypeAfterSuite
	SpecComponentTypeSynchronizedAfterSuite  = NodeTypeSynchronizedAfterSuite
)
View Source
var DEBUG_LABEL_FILTER_PARSING = false
View Source
var Deprecations = deprecations{}
View Source
var FlagSections = GinkgoFlagSections{
	{Key: "multiple-suites", Style: "{{dark-green}}", Heading: "Running Multiple Test Suites"},
	{Key: "order", Style: "{{green}}", Heading: "Controlling Test Order"},
	{Key: "parallel", Style: "{{yellow}}", Heading: "Controlling Test Parallelism"},
	{Key: "low-level-parallel", Style: "{{yellow}}", Heading: "Controlling Test Parallelism",
		Description: "These are set by the Ginkgo CLI, {{red}}{{bold}}do not set them manually{{/}} via go test.\nUse ginkgo -p or ginkgo -procs=N instead."},
	{Key: "filter", Style: "{{cyan}}", Heading: "Filtering Tests"},
	{Key: "failure", Style: "{{red}}", Heading: "Failure Handling"},
	{Key: "output", Style: "{{magenta}}", Heading: "Controlling Output Formatting"},
	{Key: "code-and-coverage-analysis", Style: "{{orange}}", Heading: "Code and Coverage Analysis"},
	{Key: "performance-analysis", Style: "{{coral}}", Heading: "Performance Analysis"},
	{Key: "debug", Style: "{{blue}}", Heading: "Debugging Tests",
		Description: "In addition to these flags, Ginkgo supports a few debugging environment variables.  To change the parallel server protocol set {{blue}}GINKGO_PARALLEL_PROTOCOL{{/}} to {{bold}}HTTP{{/}}.  To avoid pruning callstacks set {{blue}}GINKGO_PRUNE_STACK{{/}} to {{bold}}FALSE{{/}}."},
	{Key: "watch", Style: "{{light-yellow}}", Heading: "Controlling Ginkgo Watch"},
	{Key: "misc", Style: "{{light-gray}}", Heading: "Miscellaneous"},
	{Key: "go-build", Style: "{{light-gray}}", Heading: "Go Build Flags", Succinct: true,
		Description: "These flags are inherited from go build.  Run {{bold}}ginkgo help build{{/}} for more detailed flag documentation."},
}

Flags sections used by both the CLI and the Ginkgo test process

View Source
var GinkgoCLIRunAndWatchFlags = GinkgoFlags{
	{KeyPath: "C.Procs", Name: "procs", SectionKey: "parallel", UsageDefaultValue: "1 (run in series)",
		Usage: "The number of parallel test nodes to run."},
	{KeyPath: "C.Procs", Name: "nodes", SectionKey: "parallel", UsageDefaultValue: "1 (run in series)",
		Usage: "--nodes is an alias for --procs"},
	{KeyPath: "C.Parallel", Name: "p", SectionKey: "parallel",
		Usage: "If set, ginkgo will run in parallel with an auto-detected number of nodes."},
	{KeyPath: "C.AfterRunHook", Name: "after-run-hook", SectionKey: "misc", DeprecatedName: "afterSuiteHook", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "Command to run when a test suite completes."},
	{KeyPath: "C.OutputDir", Name: "output-dir", SectionKey: "output", UsageArgument: "directory", DeprecatedName: "outputdir", DeprecatedDocLink: "improved-profiling-support",
		Usage: "A location to place all generated profiles and reports."},
	{KeyPath: "C.KeepSeparateCoverprofiles", Name: "keep-separate-coverprofiles", SectionKey: "code-and-coverage-analysis",
		Usage: "If set, Ginkgo does not merge coverprofiles into one monolithic coverprofile.  The coverprofiles will remain in their respective package directories or in -output-dir if set."},
	{KeyPath: "C.KeepSeparateReports", Name: "keep-separate-reports", SectionKey: "output",
		Usage: "If set, Ginkgo does not merge per-suite reports (e.g. -json-report) into one monolithic report for the entire testrun.  The reports will remain in their respective package directories or in -output-dir if set."},

	{KeyPath: "D.Stream", DeprecatedName: "stream", DeprecatedDocLink: "removed--stream", DeprecatedVersion: "2.0.0"},
	{KeyPath: "D.Notify", DeprecatedName: "notify", DeprecatedDocLink: "removed--notify", DeprecatedVersion: "2.0.0"},
}

GinkgoCLIRunAndWatchFlags provides flags shared by the Ginkgo CLI's build and watch commands (but not run)

View Source
var GinkgoCLIRunFlags = GinkgoFlags{
	{KeyPath: "C.KeepGoing", Name: "keep-going", SectionKey: "multiple-suites", DeprecatedName: "keepGoing", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "If set, failures from earlier test suites do not prevent later test suites from running."},
	{KeyPath: "C.UntilItFails", Name: "until-it-fails", SectionKey: "debug", DeprecatedName: "untilItFails", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "If set, ginkgo will keep rerunning test suites until a failure occurs."},
	{KeyPath: "C.Repeat", Name: "repeat", SectionKey: "debug", UsageArgument: "n", UsageDefaultValue: "0 - i.e. no repetition, run only once",
		Usage: "The number of times to re-run a test-suite.  Useful for debugging flaky tests.  If set to N the suite will be run N+1 times and will be required to pass each time."},
	{KeyPath: "C.RandomizeSuites", Name: "randomize-suites", SectionKey: "order", DeprecatedName: "randomizeSuites", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "If set, ginkgo will randomize the order in which test suites run."},
}

GinkgoCLIRunFlags provides flags for Ginkgo CLI's run command that aren't shared by any other commands

View Source
var GinkgoCLISharedFlags = GinkgoFlags{
	{KeyPath: "C.Recurse", Name: "r", SectionKey: "multiple-suites",
		Usage: "If set, ginkgo finds and runs test suites under the current directory recursively."},
	{KeyPath: "C.SkipPackage", Name: "skip-package", SectionKey: "multiple-suites", DeprecatedName: "skipPackage", DeprecatedDocLink: "changed-command-line-flags",
		UsageArgument: "comma-separated list of packages",
		Usage:         "A comma-separated list of package names to be skipped.  If any part of the package's path matches, that package is ignored."},
	{KeyPath: "C.RequireSuite", Name: "require-suite", SectionKey: "failure", DeprecatedName: "requireSuite", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "If set, Ginkgo fails if there are ginkgo tests in a directory but no invocation of RunSpecs."},
	{KeyPath: "C.NumCompilers", Name: "compilers", SectionKey: "multiple-suites", UsageDefaultValue: "0 (will autodetect)",
		Usage: "When running multiple packages, the number of concurrent compilations to perform."},
}

GinkgoCLISharedFlags provides flags shared by the Ginkgo CLI's build, watch, and run commands

View Source
var GinkgoCLIWatchFlags = GinkgoFlags{
	{KeyPath: "C.Depth", Name: "depth", SectionKey: "watch",
		Usage: "Ginkgo will watch dependencies down to this depth in the dependency tree."},
	{KeyPath: "C.WatchRegExp", Name: "watch-regexp", SectionKey: "watch", DeprecatedName: "watchRegExp", DeprecatedDocLink: "changed-command-line-flags",
		UsageArgument:     "Regular Expression",
		UsageDefaultValue: `\.go$`,
		Usage:             "Only files matching this regular expression will be watched for changes."},
}

GinkgoCLIRunFlags provides flags for Ginkgo CLI's watch command that aren't shared by any other commands

View Source
var GinkgoErrors = ginkgoErrors{}
View Source
var GoBuildFlags = GinkgoFlags{
	{KeyPath: "Go.Race", Name: "race", SectionKey: "code-and-coverage-analysis",
		Usage: "enable data race detection. Supported on linux/amd64, linux/ppc64le, linux/arm64, linux/s390x, freebsd/amd64, netbsd/amd64, darwin/amd64, darwin/arm64, and windows/amd64."},
	{KeyPath: "Go.Vet", Name: "vet", UsageArgument: "list", SectionKey: "code-and-coverage-analysis",
		Usage: `Configure the invocation of "go vet" during "go test" to use the comma-separated list of vet checks.  If list is empty, "go test" runs "go vet" with a curated list of checks believed to be always worth addressing.  If list is "off", "go test" does not run "go vet" at all.  Available checks can be found by running 'go doc cmd/vet'`},
	{KeyPath: "Go.Cover", Name: "cover", SectionKey: "code-and-coverage-analysis",
		Usage: "Enable coverage analysis.	Note that because coverage works by annotating the source code before compilation, compilation and test failures with coverage enabled may report line numbers that don't correspond to the original sources."},
	{KeyPath: "Go.CoverMode", Name: "covermode", UsageArgument: "set,count,atomic", SectionKey: "code-and-coverage-analysis",
		Usage: `Set the mode for coverage analysis for the package[s] being tested. 'set': does this statement run? 'count': how many times does this statement run? 'atomic': like count, but correct in multithreaded tests and more expensive (must use atomic with -race). Sets -cover`},
	{KeyPath: "Go.CoverPkg", Name: "coverpkg", UsageArgument: "pattern1,pattern2,pattern3", SectionKey: "code-and-coverage-analysis",
		Usage: "Apply coverage analysis in each test to packages matching the patterns. 	The default is for each test to analyze only the package being tested. See 'go help packages' for a description of package patterns. Sets -cover."},

	{KeyPath: "Go.A", Name: "a", SectionKey: "go-build",
		Usage: "force rebuilding of packages that are already up-to-date."},
	{KeyPath: "Go.ASMFlags", Name: "asmflags", UsageArgument: "'[pattern=]arg list'", SectionKey: "go-build",
		Usage: "arguments to pass on each go tool asm invocation."},
	{KeyPath: "Go.BuildMode", Name: "buildmode", UsageArgument: "mode", SectionKey: "go-build",
		Usage: "build mode to use. See 'go help buildmode' for more."},
	{KeyPath: "Go.BuildVCS", Name: "buildvcs", SectionKey: "go-build",
		Usage: "adds version control information."},
	{KeyPath: "Go.Compiler", Name: "compiler", UsageArgument: "name", SectionKey: "go-build",
		Usage: "name of compiler to use, as in runtime.Compiler (gccgo or gc)."},
	{KeyPath: "Go.GCCGoFlags", Name: "gccgoflags", UsageArgument: "'[pattern=]arg list'", SectionKey: "go-build",
		Usage: "arguments to pass on each gccgo compiler/linker invocation."},
	{KeyPath: "Go.GCFlags", Name: "gcflags", UsageArgument: "'[pattern=]arg list'", SectionKey: "go-build",
		Usage: "arguments to pass on each go tool compile invocation."},
	{KeyPath: "Go.InstallSuffix", Name: "installsuffix", SectionKey: "go-build",
		Usage: "a suffix to use in the name of the package installation directory, in order to keep output separate from default builds. If using the -race flag, the install suffix is automatically set to raceor, if set explicitly, has _race appended to it. Likewise for the -msan flag.  Using a -buildmode option that requires non-default compile flags has a similar effect."},
	{KeyPath: "Go.LDFlags", Name: "ldflags", UsageArgument: "'[pattern=]arg list'", SectionKey: "go-build",
		Usage: "arguments to pass on each go tool link invocation."},
	{KeyPath: "Go.LinkShared", Name: "linkshared", SectionKey: "go-build",
		Usage: "build code that will be linked against shared libraries previously created with -buildmode=shared."},
	{KeyPath: "Go.Mod", Name: "mod", UsageArgument: "mode (readonly, vendor, or mod)", SectionKey: "go-build",
		Usage: "module download mode to use: readonly, vendor, or mod.  See 'go help modules' for more."},
	{KeyPath: "Go.ModCacheRW", Name: "modcacherw", SectionKey: "go-build",
		Usage: "leave newly-created directories in the module cache read-write instead of making them read-only."},
	{KeyPath: "Go.ModFile", Name: "modfile", UsageArgument: "file", SectionKey: "go-build",
		Usage: `in module aware mode, read (and possibly write) an alternate go.mod file instead of the one in the module root directory. A file named go.mod must still be present in order to determine the module root directory, but it is not accessed. When -modfile is specified, an alternate go.sum file is also used: its path is derived from the -modfile flag by trimming the ".mod" extension and appending ".sum".`},
	{KeyPath: "Go.MSan", Name: "msan", SectionKey: "go-build",
		Usage: "enable interoperation with memory sanitizer. Supported only on linux/amd64, linux/arm64 and only with Clang/LLVM as the host C compiler. On linux/arm64, pie build mode will be used."},
	{KeyPath: "Go.N", Name: "n", SectionKey: "go-build",
		Usage: "print the commands but do not run them."},
	{KeyPath: "Go.PkgDir", Name: "pkgdir", UsageArgument: "dir", SectionKey: "go-build",
		Usage: "install and load all packages from dir instead of the usual locations. For example, when building with a non-standard configuration, use -pkgdir to keep generated packages in a separate location."},
	{KeyPath: "Go.Tags", Name: "tags", UsageArgument: "tag,list", SectionKey: "go-build",
		Usage: "a comma-separated list of build tags to consider satisfied during the build. For more information about build tags, see the description of build constraints in the documentation for the go/build package. (Earlier versions of Go used a space-separated list, and that form is deprecated but still recognized.)"},
	{KeyPath: "Go.TrimPath", Name: "trimpath", SectionKey: "go-build",
		Usage: `remove all file system paths from the resulting executable. Instead of absolute file system paths, the recorded file names will begin with either "go" (for the standard library), or a module path@version (when using modules), or a plain import path (when using GOPATH).`},
	{KeyPath: "Go.ToolExec", Name: "toolexec", UsageArgument: "'cmd args'", SectionKey: "go-build",
		Usage: "a program to use to invoke toolchain programs like vet and asm. For example, instead of running asm, the go command will run cmd args /path/to/asm <arguments for asm>'."},
	{KeyPath: "Go.Work", Name: "work", SectionKey: "go-build",
		Usage: "print the name of the temporary work directory and do not delete it when exiting."},
	{KeyPath: "Go.X", Name: "x", SectionKey: "go-build",
		Usage: "print the commands."},
	{KeyPath: "Go.O", Name: "o", SectionKey: "go-build",
		Usage: "output binary path (including name)."},
}

GoBuildFlags provides flags for the Ginkgo CLI build, run, and watch commands that capture go's build-time flags. These are passed to go test -c by the ginkgo CLI

View Source
var GoRunFlags = GinkgoFlags{
	{KeyPath: "Go.CoverProfile", Name: "coverprofile", UsageArgument: "file", SectionKey: "code-and-coverage-analysis",
		Usage: `Write a coverage profile to the file after all tests have passed. Sets -cover.`},
	{KeyPath: "Go.BlockProfile", Name: "blockprofile", UsageArgument: "file", SectionKey: "performance-analysis",
		Usage: `Write a goroutine blocking profile to the specified file when all tests are complete. Preserves test binary.`},
	{KeyPath: "Go.BlockProfileRate", Name: "blockprofilerate", UsageArgument: "rate", SectionKey: "performance-analysis",
		Usage: `Control the detail provided in goroutine blocking profiles by calling runtime.SetBlockProfileRate with rate. See 'go doc runtime.SetBlockProfileRate'. The profiler aims to sample, on average, one blocking event every n nanoseconds the program spends blocked. By default, if -test.blockprofile is set without this flag, all blocking events are recorded, equivalent to -test.blockprofilerate=1.`},
	{KeyPath: "Go.CPUProfile", Name: "cpuprofile", UsageArgument: "file", SectionKey: "performance-analysis",
		Usage: `Write a CPU profile to the specified file before exiting. Preserves test binary.`},
	{KeyPath: "Go.MemProfile", Name: "memprofile", UsageArgument: "file", SectionKey: "performance-analysis",
		Usage: `Write an allocation profile to the file after all tests have passed. Preserves test binary.`},
	{KeyPath: "Go.MemProfileRate", Name: "memprofilerate", UsageArgument: "rate", SectionKey: "performance-analysis",
		Usage: `Enable more precise (and expensive) memory allocation profiles by setting runtime.MemProfileRate. See 'go doc runtime.MemProfileRate'. To profile all memory allocations, use -test.memprofilerate=1.`},
	{KeyPath: "Go.MutexProfile", Name: "mutexprofile", UsageArgument: "file", SectionKey: "performance-analysis",
		Usage: `Write a mutex contention profile to the specified file when all tests are complete. Preserves test binary.`},
	{KeyPath: "Go.MutexProfileFraction", Name: "mutexprofilefraction", UsageArgument: "n", SectionKey: "performance-analysis",
		Usage: `if >= 0, calls runtime.SetMutexProfileFraction()	Sample 1 in n stack traces of goroutines holding a contended mutex.`},
	{KeyPath: "Go.Trace", Name: "execution-trace", UsageArgument: "file", ExportAs: "trace", SectionKey: "performance-analysis",
		Usage: `Write an execution trace to the specified file before exiting.`},
}

GoRunFlags provides flags for the Ginkgo CLI run, and watch commands that capture go's run-time flags. These are passed to the compiled test binary by the ginkgo CLI

View Source
var NodeTypesForContainerAndIt = NodeTypeContainer | NodeTypeIt
View Source
var ParallelConfigFlags = GinkgoFlags{
	{KeyPath: "S.ParallelProcess", Name: "parallel.process", SectionKey: "low-level-parallel", UsageDefaultValue: "1",
		Usage: "This worker process's (one-indexed) process number.  For running specs in parallel."},
	{KeyPath: "S.ParallelTotal", Name: "parallel.total", SectionKey: "low-level-parallel", UsageDefaultValue: "1",
		Usage: "The total number of worker processes.  For running specs in parallel."},
	{KeyPath: "S.ParallelHost", Name: "parallel.host", SectionKey: "low-level-parallel", UsageDefaultValue: "set by Ginkgo CLI",
		Usage: "The address for the server that will synchronize the processes."},
}

ParallelConfigFlags provides flags for the Ginkgo test process (not the CLI)

View Source
var ReporterConfigFlags = GinkgoFlags{
	{KeyPath: "R.NoColor", Name: "no-color", SectionKey: "output", DeprecatedName: "noColor", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "If set, suppress color output in default reporter."},
	{KeyPath: "R.Verbose", Name: "v", SectionKey: "output",
		Usage: "If set, emits more output including GinkgoWriter contents."},
	{KeyPath: "R.VeryVerbose", Name: "vv", SectionKey: "output",
		Usage: "If set, emits with maximal verbosity - includes skipped and pending tests."},
	{KeyPath: "R.Succinct", Name: "succinct", SectionKey: "output",
		Usage: "If set, default reporter prints out a very succinct report"},
	{KeyPath: "R.FullTrace", Name: "trace", SectionKey: "output",
		Usage: "If set, default reporter prints out the full stack trace when a failure occurs"},
	{KeyPath: "R.ShowNodeEvents", Name: "show-node-events", SectionKey: "output",
		Usage: "If set, default reporter prints node > Enter and < Exit events when specs fail"},
	{KeyPath: "R.GithubOutput", Name: "github-output", SectionKey: "output",
		Usage: "If set, default reporter prints easier to manage output in Github Actions."},
	{KeyPath: "R.SilenceSkips", Name: "silence-skips", SectionKey: "output",
		Usage: "If set, default reporter will not print out skipped tests."},
	{KeyPath: "R.ForceNewlines", Name: "force-newlines", SectionKey: "output",
		Usage: "If set, default reporter will ensure a newline appears after each test."},

	{KeyPath: "R.JSONReport", Name: "json-report", UsageArgument: "filename.json", SectionKey: "output",
		Usage: "If set, Ginkgo will generate a JSON-formatted test report at the specified location."},
	{KeyPath: "R.JUnitReport", Name: "junit-report", UsageArgument: "filename.xml", SectionKey: "output", DeprecatedName: "reportFile", DeprecatedDocLink: "improved-reporting-infrastructure",
		Usage: "If set, Ginkgo will generate a conformant junit test report in the specified file."},
	{KeyPath: "R.TeamcityReport", Name: "teamcity-report", UsageArgument: "filename", SectionKey: "output",
		Usage: "If set, Ginkgo will generate a Teamcity-formatted test report at the specified location."},

	{KeyPath: "D.SlowSpecThresholdWithFLoatUnits", DeprecatedName: "slowSpecThreshold", DeprecatedDocLink: "changed--slowspecthreshold",
		Usage: "use --slow-spec-threshold instead and pass in a duration string (e.g. '5s', not '5.0')"},
	{KeyPath: "D.NoisyPendings", DeprecatedName: "noisyPendings", DeprecatedDocLink: "removed--noisypendings-and--noisyskippings", DeprecatedVersion: "2.0.0"},
	{KeyPath: "D.NoisySkippings", DeprecatedName: "noisySkippings", DeprecatedDocLink: "removed--noisypendings-and--noisyskippings", DeprecatedVersion: "2.0.0"},
	{KeyPath: "D.SlowSpecThreshold", DeprecatedName: "slow-spec-threshold", SectionKey: "output", Usage: "--slow-spec-threshold has been deprecated and will be removed in a future version of Ginkgo.  This feature has proved to be more noisy than useful.  You can use --poll-progress-after, instead, to get more actionable feedback about potentially slow specs and understand where they might be getting stuck.", DeprecatedVersion: "2.5.0"},
	{KeyPath: "D.AlwaysEmitGinkgoWriter", DeprecatedName: "always-emit-ginkgo-writer", SectionKey: "output", Usage: " - use -v instead, or one of Ginkgo's machine-readable report formats to get GinkgoWriter output for passing specs."},
}

ReporterConfigFlags provides flags for the Ginkgo test process, and CLI

View Source
var SuiteConfigFlags = GinkgoFlags{
	{KeyPath: "S.RandomSeed", Name: "seed", SectionKey: "order", UsageDefaultValue: "randomly generated by Ginkgo",
		Usage: "The seed used to randomize the spec suite.", AlwaysExport: true},
	{KeyPath: "S.RandomizeAllSpecs", Name: "randomize-all", SectionKey: "order", DeprecatedName: "randomizeAllSpecs", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "If set, ginkgo will randomize all specs together.  By default, ginkgo only randomizes the top level Describe, Context and When containers."},

	{KeyPath: "S.FailOnPending", Name: "fail-on-pending", SectionKey: "failure", DeprecatedName: "failOnPending", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "If set, ginkgo will mark the test suite as failed if any specs are pending."},
	{KeyPath: "S.FailFast", Name: "fail-fast", SectionKey: "failure", DeprecatedName: "failFast", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "If set, ginkgo will stop running a test suite after a failure occurs."},
	{KeyPath: "S.FlakeAttempts", Name: "flake-attempts", SectionKey: "failure", UsageDefaultValue: "0 - failed tests are not retried", DeprecatedName: "flakeAttempts", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "Make up to this many attempts to run each spec. If any of the attempts succeed, the suite will not be failed."},
	{KeyPath: "S.FailOnEmpty", Name: "fail-on-empty", SectionKey: "failure",
		Usage: "If set, ginkgo will mark the test suite as failed if no specs are run."},

	{KeyPath: "S.DryRun", Name: "dry-run", SectionKey: "debug", DeprecatedName: "dryRun", DeprecatedDocLink: "changed-command-line-flags",
		Usage: "If set, ginkgo will walk the test hierarchy without actually running anything.  Best paired with -v."},
	{KeyPath: "S.PollProgressAfter", Name: "poll-progress-after", SectionKey: "debug", UsageDefaultValue: "0",
		Usage: "Emit node progress reports periodically if node hasn't completed after this duration."},
	{KeyPath: "S.PollProgressInterval", Name: "poll-progress-interval", SectionKey: "debug", UsageDefaultValue: "10s",
		Usage: "The rate at which to emit node progress reports after poll-progress-after has elapsed."},
	{KeyPath: "S.SourceRoots", Name: "source-root", SectionKey: "debug",
		Usage: "The location to look for source code when generating progress reports.  You can pass multiple --source-root flags."},
	{KeyPath: "S.Timeout", Name: "timeout", SectionKey: "debug", UsageDefaultValue: "1h",
		Usage: "Test suite fails if it does not complete within the specified timeout."},
	{KeyPath: "S.GracePeriod", Name: "grace-period", SectionKey: "debug", UsageDefaultValue: "30s",
		Usage: "When interrupted, Ginkgo will wait for GracePeriod for the current running node to exit before moving on to the next one."},
	{KeyPath: "S.OutputInterceptorMode", Name: "output-interceptor-mode", SectionKey: "debug", UsageArgument: "dup, swap, or none",
		Usage: "If set, ginkgo will use the specified output interception strategy when running in parallel.  Defaults to dup on unix and swap on windows."},

	{KeyPath: "S.LabelFilter", Name: "label-filter", SectionKey: "filter", UsageArgument: "expression",
		Usage: "If set, ginkgo will only run specs with labels that match the label-filter.  The passed-in expression can include boolean operations (!, &&, ||, ','), groupings via '()', and regular expressions '/regexp/'.  e.g. '(cat || dog) && !fruit'"},
	{KeyPath: "S.FocusStrings", Name: "focus", SectionKey: "filter",
		Usage: "If set, ginkgo will only run specs that match this regular expression. Can be specified multiple times, values are ORed."},
	{KeyPath: "S.SkipStrings", Name: "skip", SectionKey: "filter",
		Usage: "If set, ginkgo will only run specs that do not match this regular expression. Can be specified multiple times, values are ORed."},
	{KeyPath: "S.FocusFiles", Name: "focus-file", SectionKey: "filter", UsageArgument: "file (regexp) | file:line | file:lineA-lineB | file:line,line,line",
		Usage: "If set, ginkgo will only run specs in matching files. Can be specified multiple times, values are ORed."},
	{KeyPath: "S.SkipFiles", Name: "skip-file", SectionKey: "filter", UsageArgument: "file (regexp) | file:line | file:lineA-lineB | file:line,line,line",
		Usage: "If set, ginkgo will skip specs in matching files. Can be specified multiple times, values are ORed."},

	{KeyPath: "D.RegexScansFilePath", DeprecatedName: "regexScansFilePath", DeprecatedDocLink: "removed--regexscansfilepath", DeprecatedVersion: "2.0.0"},
	{KeyPath: "D.DebugParallel", DeprecatedName: "debug", DeprecatedDocLink: "removed--debug", DeprecatedVersion: "2.0.0"},
	{KeyPath: "D.EmitSpecProgress", DeprecatedName: "progress", SectionKey: "debug",
		DeprecatedVersion: "2.5.0", Usage: ".  The functionality provided by --progress was confusing and is no longer needed.  Use --show-node-events instead to see node entry and exit events included in the timeline of failed and verbose specs.  Or you can run with -vv to always see all node events.  Lastly, --poll-progress-after and the PollProgressAfter decorator now provide a better mechanism for debugging specs that tend to get stuck."},
}

SuiteConfigFlags provides flags for the Ginkgo test process, and CLI

Functions

func GenerateFlagArgs

func GenerateFlagArgs(flags GinkgoFlags, bindings interface{}) ([]string, error)

given a set of GinkgoFlags and bindings, generate flag arguments suitable to be passed to an application with that set of flags configured.

func GenerateGinkgoTestRunArgs

func GenerateGinkgoTestRunArgs(suiteConfig SuiteConfig, reporterConfig ReporterConfig, goFlagsConfig GoFlagsConfig) ([]string, error)

GenerateGinkgoTestRunArgs is used by the Ginkgo CLI to generate command line arguments to pass to the compiled Ginkgo test binary

func GenerateGoTestCompileArgs

func GenerateGoTestCompileArgs(goFlagsConfig GoFlagsConfig, packageToBuild string, pathToInvocationPath string) ([]string, error)

GenerateGoTestCompileArgs is used by the Ginkgo CLI to generate command line arguments to pass to the go test -c command when compiling the test

func GenerateGoTestRunArgs

func GenerateGoTestRunArgs(goFlagsConfig GoFlagsConfig) ([]string, error)

GenerateGoTestRunArgs is used by the Ginkgo CLI to generate command line arguments to pass to the compiled non-Ginkgo test binary

func MarkAsHelper added in v2.8.0

func MarkAsHelper(optionalSkip ...int)

MarkAsHelper is used by GinkgoHelper to mark the caller (appropriately offset by skip)as a helper. You can use this directly if you need to provide an optional `skip` to mark functions further up the call stack as helpers.

func PruneStack

func PruneStack(fullStackTrace string, skip int) string

PruneStack removes references to functions that are internal to Ginkgo and the Go runtime from a stack string and a certain number of stack entries at the beginning of the stack. The stack string has the format as returned by runtime/debug.Stack. The leading goroutine information is optional and always removed if present. Beware that runtime/debug.Stack adds itself as first entry, so typically skip must be >= 1 to remove that entry.

func ValidateAndCleanupLabel

func ValidateAndCleanupLabel(label string, cl CodeLocation) (string, error)

func VetAndInitializeCLIAndGoConfig

func VetAndInitializeCLIAndGoConfig(cliConfig CLIConfig, goFlagsConfig GoFlagsConfig) (CLIConfig, GoFlagsConfig, []error)

VetAndInitializeCLIAndGoConfig validates that the Ginkgo CLI's configuration is sound It returns a potentially mutated copy of the config that rationalizes the configuration to ensure consistency for downstream consumers

func VetConfig

func VetConfig(flagSet GinkgoFlagSet, suiteConfig SuiteConfig, reporterConfig ReporterConfig) []error

VetConfig validates that the Ginkgo test process' configuration is sound

Types

type AdditionalFailure added in v2.3.0

type AdditionalFailure struct {
	State   SpecState
	Failure Failure
}

AdditionalFailure capturs any additional failures that occur after the initial failure of a psec these typically occur in clean up nodes after the spec has failed. We can't simply use Failure as we want to track the SpecState to know what kind of failure this is

func (AdditionalFailure) GetTimelineLocation added in v2.5.0

func (f AdditionalFailure) GetTimelineLocation() TimelineLocation

type CLIConfig

type CLIConfig struct {
	//for build, run, and watch
	Recurse      bool
	SkipPackage  string
	RequireSuite bool
	NumCompilers int

	//for run and watch only
	Procs                     int
	Parallel                  bool
	AfterRunHook              string
	OutputDir                 string
	KeepSeparateCoverprofiles bool
	KeepSeparateReports       bool

	//for run only
	KeepGoing       bool
	UntilItFails    bool
	Repeat          int
	RandomizeSuites bool

	//for watch only
	Depth       int
	WatchRegExp string
}

Configuration for the Ginkgo CLI

func NewDefaultCLIConfig

func NewDefaultCLIConfig() CLIConfig

func (CLIConfig) ComputedNumCompilers

func (g CLIConfig) ComputedNumCompilers() int

func (CLIConfig) ComputedProcs

func (g CLIConfig) ComputedProcs() int

type CodeLocation

type CodeLocation struct {
	FileName       string `json:",omitempty"`
	LineNumber     int    `json:",omitempty"`
	FullStackTrace string `json:",omitempty"`
	CustomMessage  string `json:",omitempty"`
}

func NewCodeLocation

func NewCodeLocation(skip int) CodeLocation

func NewCodeLocationWithStackTrace

func NewCodeLocationWithStackTrace(skip int) CodeLocation

func NewCustomCodeLocation

func NewCustomCodeLocation(message string) CodeLocation

func (CodeLocation) ContentsOfLine

func (codeLocation CodeLocation) ContentsOfLine() string

func (CodeLocation) String

func (codeLocation CodeLocation) String() string

type ColorableStringer

type ColorableStringer interface {
	ColorableString() string
}

ColorableStringer is an interface that ReportEntry values can satisfy. If they do then ColorableString() is used to generate their representation.

type DeprecatedSetupSummary

type DeprecatedSetupSummary struct {
	ComponentType SpecComponentType
	CodeLocation  CodeLocation

	State   SpecState
	RunTime time.Duration
	Failure SpecFailure

	CapturedOutput string
	SuiteID        string
}

type DeprecatedSpecFailure

type DeprecatedSpecFailure struct {
	Message        string
	Location       CodeLocation
	ForwardedPanic string

	ComponentIndex        int
	ComponentType         SpecComponentType
	ComponentCodeLocation CodeLocation
}

type DeprecatedSpecMeasurement

type DeprecatedSpecMeasurement struct {
	Name  string
	Info  interface{}
	Order int

	Results []float64

	Smallest     float64
	Largest      float64
	Average      float64
	StdDeviation float64

	SmallestLabel string
	LargestLabel  string
	AverageLabel  string
	Units         string
	Precision     int
}

func (DeprecatedSpecMeasurement) PrecisionFmt

func (s DeprecatedSpecMeasurement) PrecisionFmt() string

type DeprecatedSpecSummary

type DeprecatedSpecSummary struct {
	ComponentTexts         []string
	ComponentCodeLocations []CodeLocation

	State           SpecState
	RunTime         time.Duration
	Failure         SpecFailure
	IsMeasurement   bool
	NumberOfSamples int
	Measurements    map[string]*DeprecatedSpecMeasurement

	CapturedOutput string
	SuiteID        string
}

func (DeprecatedSpecSummary) Failed

func (s DeprecatedSpecSummary) Failed() bool

func (DeprecatedSpecSummary) HasFailureState

func (s DeprecatedSpecSummary) HasFailureState() bool

func (DeprecatedSpecSummary) Panicked

func (s DeprecatedSpecSummary) Panicked() bool

func (DeprecatedSpecSummary) Passed

func (s DeprecatedSpecSummary) Passed() bool

func (DeprecatedSpecSummary) Pending

func (s DeprecatedSpecSummary) Pending() bool

func (DeprecatedSpecSummary) Skipped

func (s DeprecatedSpecSummary) Skipped() bool

func (DeprecatedSpecSummary) TimedOut

func (s DeprecatedSpecSummary) TimedOut() bool

type DeprecatedSuiteSummary

type DeprecatedSuiteSummary struct {
	SuiteDescription string
	SuiteSucceeded   bool
	SuiteID          string

	NumberOfSpecsBeforeParallelization int
	NumberOfTotalSpecs                 int
	NumberOfSpecsThatWillBeRun         int
	NumberOfPendingSpecs               int
	NumberOfSkippedSpecs               int
	NumberOfPassedSpecs                int
	NumberOfFailedSpecs                int
	NumberOfFlakedSpecs                int
	RunTime                            time.Duration
}

type Deprecation

type Deprecation struct {
	Message string
	DocLink string
	Version string
}

type DeprecationTracker

type DeprecationTracker struct {
	// contains filtered or unexported fields
}

func NewDeprecationTracker

func NewDeprecationTracker() *DeprecationTracker

func (*DeprecationTracker) DeprecationsReport

func (d *DeprecationTracker) DeprecationsReport() string

func (*DeprecationTracker) DidTrackDeprecations

func (d *DeprecationTracker) DidTrackDeprecations() bool

func (*DeprecationTracker) TrackDeprecation

func (d *DeprecationTracker) TrackDeprecation(deprecation Deprecation, cl ...CodeLocation)

type EnumSupport

type EnumSupport struct {
	// contains filtered or unexported fields
}

func NewEnumSupport

func NewEnumSupport(toString map[uint]string) EnumSupport

func (EnumSupport) MarshJSON

func (es EnumSupport) MarshJSON(e uint) ([]byte, error)

func (EnumSupport) String

func (es EnumSupport) String(e uint) string

func (EnumSupport) UnmarshJSON

func (es EnumSupport) UnmarshJSON(b []byte) (uint, error)

type Failure

type Failure struct {
	// Message - the failure message passed into Fail(...).  When using a matcher library
	// like Gomega, this will contain the failure message generated by Gomega.
	//
	// Message is also populated if the user has called Skip(...).
	Message string

	// Location - the CodeLocation where the failure occurred
	// This CodeLocation will include a fully-populated StackTrace
	Location CodeLocation

	TimelineLocation TimelineLocation

	// ForwardedPanic - if the failure represents a captured panic (i.e. Summary.State == SpecStatePanicked)
	// then ForwardedPanic will be populated with a string representation of the captured panic.
	ForwardedPanic string `json:",omitempty"`

	// FailureNodeContext - one of three contexts describing the node in which the failure occurred:
	// FailureNodeIsLeafNode means the failure occurred in the leaf node of the associated SpecReport. None of the other FailureNode fields will be populated
	// FailureNodeAtTopLevel means the failure occurred in a non-leaf node that is defined at the top-level of the spec (i.e. not in a container). FailureNodeType and FailureNodeLocation will be populated.
	// FailureNodeInContainer means the failure occurred in a non-leaf node that is defined within a container.  FailureNodeType, FailureNodeLocation, and FailureNodeContainerIndex will be populated.
	//
	// FailureNodeType will contain the NodeType of the node in which the failure occurred.
	// FailureNodeLocation will contain the CodeLocation of the node in which the failure occurred.
	// If populated, FailureNodeContainerIndex will be the index into SpecReport.ContainerHierarchyTexts and SpecReport.ContainerHierarchyLocations that represents the parent container of the node in which the failure occurred.
	FailureNodeContext FailureNodeContext `json:",omitempty"`

	FailureNodeType NodeType `json:",omitempty"`

	FailureNodeLocation CodeLocation `json:",omitempty"`

	FailureNodeContainerIndex int `json:",omitempty"`

	//ProgressReport is populated if the spec was interrupted or timed out
	ProgressReport ProgressReport `json:",omitempty"`

	//AdditionalFailure is non-nil if a follow-on failure occurred within the same node after the primary failure.  This only happens when a node has timed out or been interrupted.  In such cases the AdditionalFailure can include information about where/why the spec was stuck.
	AdditionalFailure *AdditionalFailure `json:",omitempty"`
}

Failure captures failure information for an individual test

func (Failure) GetTimelineLocation added in v2.5.0

func (f Failure) GetTimelineLocation() TimelineLocation

func (Failure) IsZero

func (f Failure) IsZero() bool

type FailureNodeContext

type FailureNodeContext uint

FailureNodeContext captures the location context for the node containing the failing line of code

const (
	FailureNodeContextInvalid FailureNodeContext = iota

	FailureNodeIsLeafNode
	FailureNodeAtTopLevel
	FailureNodeInContainer
)

func (FailureNodeContext) MarshalJSON

func (fnc FailureNodeContext) MarshalJSON() ([]byte, error)

func (FailureNodeContext) String

func (fnc FailureNodeContext) String() string

func (*FailureNodeContext) UnmarshalJSON

func (fnc *FailureNodeContext) UnmarshalJSON(b []byte) error

type FileFilter

type FileFilter struct {
	Filename    *regexp.Regexp
	LineFilters LineFilters
}

func (FileFilter) Matches

func (f FileFilter) Matches(locations []CodeLocation) bool

type FileFilters

type FileFilters []FileFilter

func ParseFileFilters

func ParseFileFilters(filters []string) (FileFilters, error)

func (FileFilters) Matches

func (ffs FileFilters) Matches(locations []CodeLocation) bool

type FunctionCall added in v2.2.0

type FunctionCall struct {
	Function        string
	Filename        string
	Line            int
	Highlight       bool     `json:",omitempty"`
	Source          []string `json:",omitempty"`
	SourceHighlight int      `json:",omitempty"`
}

type GinkgoError

type GinkgoError struct {
	Heading      string
	Message      string
	DocLink      string
	CodeLocation CodeLocation
}

func (GinkgoError) Error

func (g GinkgoError) Error() string

type GinkgoFlag

type GinkgoFlag struct {
	Name       string
	KeyPath    string
	SectionKey string

	Usage             string
	UsageArgument     string
	UsageDefaultValue string

	DeprecatedName    string
	DeprecatedDocLink string
	DeprecatedVersion string

	ExportAs     string
	AlwaysExport bool
}

type GinkgoFlagSection

type GinkgoFlagSection struct {
	Key         string
	Style       string
	Succinct    bool
	Heading     string
	Description string
}

type GinkgoFlagSections

type GinkgoFlagSections []GinkgoFlagSection

func (GinkgoFlagSections) Lookup

func (gfs GinkgoFlagSections) Lookup(key string) (GinkgoFlagSection, bool)

type GinkgoFlagSet

type GinkgoFlagSet struct {
	// contains filtered or unexported fields
}

func BuildBuildCommandFlagSet

func BuildBuildCommandFlagSet(cliConfig *CLIConfig, goFlagsConfig *GoFlagsConfig) (GinkgoFlagSet, error)

BuildBuildCommandFlagSet builds the FlagSet for the `ginkgo build` command

func BuildLabelsCommandFlagSet

func BuildLabelsCommandFlagSet(cliConfig *CLIConfig) (GinkgoFlagSet, error)

func BuildRunCommandFlagSet

func BuildRunCommandFlagSet(suiteConfig *SuiteConfig, reporterConfig *ReporterConfig, cliConfig *CLIConfig, goFlagsConfig *GoFlagsConfig) (GinkgoFlagSet, error)

BuildRunCommandFlagSet builds the FlagSet for the `ginkgo run` command

func BuildTestSuiteFlagSet

func BuildTestSuiteFlagSet(suiteConfig *SuiteConfig, reporterConfig *ReporterConfig) (GinkgoFlagSet, error)

BuildTestSuiteFlagSet attaches to the CommandLine flagset and provides flags for the Ginkgo test process

func BuildWatchCommandFlagSet

func BuildWatchCommandFlagSet(suiteConfig *SuiteConfig, reporterConfig *ReporterConfig, cliConfig *CLIConfig, goFlagsConfig *GoFlagsConfig) (GinkgoFlagSet, error)

BuildWatchCommandFlagSet builds the FlagSet for the `ginkgo watch` command

func NewAttachedGinkgoFlagSet

func NewAttachedGinkgoFlagSet(flagSet *flag.FlagSet, flags GinkgoFlags, bindings interface{}, sections GinkgoFlagSections, extraGoFlagsSection GinkgoFlagSection) (GinkgoFlagSet, error)

Call NewGinkgoFlagSet to create GinkgoFlagSet that extends an existing *flag.FlagSet

func NewGinkgoFlagSet

func NewGinkgoFlagSet(flags GinkgoFlags, bindings interface{}, sections GinkgoFlagSections) (GinkgoFlagSet, error)

Call NewGinkgoFlagSet to create GinkgoFlagSet that creates and binds to it's own *flag.FlagSet

func (GinkgoFlagSet) IsZero

func (f GinkgoFlagSet) IsZero() bool

func (GinkgoFlagSet) Lookup

func (f GinkgoFlagSet) Lookup(name string) *flag.Flag

func (GinkgoFlagSet) Parse

func (f GinkgoFlagSet) Parse(args []string) ([]string, error)

func (GinkgoFlagSet) Usage

func (f GinkgoFlagSet) Usage() string

func (GinkgoFlagSet) ValidateDeprecations

func (f GinkgoFlagSet) ValidateDeprecations(deprecationTracker *DeprecationTracker)

func (GinkgoFlagSet) WasSet

func (f GinkgoFlagSet) WasSet(name string) bool

type GinkgoFlags

type GinkgoFlags []GinkgoFlag

func (GinkgoFlags) CopyAppend

func (f GinkgoFlags) CopyAppend(flags ...GinkgoFlag) GinkgoFlags

func (GinkgoFlags) SubsetWithNames

func (f GinkgoFlags) SubsetWithNames(names ...string) GinkgoFlags

func (GinkgoFlags) WithPrefix

func (f GinkgoFlags) WithPrefix(prefix string) GinkgoFlags

type GoFlagsConfig

type GoFlagsConfig struct {
	//build-time flags for code-and-performance analysis
	Race      bool
	Cover     bool
	CoverMode string
	CoverPkg  string
	Vet       string

	//run-time flags for code-and-performance analysis
	BlockProfile         string
	BlockProfileRate     int
	CoverProfile         string
	CPUProfile           string
	MemProfile           string
	MemProfileRate       int
	MutexProfile         string
	MutexProfileFraction int
	Trace                string

	//build-time flags for building
	A             bool
	ASMFlags      string
	BuildMode     string
	BuildVCS      bool
	Compiler      string
	GCCGoFlags    string
	GCFlags       string
	InstallSuffix string
	LDFlags       string
	LinkShared    bool
	Mod           string
	N             bool
	ModFile       string
	ModCacheRW    bool
	MSan          bool
	PkgDir        string
	Tags          string
	TrimPath      bool
	ToolExec      string
	Work          bool
	X             bool
	O             string
}

Configuration for the Ginkgo CLI capturing available go flags A subset of Go flags are exposed by Ginkgo. Some are available at compile time (e.g. ginkgo build) and others only at run time (e.g. ginkgo run - which has both build and run time flags). More details can be found at: https://docs.google.com/spreadsheets/d/1zkp-DS4hU4sAJl5eHh1UmgwxCPQhf3s5a8fbiOI8tJU/

func NewDefaultGoFlagsConfig

func NewDefaultGoFlagsConfig() GoFlagsConfig

func (GoFlagsConfig) BinaryMustBePreserved

func (g GoFlagsConfig) BinaryMustBePreserved() bool

type Goroutine added in v2.2.0

type Goroutine struct {
	ID              uint64
	State           string
	Stack           []FunctionCall
	IsSpecGoroutine bool
}

func (Goroutine) HasHighlights added in v2.2.0

func (g Goroutine) HasHighlights() bool

func (Goroutine) IsZero added in v2.2.0

func (g Goroutine) IsZero() bool

type LabelFilter

type LabelFilter func([]string) bool

func MustParseLabelFilter added in v2.8.0

func MustParseLabelFilter(input string) LabelFilter

func ParseLabelFilter

func ParseLabelFilter(input string) (LabelFilter, error)

type LineFilter

type LineFilter struct {
	Min int
	Max int
}

func (LineFilter) Matches

func (lf LineFilter) Matches(line int) bool

type LineFilters

type LineFilters []LineFilter

func (LineFilters) Matches

func (lfs LineFilters) Matches(line int) bool

type NodeType

type NodeType uint

NodeType captures the type of a given Ginkgo Node

const (
	NodeTypeInvalid NodeType = 0

	NodeTypeContainer NodeType = 1 << iota
	NodeTypeIt

	NodeTypeBeforeEach
	NodeTypeJustBeforeEach
	NodeTypeAfterEach
	NodeTypeJustAfterEach

	NodeTypeBeforeAll
	NodeTypeAfterAll

	NodeTypeBeforeSuite
	NodeTypeSynchronizedBeforeSuite
	NodeTypeAfterSuite
	NodeTypeSynchronizedAfterSuite

	NodeTypeReportBeforeEach
	NodeTypeReportAfterEach
	NodeTypeReportBeforeSuite
	NodeTypeReportAfterSuite

	NodeTypeCleanupInvalid
	NodeTypeCleanupAfterEach
	NodeTypeCleanupAfterAll
	NodeTypeCleanupAfterSuite
)

func (NodeType) Is

func (nt NodeType) Is(nodeTypes NodeType) bool

func (NodeType) MarshalJSON

func (nt NodeType) MarshalJSON() ([]byte, error)

func (NodeType) String

func (nt NodeType) String() string

func (*NodeType) UnmarshalJSON

func (nt *NodeType) UnmarshalJSON(b []byte) error

type PreRunStats

type PreRunStats struct {
	TotalSpecs       int
	SpecsThatWillRun int
}

PreRunStats contains a set of stats captured before the test run begins. This is primarily used by Ginkgo's reporter to tell the user how many specs are in the current suite (PreRunStats.TotalSpecs) and how many it intends to run (PreRunStats.SpecsThatWillRun) after applying any relevant focus or skip filters.

type ProgressReport added in v2.2.0

type ProgressReport struct {
	Message           string `json:",omitempty"`
	ParallelProcess   int    `json:",omitempty"`
	RunningInParallel bool   `json:",omitempty"`

	ContainerHierarchyTexts []string     `json:",omitempty"`
	LeafNodeText            string       `json:",omitempty"`
	LeafNodeLocation        CodeLocation `json:",omitempty"`
	SpecStartTime           time.Time    `json:",omitempty"`

	CurrentNodeType      NodeType     `json:",omitempty"`
	CurrentNodeText      string       `json:",omitempty"`
	CurrentNodeLocation  CodeLocation `json:",omitempty"`
	CurrentNodeStartTime time.Time    `json:",omitempty"`

	CurrentStepText      string       `json:",omitempty"`
	CurrentStepLocation  CodeLocation `json:",omitempty"`
	CurrentStepStartTime time.Time    `json:",omitempty"`

	AdditionalReports []string `json:",omitempty"`

	CapturedGinkgoWriterOutput string           `json:",omitempty"`
	TimelineLocation           TimelineLocation `json:",omitempty"`

	Goroutines []Goroutine `json:",omitempty"`
}

ProgressReport captures the progress of the current spec. It is, effectively, a structured Ginkgo-aware stack trace

func (ProgressReport) GetTimelineLocation added in v2.5.0

func (pr ProgressReport) GetTimelineLocation() TimelineLocation

func (ProgressReport) HighlightedGoroutines added in v2.2.0

func (pr ProgressReport) HighlightedGoroutines() []Goroutine

func (ProgressReport) IsZero added in v2.2.0

func (pr ProgressReport) IsZero() bool

func (ProgressReport) OtherGoroutines added in v2.2.0

func (pr ProgressReport) OtherGoroutines() []Goroutine

func (ProgressReport) SpecGoroutine added in v2.2.0

func (pr ProgressReport) SpecGoroutine() Goroutine

func (ProgressReport) Time added in v2.2.0

func (pr ProgressReport) Time() time.Time

func (ProgressReport) WithoutCapturedGinkgoWriterOutput added in v2.2.0

func (pr ProgressReport) WithoutCapturedGinkgoWriterOutput() ProgressReport

func (ProgressReport) WithoutOtherGoroutines added in v2.5.0

func (pr ProgressReport) WithoutOtherGoroutines() ProgressReport

type Report

type Report struct {
	//SuitePath captures the absolute path to the test suite
	SuitePath string

	//SuiteDescription captures the description string passed to the DSL's RunSpecs() function
	SuiteDescription string

	//SuiteLabels captures any labels attached to the suite by the DSL's RunSpecs() function
	SuiteLabels []string

	//SuiteSucceeded captures the success or failure status of the test run
	//If true, the test run is considered successful.
	//If false, the test run is considered unsuccessful
	SuiteSucceeded bool

	//SuiteHasProgrammaticFocus captures whether the test suite has a test or set of tests that are programmatically focused
	//(i.e an `FIt` or an `FDescribe`
	SuiteHasProgrammaticFocus bool

	//SpecialSuiteFailureReasons may contain special failure reasons
	//For example, a test suite might be considered "failed" even if none of the individual specs
	//have a failure state.  For example, if the user has configured --fail-on-pending the test suite
	//will have failed if there are pending tests even though all non-pending tests may have passed.  In such
	//cases, Ginkgo populates SpecialSuiteFailureReasons with a clear message indicating the reason for the failure.
	//SpecialSuiteFailureReasons is also populated if the test suite is interrupted by the user.
	//Since multiple special failure reasons can occur, this field is a slice.
	SpecialSuiteFailureReasons []string

	//PreRunStats contains a set of stats captured before the test run begins.  This is primarily used
	//by Ginkgo's reporter to tell the user how many specs are in the current suite (PreRunStats.TotalSpecs)
	//and how many it intends to run (PreRunStats.SpecsThatWillRun) after applying any relevant focus or skip filters.
	PreRunStats PreRunStats

	//StartTime and EndTime capture the start and end time of the test run
	StartTime time.Time
	EndTime   time.Time

	//RunTime captures the duration of the test run
	RunTime time.Duration

	//SuiteConfig captures the Ginkgo configuration governing this test run
	//SuiteConfig includes information necessary for reproducing an identical test run,
	//such as the random seed and any filters applied during the test run
	SuiteConfig SuiteConfig

	//SpecReports is a list of all SpecReports generated by this test run
	//It is empty when the SuiteReport is provided to ReportBeforeSuite
	SpecReports SpecReports
}

Report captures information about a Ginkgo test run

func (Report) Add

func (report Report) Add(other Report) Report

Add is used by Ginkgo's parallel aggregation mechanisms to combine test run reports form individual parallel processes to form a complete final report.

type ReportEntries

type ReportEntries []ReportEntry

func (ReportEntries) HasVisibility

func (re ReportEntries) HasVisibility(visibilities ...ReportEntryVisibility) bool

func (ReportEntries) WithVisibility

func (re ReportEntries) WithVisibility(visibilities ...ReportEntryVisibility) ReportEntries

type ReportEntry

type ReportEntry struct {
	// Visibility captures the visibility policy for this ReportEntry
	Visibility ReportEntryVisibility
	// Location captures the location of the AddReportEntry call
	Location CodeLocation

	Time             time.Time //need this for backwards compatibility
	TimelineLocation TimelineLocation

	// Name captures the name of this report
	Name string
	// Value captures the (optional) object passed into AddReportEntry - this can be
	// anything the user wants.  The value passed to AddReportEntry is wrapped in a ReportEntryValue to make
	// encoding/decoding the value easier.  To access the raw value call entry.GetRawValue()
	Value ReportEntryValue
}

ReportEntry captures information attached to `SpecReport` via `AddReportEntry`

func (ReportEntry) GetRawValue

func (entry ReportEntry) GetRawValue() interface{}

GetRawValue returns the Value object that was passed to AddReportEntry If called in-process this will be the same object that was passed into AddReportEntry. If used from a rehydrated JSON file _or_ in a ReportAfterSuite when running in parallel this will be a JSON-decoded {}interface. If you want to reconstitute your original object you can decode the entry.Value.AsJSON field yourself.

func (ReportEntry) GetTimelineLocation added in v2.5.0

func (entry ReportEntry) GetTimelineLocation() TimelineLocation

func (ReportEntry) StringRepresentation

func (entry ReportEntry) StringRepresentation() string

StringRepresentation() returns the string representation of the value associated with the ReportEntry -- if value is nil, empty string is returned if value is a `ColorableStringer` then `Value.ColorableString()` is returned if value is a `fmt.Stringer` then `Value.String()` is returned otherwise the value is formatted with "%+v"

type ReportEntryValue

type ReportEntryValue struct {
	AsJSON         string
	Representation string
	// contains filtered or unexported fields
}

ReportEntryValue wraps a report entry's value ensuring it can be encoded and decoded safely into reports and across the network connection when running in parallel

func WrapEntryValue

func WrapEntryValue(value interface{}) ReportEntryValue

func (ReportEntryValue) GetRawValue

func (rev ReportEntryValue) GetRawValue() interface{}

func (*ReportEntryValue) GobDecode

func (rev *ReportEntryValue) GobDecode(data []byte) error

func (ReportEntryValue) GobEncode

func (rev ReportEntryValue) GobEncode() ([]byte, error)

func (ReportEntryValue) MarshalJSON

func (rev ReportEntryValue) MarshalJSON() ([]byte, error)

func (ReportEntryValue) String

func (rev ReportEntryValue) String() string

func (*ReportEntryValue) UnmarshalJSON

func (rev *ReportEntryValue) UnmarshalJSON(data []byte) error

type ReportEntryVisibility

type ReportEntryVisibility uint

ReportEntryVisibility governs the visibility of ReportEntries in Ginkgo's console reporter

const (
	// Always print out this ReportEntry
	ReportEntryVisibilityAlways ReportEntryVisibility = iota
	// Only print out this ReportEntry if the spec fails or if the test is run with -v
	ReportEntryVisibilityFailureOrVerbose
	// Never print out this ReportEntry (note that ReportEntrys are always encoded in machine readable reports (e.g. JSON, JUnit, etc.))
	ReportEntryVisibilityNever
)

func (ReportEntryVisibility) Is

func (v ReportEntryVisibility) Is(visibilities ...ReportEntryVisibility) bool

func (ReportEntryVisibility) MarshalJSON

func (rev ReportEntryVisibility) MarshalJSON() ([]byte, error)

func (ReportEntryVisibility) String

func (rev ReportEntryVisibility) String() string

func (*ReportEntryVisibility) UnmarshalJSON

func (rev *ReportEntryVisibility) UnmarshalJSON(b []byte) error

type ReporterConfig

type ReporterConfig struct {
	NoColor        bool
	Succinct       bool
	Verbose        bool
	VeryVerbose    bool
	FullTrace      bool
	ShowNodeEvents bool
	GithubOutput   bool
	SilenceSkips   bool
	ForceNewlines  bool

	JSONReport     string
	JUnitReport    string
	TeamcityReport string
}

Configuration for Ginkgo's reporter

func NewDefaultReporterConfig

func NewDefaultReporterConfig() ReporterConfig

func (ReporterConfig) Verbosity

func (rc ReporterConfig) Verbosity() VerbosityLevel

func (ReporterConfig) WillGenerateReport

func (rc ReporterConfig) WillGenerateReport() bool

type SemVer

type SemVer struct {
	Major int
	Minor int
	Patch int
}

func ParseSemVer

func ParseSemVer(semver string) SemVer

func (SemVer) GreaterThanOrEqualTo

func (s SemVer) GreaterThanOrEqualTo(o SemVer) bool

type SetupSummary

type SetupSummary = DeprecatedSetupSummary

type SpecComponentType

type SpecComponentType = NodeType

type SpecEvent added in v2.5.0

type SpecEvent struct {
	SpecEventType SpecEventType

	CodeLocation     CodeLocation
	TimelineLocation TimelineLocation

	Message  string        `json:",omitempty"`
	Duration time.Duration `json:",omitempty"`
	NodeType NodeType      `json:",omitempty"`
	Attempt  int           `json:",omitempty"`
}

SpecEvent captures a vareity of events that can occur when specs run. See SpecEventType for the list of available events.

func (SpecEvent) GetTimelineLocation added in v2.5.0

func (se SpecEvent) GetTimelineLocation() TimelineLocation

func (SpecEvent) GomegaString added in v2.5.0

func (se SpecEvent) GomegaString() string

func (SpecEvent) IsOnlyVisibleAtVeryVerbose added in v2.5.0

func (se SpecEvent) IsOnlyVisibleAtVeryVerbose() bool

type SpecEventType added in v2.5.0

type SpecEventType uint
const (
	SpecEventInvalid SpecEventType = 0

	SpecEventByStart SpecEventType = 1 << iota
	SpecEventByEnd
	SpecEventNodeStart
	SpecEventNodeEnd
	SpecEventSpecRepeat
	SpecEventSpecRetry
)

func (SpecEventType) Is added in v2.5.0

func (se SpecEventType) Is(specEventTypes SpecEventType) bool

func (SpecEventType) MarshalJSON added in v2.5.0

func (se SpecEventType) MarshalJSON() ([]byte, error)

func (SpecEventType) String added in v2.5.0

func (se SpecEventType) String() string

func (*SpecEventType) UnmarshalJSON added in v2.5.0

func (se *SpecEventType) UnmarshalJSON(b []byte) error

type SpecEvents added in v2.5.0

type SpecEvents []SpecEvent

func (SpecEvents) WithType added in v2.5.0

func (se SpecEvents) WithType(seType SpecEventType) SpecEvents

type SpecFailure

type SpecFailure = DeprecatedSpecFailure

type SpecMeasurement

type SpecMeasurement = DeprecatedSpecMeasurement

type SpecReport

type SpecReport struct {
	// ContainerHierarchyTexts is a slice containing the text strings of
	// all Describe/Context/When containers in this spec's hierarchy.
	ContainerHierarchyTexts []string

	// ContainerHierarchyLocations is a slice containing the CodeLocations of
	// all Describe/Context/When containers in this spec's hierarchy.
	ContainerHierarchyLocations []CodeLocation

	// ContainerHierarchyLabels is a slice containing the labels of
	// all Describe/Context/When containers in this spec's hierarchy
	ContainerHierarchyLabels [][]string

	// LeafNodeType, LeadNodeLocation, LeafNodeLabels and LeafNodeText capture the NodeType, CodeLocation, and text
	// of the Ginkgo node being tested (typically an NodeTypeIt node, though this can also be
	// one of the NodeTypesForSuiteLevelNodes node types)
	LeafNodeType     NodeType
	LeafNodeLocation CodeLocation
	LeafNodeLabels   []string
	LeafNodeText     string

	// State captures whether the spec has passed, failed, etc.
	State SpecState

	// IsSerial captures whether the spec has the Serial decorator
	IsSerial bool

	// IsInOrderedContainer captures whether the spec appears in an Ordered container
	IsInOrderedContainer bool

	// StartTime and EndTime capture the start and end time of the spec
	StartTime time.Time
	EndTime   time.Time

	// RunTime captures the duration of the spec
	RunTime time.Duration

	// ParallelProcess captures the parallel process that this spec ran on
	ParallelProcess int

	// RunningInParallel captures whether this spec is part of a suite that ran in parallel
	RunningInParallel bool

	//Failure is populated if a spec has failed, panicked, been interrupted, or skipped by the user (e.g. calling Skip())
	//It includes detailed information about the Failure
	Failure Failure

	// NumAttempts captures the number of times this Spec was run.
	// Flakey specs can be retried with ginkgo --flake-attempts=N or the use of the FlakeAttempts decorator.
	// Repeated specs can be retried with the use of the MustPassRepeatedly decorator
	NumAttempts int

	// MaxFlakeAttempts captures whether the spec has been retried with ginkgo --flake-attempts=N or the use of the FlakeAttempts decorator.
	MaxFlakeAttempts int

	// MaxMustPassRepeatedly captures whether the spec has the MustPassRepeatedly decorator
	MaxMustPassRepeatedly int

	// CapturedGinkgoWriterOutput contains text printed to the GinkgoWriter
	CapturedGinkgoWriterOutput string

	// CapturedStdOutErr contains text printed to stdout/stderr (when running in parallel)
	// This is always empty when running in series or calling CurrentSpecReport()
	// It is used internally by Ginkgo's reporter
	CapturedStdOutErr string

	// ReportEntries contains any reports added via `AddReportEntry`
	ReportEntries ReportEntries

	// ProgressReports contains any progress reports generated during this spec.  These can either be manually triggered, or automatically generated by Ginkgo via the PollProgressAfter() decorator
	ProgressReports []ProgressReport

	// AdditionalFailures contains any failures that occurred after the initial spec failure.  These typically occur in cleanup nodes after the initial failure and are only emitted when running in verbose mode.
	AdditionalFailures []AdditionalFailure

	// SpecEvents capture additional events that occur during the spec run
	SpecEvents SpecEvents
}

SpecReport captures information about a Ginkgo spec.

func (SpecReport) CombinedOutput

func (report SpecReport) CombinedOutput() string

CombinedOutput returns a single string representation of both CapturedStdOutErr and CapturedGinkgoWriterOutput Note that both are empty when using CurrentSpecReport() so CurrentSpecReport().CombinedOutput() will always be empty. CombinedOutput() is used internally by Ginkgo's reporter.

func (SpecReport) Failed

func (report SpecReport) Failed() bool

Failed returns true if report.State is one of the SpecStateFailureStates (SpecStateFailed, SpecStatePanicked, SpecStateinterrupted, SpecStateAborted)

func (SpecReport) FailureLocation

func (report SpecReport) FailureLocation() CodeLocation

FailureLocation() returns the location of the failure (or an empty CodeLocation if the test hasn't failed)

func (SpecReport) FailureMessage

func (report SpecReport) FailureMessage() string

FailureMessage() returns the failure message (or empty string if the test hasn't failed)

func (SpecReport) FileName

func (report SpecReport) FileName() string

FileName() returns the name of the file containing the spec

func (SpecReport) FullText

func (report SpecReport) FullText() string

FullText returns a concatenation of all the report.ContainerHierarchyTexts and report.LeafNodeText

func (SpecReport) Labels

func (report SpecReport) Labels() []string

Labels returns a deduped set of all the spec's Labels.

func (SpecReport) LineNumber

func (report SpecReport) LineNumber() int

LineNumber() returns the line number of the leaf node

func (SpecReport) MarshalJSON

func (report SpecReport) MarshalJSON() ([]byte, error)

func (SpecReport) MatchesLabelFilter

func (report SpecReport) MatchesLabelFilter(query string) (bool, error)

MatchesLabelFilter returns true if the spec satisfies the passed in label filter query

func (SpecReport) Timeline added in v2.5.0

func (report SpecReport) Timeline() Timeline

Timeline() returns a timeline view of the report

type SpecReports

type SpecReports []SpecReport

func (SpecReports) CountOfFlakedSpecs

func (reports SpecReports) CountOfFlakedSpecs() int

If the Spec passes, CountOfFlakedSpecs returns the number of SpecReports that failed after multiple attempts.

func (SpecReports) CountOfRepeatedSpecs added in v2.4.0

func (reports SpecReports) CountOfRepeatedSpecs() int

If the Spec fails, CountOfRepeatedSpecs returns the number of SpecReports that passed after multiple attempts

func (SpecReports) CountWithState

func (reports SpecReports) CountWithState(states SpecState) int

CountWithState returns the number of SpecReports with State matching one of the requested SpecStates

func (SpecReports) WithLeafNodeType

func (reports SpecReports) WithLeafNodeType(nodeTypes NodeType) SpecReports

WithLeafNodeType returns the subset of SpecReports with LeafNodeType matching one of the requested NodeTypes

func (SpecReports) WithState

func (reports SpecReports) WithState(states SpecState) SpecReports

WithState returns the subset of SpecReports with State matching one of the requested SpecStates

type SpecState

type SpecState uint

SpecState captures the state of a spec To determine if a given `state` represents a failure state, use `state.Is(SpecStateFailureStates)`

const (
	SpecStateInvalid SpecState = 0

	SpecStatePending SpecState = 1 << iota
	SpecStateSkipped
	SpecStatePassed
	SpecStateFailed
	SpecStateAborted
	SpecStatePanicked
	SpecStateInterrupted
	SpecStateTimedout
)

func (SpecState) GomegaString added in v2.7.0

func (ss SpecState) GomegaString() string

func (SpecState) Is

func (ss SpecState) Is(states SpecState) bool

func (SpecState) MarshalJSON

func (ss SpecState) MarshalJSON() ([]byte, error)

func (SpecState) String

func (ss SpecState) String() string

func (*SpecState) UnmarshalJSON

func (ss *SpecState) UnmarshalJSON(b []byte) error

type SpecSummary

type SpecSummary = DeprecatedSpecSummary

type SuiteConfig

type SuiteConfig struct {
	RandomSeed            int64
	RandomizeAllSpecs     bool
	FocusStrings          []string
	SkipStrings           []string
	FocusFiles            []string
	SkipFiles             []string
	LabelFilter           string
	FailOnPending         bool
	FailOnEmpty           bool
	FailFast              bool
	FlakeAttempts         int
	MustPassRepeatedly    int
	DryRun                bool
	PollProgressAfter     time.Duration
	PollProgressInterval  time.Duration
	Timeout               time.Duration
	EmitSpecProgress      bool // this is deprecated but its removal is causing compile issue for some users that were setting it manually
	OutputInterceptorMode string
	SourceRoots           []string
	GracePeriod           time.Duration

	ParallelProcess int
	ParallelTotal   int
	ParallelHost    string
}

Configuration controlling how an individual test suite is run

func NewDefaultSuiteConfig

func NewDefaultSuiteConfig() SuiteConfig

type SuiteSummary

type SuiteSummary = DeprecatedSuiteSummary

type Timeline added in v2.5.0

type Timeline []TimelineEvent

func (Timeline) Len added in v2.5.0

func (t Timeline) Len() int

func (Timeline) Less added in v2.5.0

func (t Timeline) Less(i, j int) bool

func (Timeline) Swap added in v2.5.0

func (t Timeline) Swap(i, j int)

func (Timeline) WithoutHiddenReportEntries added in v2.5.0

func (t Timeline) WithoutHiddenReportEntries() Timeline

func (Timeline) WithoutVeryVerboseSpecEvents added in v2.5.0

func (t Timeline) WithoutVeryVerboseSpecEvents() Timeline

type TimelineEvent added in v2.5.0

type TimelineEvent interface {
	GetTimelineLocation() TimelineLocation
}

TimelineEvent represent an event on the timeline consumers of Timeline will need to check the concrete type of each entry to determine how to handle it

type TimelineLocation added in v2.5.0

type TimelineLocation struct {
	//Offset is the offset (in bytes) of the event relative to the GinkgoWriter stream
	Offset int `json:",omitempty"`

	//Order is the order of the event with respect to other events.  The absolute value of Order
	//is irrelevant.  All that matters is that an event with a lower Order occurs before ane vent with a higher Order
	Order int `json:",omitempty"`

	Time time.Time
}

TimelineLocation captures the location of an event in the spec's timeline

type VerbosityLevel

type VerbosityLevel uint
const (
	VerbosityLevelSuccinct VerbosityLevel = iota
	VerbosityLevelNormal
	VerbosityLevelVerbose
	VerbosityLevelVeryVerbose
)

func (VerbosityLevel) GT

func (vl VerbosityLevel) GT(comp VerbosityLevel) bool

func (VerbosityLevel) GTE

func (vl VerbosityLevel) GTE(comp VerbosityLevel) bool

func (VerbosityLevel) Is

func (vl VerbosityLevel) Is(comp VerbosityLevel) bool

func (VerbosityLevel) LT

func (vl VerbosityLevel) LT(comp VerbosityLevel) bool

func (VerbosityLevel) LTE

func (vl VerbosityLevel) LTE(comp VerbosityLevel) bool

Jump to

Keyboard shortcuts

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