package internal
import "github.com/onsi/ginkgo/v2/internal"
Index ¶
- Constants
- func ApplyNestedFocusPolicyToTree(tree *TreeNode)
- func MakeIncrementingIndexCounter() func() (int, error)
- func NewProgressReport(isRunningInParallel bool, report types.SpecReport, currentNode Node, currentNodeStartTime time.Time, currentStep ProgressStepCursor, gwOutput string, sourceRoots []string, includeAll bool) (types.ProgressReport, error)
- func OrderSpecs(specs Specs, suiteConfig types.SuiteConfig) (GroupedSpecIndices, GroupedSpecIndices)
- func PartitionDecorations(args ...interface{}) ([]interface{}, []interface{})
- func RegisterForProgressSignal(handler func()) context.CancelFunc
- func UniqueNodeID() uint
- type Done
- type Failer
- func NewFailer() *Failer
- func (f *Failer) AbortSuite(message string, location types.CodeLocation)
- func (f *Failer) Drain() (types.SpecState, types.Failure)
- func (f *Failer) Fail(message string, location types.CodeLocation)
- func (f *Failer) GetFailure() types.Failure
- func (f *Failer) GetState() types.SpecState
- func (f *Failer) Panic(location types.CodeLocation, forwardedPanic interface{})
- func (f *Failer) Skip(message string, location types.CodeLocation)
- type FlakeAttempts
- type GroupedSpecIndices
- type Labels
- type Node
- func NewCleanupNode(fail func(string, types.CodeLocation), args ...interface{}) (Node, []error)
- func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeType, text string, args ...interface{}) (Node, []error)
- func (n Node) IsZero() bool
- type Nodes
- func (n Nodes) BestTextFor(node Node) string
- func (n Nodes) CodeLocations() []types.CodeLocation
- func (n Nodes) ContainsNodeID(id uint) bool
- func (n Nodes) CopyAppend(nodes ...Node) Nodes
- func (n Nodes) Filter(filter func(Node) bool) Nodes
- func (n Nodes) FirstNodeMarkedOrdered() Node
- func (n Nodes) FirstNodeWithType(nodeTypes types.NodeType) Node
- func (n Nodes) FirstSatisfying(filter func(Node) bool) Node
- func (n Nodes) FirstWithNestingLevel(level int) Node
- func (n Nodes) HasNodeMarkedFocus() bool
- func (n Nodes) HasNodeMarkedPending() bool
- func (n Nodes) HasNodeMarkedSerial() bool
- func (n Nodes) Labels() [][]string
- func (n Nodes) Reverse() Nodes
- func (n Nodes) SortedByAscendingNestingLevel() Nodes
- func (n Nodes) SortedByDescendingNestingLevel() Nodes
- func (n Nodes) SplitAround(pivot Node) (Nodes, Nodes)
- func (n Nodes) Texts() []string
- func (n Nodes) UnionOfLabels() []string
- func (n Nodes) WithType(nodeTypes types.NodeType) Nodes
- func (n Nodes) WithinNestingLevel(deepestNestingLevel int) Nodes
- func (n Nodes) WithoutNode(nodeToExclude Node) Nodes
- func (n Nodes) WithoutType(nodeTypes types.NodeType) Nodes
- type NoopOutputInterceptor
- func (interceptor NoopOutputInterceptor) PauseIntercepting()
- func (interceptor NoopOutputInterceptor) ResumeIntercepting()
- func (interceptor NoopOutputInterceptor) Shutdown()
- func (interceptor NoopOutputInterceptor) StartInterceptingOutput()
- func (interceptor NoopOutputInterceptor) StartInterceptingOutputAndForwardTo(io.Writer)
- func (interceptor NoopOutputInterceptor) StopInterceptingAndReturnOutput() string
- type Offset
- type OutputInterceptor
- type Phase
- type PollProgressAfter
- type PollProgressInterval
- type ProgressSignalRegistrar
- type ProgressStepCursor
- type ReportEntry
- type Spec
- func (s Spec) FirstNodeWithType(nodeTypes types.NodeType) Node
- func (s Spec) FlakeAttempts() int
- func (s Spec) SubjectID() uint
- func (s Spec) Text() string
- type SpecIndices
- type Specs
- func ApplyFocusToSpecs(specs Specs, description string, suiteLabels Labels, suiteConfig types.SuiteConfig) (Specs, bool)
- func GenerateSpecsFromTreeRoot(tree *TreeNode) Specs
- func (s Specs) AtIndices(indices SpecIndices) Specs
- func (s Specs) CountWithoutSkip() int
- func (s Specs) HasAnySpecsMarkedPending() bool
- type Suite
- func NewSuite() *Suite
- func (suite *Suite) AddReportEntry(entry ReportEntry) error
- func (suite *Suite) BuildTree() error
- func (suite *Suite) CurrentSpecReport() types.SpecReport
- func (suite *Suite) InRunPhase() bool
- func (suite *Suite) PushNode(node Node) error
- func (suite *Suite) Run(description string, suiteLabels Labels, suitePath string, failer *Failer, reporter reporters.Reporter, writer WriterInterface, outputInterceptor OutputInterceptor, interruptHandler interrupt_handler.InterruptHandlerInterface, client parallel_support.Client, progressSignalRegistrar ProgressSignalRegistrar, suiteConfig types.SuiteConfig) (bool, bool)
- func (suite *Suite) SetProgressStepCursor(cursor ProgressStepCursor)
- type TreeNode
- type TreeNodes
- type Writer
- func NewWriter(outWriter io.Writer) *Writer
- func (w *Writer) Bytes() []byte
- func (w *Writer) ClearTeeWriters()
- func (w *Writer) Print(a ...interface{})
- func (w *Writer) Printf(format string, a ...interface{})
- func (w *Writer) Println(a ...interface{})
- func (w *Writer) SetMode(mode WriterMode)
- func (w *Writer) TeeTo(writer io.Writer)
- func (w *Writer) Truncate()
- func (w *Writer) Write(b []byte) (n int, err error)
- type WriterInterface
- type WriterMode
Constants ¶
const BAILOUT_MESSAGE = "" /* 1488 byte string literal not displayed */
const Focus = focusType(true)
const OncePerOrdered = honorsOrderedType(true)
const Ordered = orderedType(true)
const Pending = pendingType(true)
const Serial = serialType(true)
const SuppressProgressReporting = suppressProgressReporting(true)
Functions ¶
func ApplyNestedFocusPolicyToTree ¶
func ApplyNestedFocusPolicyToTree(tree *TreeNode)
If a container marked as focus has a descendant that is also marked as focus, Ginkgo's policy is to unmark the container's focus. This gives developers a more intuitive experience when debugging specs. It is common to focus a container to just run a subset of specs, then identify the specific specs within the container to focus - this policy allows the developer to simply focus those specific specs and not need to go back and turn the focus off of the container:
As a common example, consider:
FDescribe("something to debug", function() { It("works", function() {...}) It("works", function() {...}) FIt("doesn't work", function() {...}) It("works", function() {...}) })
here the developer's intent is to focus in on the `"doesn't work"` spec and not to run the adjacent specs in the focused `"something to debug"` container. The nested policy applied by this function enables this behavior.
func MakeIncrementingIndexCounter ¶
func NewProgressReport ¶
func NewProgressReport(isRunningInParallel bool, report types.SpecReport, currentNode Node, currentNodeStartTime time.Time, currentStep ProgressStepCursor, gwOutput string, sourceRoots []string, includeAll bool) (types.ProgressReport, error)
func OrderSpecs ¶
func OrderSpecs(specs Specs, suiteConfig types.SuiteConfig) (GroupedSpecIndices, GroupedSpecIndices)
func PartitionDecorations ¶
func PartitionDecorations(args ...interface{}) ([]interface{}, []interface{})
func RegisterForProgressSignal ¶
func RegisterForProgressSignal(handler func()) context.CancelFunc
func UniqueNodeID ¶
func UniqueNodeID() uint
Types ¶
type Done ¶
type Done chan<- interface{} // Deprecated Done Channel for asynchronous testing
type Failer ¶
type Failer struct {
// contains filtered or unexported fields
}
func NewFailer ¶
func NewFailer() *Failer
func (*Failer) AbortSuite ¶
func (f *Failer) AbortSuite(message string, location types.CodeLocation)
func (*Failer) Drain ¶
func (*Failer) Fail ¶
func (f *Failer) Fail(message string, location types.CodeLocation)
func (*Failer) GetFailure ¶
func (*Failer) GetState ¶
func (*Failer) Panic ¶
func (f *Failer) Panic(location types.CodeLocation, forwardedPanic interface{})
func (*Failer) Skip ¶
func (f *Failer) Skip(message string, location types.CodeLocation)
type FlakeAttempts ¶
type FlakeAttempts uint
type GroupedSpecIndices ¶
type GroupedSpecIndices []SpecIndices
type Labels ¶
type Labels []string
func UnionOfLabels ¶
type Node ¶
type Node struct { ID uint NodeType types.NodeType Text string Body func() CodeLocation types.CodeLocation NestingLevel int SynchronizedBeforeSuiteProc1Body func() []byte SynchronizedBeforeSuiteAllProcsBody func([]byte) SynchronizedAfterSuiteAllProcsBody func() SynchronizedAfterSuiteProc1Body func() ReportEachBody func(types.SpecReport) ReportAfterSuiteBody func(types.Report) MarkedFocus bool MarkedPending bool MarkedSerial bool MarkedOrdered bool MarkedOncePerOrdered bool MarkedSuppressProgressReporting bool FlakeAttempts int Labels Labels PollProgressAfter time.Duration PollProgressInterval time.Duration NodeIDWhereCleanupWasGenerated uint }
func NewCleanupNode ¶
func NewCleanupNode(fail func(string, types.CodeLocation), args ...interface{}) (Node, []error)
func NewNode ¶
func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeType, text string, args ...interface{}) (Node, []error)
func (Node) IsZero ¶
type Nodes ¶
type Nodes []Node
Nodes
func (Nodes) BestTextFor ¶
func (Nodes) CodeLocations ¶
func (n Nodes) CodeLocations() []types.CodeLocation
func (Nodes) ContainsNodeID ¶
func (Nodes) CopyAppend ¶
func (Nodes) Filter ¶
func (Nodes) FirstNodeMarkedOrdered ¶
func (Nodes) FirstNodeWithType ¶
func (Nodes) FirstSatisfying ¶
func (Nodes) FirstWithNestingLevel ¶
func (Nodes) HasNodeMarkedFocus ¶
func (Nodes) HasNodeMarkedPending ¶
func (Nodes) HasNodeMarkedSerial ¶
func (Nodes) Labels ¶
func (Nodes) Reverse ¶
func (Nodes) SortedByAscendingNestingLevel ¶
func (Nodes) SortedByDescendingNestingLevel ¶
func (Nodes) SplitAround ¶
func (Nodes) Texts ¶
func (Nodes) UnionOfLabels ¶
func (Nodes) WithType ¶
func (Nodes) WithinNestingLevel ¶
func (Nodes) WithoutNode ¶
func (Nodes) WithoutType ¶
type NoopOutputInterceptor ¶
type NoopOutputInterceptor struct{}
func (NoopOutputInterceptor) PauseIntercepting ¶
func (interceptor NoopOutputInterceptor) PauseIntercepting()
func (NoopOutputInterceptor) ResumeIntercepting ¶
func (interceptor NoopOutputInterceptor) ResumeIntercepting()
func (NoopOutputInterceptor) Shutdown ¶
func (interceptor NoopOutputInterceptor) Shutdown()
func (NoopOutputInterceptor) StartInterceptingOutput ¶
func (interceptor NoopOutputInterceptor) StartInterceptingOutput()
func (NoopOutputInterceptor) StartInterceptingOutputAndForwardTo ¶
func (interceptor NoopOutputInterceptor) StartInterceptingOutputAndForwardTo(io.Writer)
func (NoopOutputInterceptor) StopInterceptingAndReturnOutput ¶
func (interceptor NoopOutputInterceptor) StopInterceptingAndReturnOutput() string
type Offset ¶
type Offset uint
type OutputInterceptor ¶
type OutputInterceptor interface { StartInterceptingOutput() StartInterceptingOutputAndForwardTo(io.Writer) StopInterceptingAndReturnOutput() string PauseIntercepting() ResumeIntercepting() Shutdown() }
The OutputInterceptor is used by to intercept and capture all stdin and stderr output during a test run.
func NewOSGlobalReassigningOutputInterceptor ¶
func NewOSGlobalReassigningOutputInterceptor() OutputInterceptor
This is used on windows builds but included here so it can be explicitly tested on unix systems too
type Phase ¶
type Phase uint
type PollProgressAfter ¶
type PollProgressInterval ¶
type ProgressSignalRegistrar ¶
type ProgressSignalRegistrar func(func()) context.CancelFunc
type ProgressStepCursor ¶
type ProgressStepCursor struct { Text string CodeLocation types.CodeLocation StartTime time.Time }
type ReportEntry ¶
type ReportEntry = types.ReportEntry
func NewReportEntry ¶
func NewReportEntry(name string, cl types.CodeLocation, args ...interface{}) (ReportEntry, error)
type Spec ¶
func (Spec) FirstNodeWithType ¶
func (Spec) FlakeAttempts ¶
func (Spec) SubjectID ¶
func (Spec) Text ¶
type SpecIndices ¶
type SpecIndices []int
type Specs ¶
type Specs []Spec
func ApplyFocusToSpecs ¶
func ApplyFocusToSpecs(specs Specs, description string, suiteLabels Labels, suiteConfig types.SuiteConfig) (Specs, bool)
Ginkgo supports focussing specs using `FIt`, `FDescribe`, etc. - this is called "programmatic focus" It also supports focussing specs using regular expressions on the command line (`-focus=`, `-skip=`) that match against spec text and file filters (`-focus-files=`, `-skip-files=`) that match against code locations for nodes in specs.
If any of the CLI flags are provided they take precedence. The file filters run first followed by the regex filters.
This function sets the `Skip` property on specs by applying Ginkgo's focus policy: - If there are no CLI arguments and no programmatic focus, do nothing. - If there are no CLI arguments but a spec somewhere has programmatic focus, skip any specs that have no programmatic focus. - If there are CLI arguments parse them and skip any specs that either don't match the focus filters or do match the skip filters.
*Note:* specs with pending nodes are Skipped when created by NewSpec.
func GenerateSpecsFromTreeRoot ¶
func (Specs) AtIndices ¶
func (s Specs) AtIndices(indices SpecIndices) Specs
func (Specs) CountWithoutSkip ¶
func (Specs) HasAnySpecsMarkedPending ¶
type Suite ¶
type Suite struct {
// contains filtered or unexported fields
}
func NewSuite ¶
func NewSuite() *Suite
func (*Suite) AddReportEntry ¶
func (suite *Suite) AddReportEntry(entry ReportEntry) error
func (*Suite) BuildTree ¶
func (*Suite) CurrentSpecReport ¶
func (suite *Suite) CurrentSpecReport() types.SpecReport
Spec Running methods - used during PhaseRun
func (*Suite) InRunPhase ¶
func (*Suite) PushNode ¶
func (*Suite) Run ¶
func (suite *Suite) Run(description string, suiteLabels Labels, suitePath string, failer *Failer, reporter reporters.Reporter, writer WriterInterface, outputInterceptor OutputInterceptor, interruptHandler interrupt_handler.InterruptHandlerInterface, client parallel_support.Client, progressSignalRegistrar ProgressSignalRegistrar, suiteConfig types.SuiteConfig) (bool, bool)
func (*Suite) SetProgressStepCursor ¶
func (suite *Suite) SetProgressStepCursor(cursor ProgressStepCursor)
type TreeNode ¶
func (*TreeNode) AncestorNodeChain ¶
func (*TreeNode) AppendChild ¶
type TreeNodes ¶
type TreeNodes []*TreeNode
func (TreeNodes) Nodes ¶
func (TreeNodes) WithID ¶
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
Writer implements WriterInterface and GinkgoWriterInterface
func NewWriter ¶
func (*Writer) Bytes ¶
func (*Writer) ClearTeeWriters ¶
func (w *Writer) ClearTeeWriters()
func (*Writer) Print ¶
func (w *Writer) Print(a ...interface{})
func (*Writer) Printf ¶
func (*Writer) Println ¶
func (w *Writer) Println(a ...interface{})
func (*Writer) SetMode ¶
func (w *Writer) SetMode(mode WriterMode)
func (*Writer) TeeTo ¶
GinkgoWriterInterface
func (*Writer) Truncate ¶
func (w *Writer) Truncate()
func (*Writer) Write ¶
type WriterInterface ¶
type WriterMode ¶
type WriterMode uint
const ( WriterModeStreamAndBuffer WriterMode = iota WriterModeBufferOnly )
Source Files ¶
counter.go failer.go focus.go group.go node.go ordering.go output_interceptor.go progress_report.go report_entry.go spec.go suite.go tree.go writer.go
Directories ¶
Path | Synopsis |
---|---|
internal/global | |
internal/internal_integration | |
internal/interrupt_handler | |
internal/parallel_support | |
internal/test_helpers | |
internal/testingtproxy |
- Version
- v2.2.0
- Published
- Sep 17, 2022
- Platform
- js/wasm
- Imports
- 22 packages
- Last checked
- 1 day ago –
Tools for package owners.