internal

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: May 1, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const Focus = focusType(true)
View Source
const Pending = pendingType(true)
View Source
const TIMEOUT_REPEAT_INTERRUPT_FRACTION_OF_TIMEOUT = 10
View Source
const TIMEOUT_REPEAT_INTERRUPT_MAXIMUM_DURATION = 30 * time.Second

Variables

This section is empty.

Functions

func MakeNextIndexCounter

func MakeNextIndexCounter(suiteConfig types.SuiteConfig) func() (int, error)

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) Drain

func (f *Failer) Drain() (types.SpecState, types.Failure)

func (*Failer) Fail

func (f *Failer) Fail(message string, location types.CodeLocation)

func (*Failer) GetFailure

func (f *Failer) GetFailure() types.Failure

func (*Failer) GetState

func (f *Failer) GetState() types.SpecState

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 InterruptHandler

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

func NewInterruptHandler

func NewInterruptHandler(timeout time.Duration) *InterruptHandler

func (*InterruptHandler) ClearInterruptMessage

func (handler *InterruptHandler) ClearInterruptMessage()

func (*InterruptHandler) InterruptMessageWithStackTraces

func (handler *InterruptHandler) InterruptMessageWithStackTraces() string

func (*InterruptHandler) SetInterruptMessage

func (handler *InterruptHandler) SetInterruptMessage(message string)

func (*InterruptHandler) Status

func (handler *InterruptHandler) Status() InterruptStatus

func (*InterruptHandler) Stop

func (handler *InterruptHandler) Stop()

type InterruptHandlerInterface

type InterruptHandlerInterface interface {
	Status() InterruptStatus
	SetInterruptMessage(string)
	ClearInterruptMessage()
	InterruptMessageWithStackTraces() string
}

type InterruptStatus

type InterruptStatus struct {
	Interrupted bool
	Channel     chan interface{}
	Cause       string
}

type Node

type Node struct {
	ID       uint
	NodeType types.NodeType

	Text         string
	Body         func()
	CodeLocation types.CodeLocation
	NestingLevel int

	SynchronizedBeforeSuiteNode1Body    func() []byte
	SynchronizedBeforeSuiteAllNodesBody func([]byte)

	SynchronizedAfterSuiteAllNodesBody func()
	SynchronizedAfterSuiteNode1Body    func()

	ReportAfterEachBody  func(types.SpecReport)
	ReportAfterSuiteBody func(types.Report)

	MarkedFocus   bool
	MarkedPending bool
	FlakeAttempts int
}

func NewNode

func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeType, text string, args ...interface{}) (Node, []error)

func NewReportAfterEachNode

func NewReportAfterEachNode(body func(types.SpecReport), codeLocation types.CodeLocation) (Node, []error)

func NewReportAfterSuiteNode

func NewReportAfterSuiteNode(text string, body func(types.Report), codeLocation types.CodeLocation) (Node, []error)

func NewSynchronizedAfterSuiteNode

func NewSynchronizedAfterSuiteNode(allNodesBody func(), node1Body func(), codeLocation types.CodeLocation) (Node, []error)

func NewSynchronizedBeforeSuiteNode

func NewSynchronizedBeforeSuiteNode(node1Body func() []byte, allNodesBody func([]byte), codeLocation types.CodeLocation) (Node, []error)

func (Node) IsZero

func (n Node) IsZero() bool

type Nodes

type Nodes []Node

Nodes

func (Nodes) BestTextFor

func (n Nodes) BestTextFor(node Node) string

func (Nodes) CodeLocations

func (n Nodes) CodeLocations() []types.CodeLocation

func (Nodes) CopyAppend

func (n Nodes) CopyAppend(nodes ...Node) Nodes

func (Nodes) FirstNodeWithType

func (n Nodes) FirstNodeWithType(nodeTypes ...types.NodeType) Node

func (Nodes) HasNodeMarkedFocus

func (n Nodes) HasNodeMarkedFocus() bool

func (Nodes) HasNodeMarkedPending

func (n Nodes) HasNodeMarkedPending() bool

func (Nodes) SortedByAscendingNestingLevel

func (n Nodes) SortedByAscendingNestingLevel() Nodes

func (Nodes) SortedByDescendingNestingLevel

func (n Nodes) SortedByDescendingNestingLevel() Nodes

func (Nodes) SplitAround

func (n Nodes) SplitAround(pivot Node) (Nodes, Nodes)

func (Nodes) Texts

func (n Nodes) Texts() []string

func (Nodes) WithType

func (n Nodes) WithType(nodeTypes ...types.NodeType) Nodes

func (Nodes) WithinNestingLevel

func (n Nodes) WithinNestingLevel(deepestNestingLevel int) Nodes

func (Nodes) WithoutType

func (n Nodes) WithoutType(nodeTypes ...types.NodeType) Nodes

type NoopOutputInterceptor

type NoopOutputInterceptor struct{}

func (NoopOutputInterceptor) StartInterceptingOutput

func (interceptor NoopOutputInterceptor) StartInterceptingOutput()

func (NoopOutputInterceptor) StopInterceptingAndReturnOutput

func (interceptor NoopOutputInterceptor) StopInterceptingAndReturnOutput() string

type Offset

type Offset uint

type OutputInterceptor

type OutputInterceptor interface {
	StartInterceptingOutput()
	StopInterceptingAndReturnOutput() string
}

The OutputInterceptor is used by to intercept and capture all stdin and stderr output during a test run.

func NewOutputInterceptor

func NewOutputInterceptor() OutputInterceptor

type Phase

type Phase uint
const (
	PhaseBuildTopLevel Phase = iota
	PhaseBuildTree
	PhaseRun
)

type Spec

type Spec struct {
	Nodes Nodes
	Skip  bool
}

func (Spec) FirstNodeWithType

func (s Spec) FirstNodeWithType(nodeTypes ...types.NodeType) Node

func (Spec) FlakeAttempts

func (s Spec) FlakeAttempts() int

func (Spec) Text

func (s Spec) Text() string

type Specs

type Specs []Spec

func ApplyFocusToSpecs

func ApplyFocusToSpecs(specs Specs, description string, 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=`). The CLI regular expressions take precedence.

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 filter regexp or do match* the skip regexp.

Lastly, `suiteConfig.RegexScansFilePath` allows the regular exprressions to match against the spec's filepath as well as the spec's text.

*Note:* specs with pending nodes are Skipped when created by NewSpec.

func GenerateSpecsFromTreeRoot

func GenerateSpecsFromTreeRoot(tree TreeNode) Specs

func ShuffleSpecs

func ShuffleSpecs(specs Specs, suiteConfig types.SuiteConfig) Specs

func (Specs) CountWithoutSkip

func (s Specs) CountWithoutSkip() int

func (Specs) HasAnySpecsMarkedPending

func (s Specs) HasAnySpecsMarkedPending() bool

func (Specs) PartitionByFirstNodeWithType

func (s Specs) PartitionByFirstNodeWithType(nodeTypes ...types.NodeType) []Specs

type Suite

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

func NewSuite

func NewSuite() *Suite

func (*Suite) BuildTree

func (suite *Suite) BuildTree() error

func (*Suite) CurrentSpecReport

func (suite *Suite) CurrentSpecReport() types.SpecReport

Spec Running methods - used during PhaseRun

func (*Suite) PushNode

func (suite *Suite) PushNode(node Node) error

func (*Suite) Run

func (suite *Suite) Run(description string, suitePath string, failer *Failer, reporter reporters.Reporter, writer WriterInterface, outputInterceptor OutputInterceptor, interruptHandler InterruptHandlerInterface, suiteConfig types.SuiteConfig) (bool, bool)

func (*Suite) StartInterceptingOutput

func (interceptor *Suite) StartInterceptingOutput()

func (*Suite) StopInterceptingAndReturnOutput

func (interceptor *Suite) StopInterceptingAndReturnOutput() string

type TreeNode

type TreeNode struct {
	Node     Node
	Children TreeNodes
}

func AppendTreeNodeChild

func AppendTreeNodeChild(treeNode TreeNode, child TreeNode) TreeNode

func ApplyNestedFocusPolicyToTree

func ApplyNestedFocusPolicyToTree(tree TreeNode) 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.

type TreeNodes

type TreeNodes []TreeNode

func (TreeNodes) Nodes

func (tn TreeNodes) Nodes() Nodes

func (TreeNodes) WithID

func (tn TreeNodes) WithID(id uint) TreeNode

type Writer

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

Writer impplements WriterInterface and GinkgoWriterInterface

func NewWriter

func NewWriter(outWriter io.Writer) *Writer

func (*Writer) Bytes

func (w *Writer) Bytes() []byte

func (*Writer) ClearTeeWriters

func (w *Writer) ClearTeeWriters()

func (*Writer) Print

func (w *Writer) Print(a ...interface{})

func (*Writer) Printf

func (w *Writer) Printf(format string, a ...interface{})

func (*Writer) Println

func (w *Writer) Println(a ...interface{})

func (*Writer) SetMode

func (w *Writer) SetMode(mode WriterMode)

func (*Writer) TeeTo

func (w *Writer) TeeTo(writer io.Writer)

GinkgoWriterInterface

func (*Writer) Truncate

func (w *Writer) Truncate()

func (*Writer) Write

func (w *Writer) Write(b []byte) (n int, err error)

type WriterInterface

type WriterInterface interface {
	io.Writer

	Truncate()
	Bytes() []byte
}

type WriterMode

type WriterMode uint
const (
	WriterModeStreamAndBuffer WriterMode = iota
	WriterModeBufferOnly
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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