rebase: bump github.com/onsi/ginkgo/v2 from 2.1.4 to 2.1.6

Bumps [github.com/onsi/ginkgo/v2](https://github.com/onsi/ginkgo) from 2.1.4 to 2.1.6.
- [Release notes](https://github.com/onsi/ginkgo/releases)
- [Changelog](https://github.com/onsi/ginkgo/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/ginkgo/compare/v2.1.4...v2.1.6)

---
updated-dependencies:
- dependency-name: github.com/onsi/ginkgo/v2
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2022-09-05 20:11:08 +00:00
committed by mergify[bot]
parent 36b061d426
commit 4a1591236d
18 changed files with 164 additions and 68 deletions

View File

@ -1,3 +1,31 @@
## 2.1.6
### Fixes
- Add `SuppressProgressReporting` decorator to turn off --progress announcements for a given node [dfef62a]
- chore: remove duplicate word in comments [7373214]
## 2.1.5
### Fixes
- drop -mod=mod instructions; fixes #1026 [6ad7138]
- Ensure `CurrentSpecReport` and `AddReportEntry` are thread-safe [817c09b]
- remove stale importmap gcflags flag test [3cd8b93]
- Always emit spec summary [5cf23e2] - even when only one spec has failed
- Fix ReportAfterSuite usage in docs [b1864ad]
- fixed typo (#997) [219cc00]
- TrimRight is not designed to trim Suffix [71ebb74]
- refactor: replace strings.Replace with strings.ReplaceAll (#978) [143d208]
- fix syntax in examples (#975) [b69554f]
### Maintenance
- Bump github.com/onsi/gomega from 1.20.0 to 1.20.1 (#1027) [e5dfce4]
- Bump tzinfo from 1.2.9 to 1.2.10 in /docs (#1006) [7ae91c4]
- Bump github.com/onsi/gomega from 1.19.0 to 1.20.0 (#1005) [e87a85a]
- test: add new Go 1.19 to test matrix (#1014) [bbefe12]
- Bump golang.org/x/tools from 0.1.11 to 0.1.12 (#1012) [9327906]
- Bump golang.org/x/tools from 0.1.10 to 0.1.11 (#993) [f44af96]
- Bump nokogiri from 1.13.3 to 1.13.6 in /docs (#981) [ef336aa]
## 2.1.4
### Fixes

View File

@ -630,7 +630,7 @@ func JustAfterEach(args ...interface{}) bool {
}
/*
BeforeAll nodes are Setup nodes that can occur inside Ordered contaienrs. They run just once before any specs in the Ordered container run.
BeforeAll nodes are Setup nodes that can occur inside Ordered containers. They run just once before any specs in the Ordered container run.
Multiple BeforeAll nodes can be defined in a given Ordered container however they cannot be nested inside any other container.
@ -643,7 +643,7 @@ func BeforeAll(args ...interface{}) bool {
}
/*
AfterAll nodes are Setup nodes that can occur inside Ordered contaienrs. They run just once after all specs in the Ordered container have run.
AfterAll nodes are Setup nodes that can occur inside Ordered containers. They run just once after all specs in the Ordered container have run.
Multiple AfterAll nodes can be defined in a given Ordered container however they cannot be nested inside any other container.

View File

@ -80,3 +80,9 @@ Labels are the type for spec Label decorators. Use Label(...) to construct Labe
You can learn more here: https://onsi.github.io/ginkgo/#spec-labels
*/
type Labels = internal.Labels
/*
SuppressProgressReporting is a decorator that allows you to disable progress reporting of a particular node. This is useful if `ginkgo -v -progress` is generating too much noise; particularly
if you have a `ReportAfterEach` node that is running for every skipped spec and is generating lots of progress reports.
*/
const SuppressProgressReporting = internal.SuppressProgressReporting

View File

@ -40,13 +40,14 @@ type Node struct {
ReportEachBody func(types.SpecReport)
ReportAfterSuiteBody func(types.Report)
MarkedFocus bool
MarkedPending bool
MarkedSerial bool
MarkedOrdered bool
MarkedOncePerOrdered bool
FlakeAttempts int
Labels Labels
MarkedFocus bool
MarkedPending bool
MarkedSerial bool
MarkedOrdered bool
MarkedOncePerOrdered bool
MarkedSuppressProgressReporting bool
FlakeAttempts int
Labels Labels
NodeIDWhereCleanupWasGenerated uint
}
@ -57,12 +58,14 @@ type pendingType bool
type serialType bool
type orderedType bool
type honorsOrderedType bool
type suppressProgressReporting bool
const Focus = focusType(true)
const Pending = pendingType(true)
const Serial = serialType(true)
const Ordered = orderedType(true)
const OncePerOrdered = honorsOrderedType(true)
const SuppressProgressReporting = suppressProgressReporting(true)
type FlakeAttempts uint
type Offset uint
@ -114,6 +117,8 @@ func isDecoration(arg interface{}) bool {
return true
case t == reflect.TypeOf(OncePerOrdered):
return true
case t == reflect.TypeOf(SuppressProgressReporting):
return true
case t == reflect.TypeOf(FlakeAttempts(0)):
return true
case t == reflect.TypeOf(Labels{}):
@ -176,7 +181,6 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
remainingArgs = []interface{}{}
//now process the rest of the args
for _, arg := range args {
switch t := reflect.TypeOf(arg); {
case t == reflect.TypeOf(float64(0)):
break //ignore deprecated timeouts
@ -205,6 +209,11 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
if !nodeType.Is(types.NodeTypeBeforeEach | types.NodeTypeJustBeforeEach | types.NodeTypeAfterEach | types.NodeTypeJustAfterEach) {
appendError(types.GinkgoErrors.InvalidDecoratorForNodeType(node.CodeLocation, nodeType, "OncePerOrdered"))
}
case t == reflect.TypeOf(SuppressProgressReporting):
node.MarkedSuppressProgressReporting = bool(arg.(suppressProgressReporting))
if nodeType.Is(types.NodeTypeContainer) {
appendError(types.GinkgoErrors.InvalidDecoratorForNodeType(node.CodeLocation, nodeType, "SuppressProgressReporting"))
}
case t == reflect.TypeOf(FlakeAttempts(0)):
node.FlakeAttempts = int(arg.(FlakeAttempts))
if !nodeType.Is(types.NodeTypesForContainerAndIt) {
@ -223,6 +232,18 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
}
}
case t.Kind() == reflect.Func:
if nodeType.Is(types.NodeTypeReportBeforeEach | types.NodeTypeReportAfterEach) {
if node.ReportEachBody != nil {
appendError(types.GinkgoErrors.MultipleBodyFunctions(node.CodeLocation, nodeType))
trackedFunctionError = true
break
}
//we can trust that the function is valid because the compiler has our back here
node.ReportEachBody = arg.(func(types.SpecReport))
break
}
if node.Body != nil {
appendError(types.GinkgoErrors.MultipleBodyFunctions(node.CodeLocation, nodeType))
trackedFunctionError = true
@ -251,7 +272,7 @@ func NewNode(deprecationTracker *types.DeprecationTracker, nodeType types.NodeTy
appendError(types.GinkgoErrors.InvalidDeclarationOfFocusedAndPending(node.CodeLocation, nodeType))
}
if node.Body == nil && !node.MarkedPending && !trackedFunctionError {
if node.Body == nil && node.ReportEachBody == nil && !node.MarkedPending && !trackedFunctionError {
appendError(types.GinkgoErrors.MissingBodyFunction(node.CodeLocation, nodeType))
}
for _, arg := range remainingArgs {
@ -285,26 +306,6 @@ func NewSynchronizedAfterSuiteNode(allProcsBody func(), proc1Body func(), codeLo
}, nil
}
func NewReportBeforeEachNode(body func(types.SpecReport), codeLocation types.CodeLocation) (Node, []error) {
return Node{
ID: UniqueNodeID(),
NodeType: types.NodeTypeReportBeforeEach,
ReportEachBody: body,
CodeLocation: codeLocation,
NestingLevel: -1,
}, nil
}
func NewReportAfterEachNode(body func(types.SpecReport), codeLocation types.CodeLocation) (Node, []error) {
return Node{
ID: UniqueNodeID(),
NodeType: types.NodeTypeReportAfterEach,
ReportEachBody: body,
CodeLocation: codeLocation,
NestingLevel: -1,
}, nil
}
func NewReportAfterSuiteNode(text string, body func(types.Report), codeLocation types.CodeLocation) (Node, []error) {
return Node{
ID: UniqueNodeID(),

View File

@ -2,6 +2,7 @@ package internal
import (
"fmt"
"sync"
"time"
"github.com/onsi/ginkgo/v2/formatter"
@ -35,18 +36,20 @@ type Suite struct {
interruptHandler interrupt_handler.InterruptHandlerInterface
config types.SuiteConfig
skipAll bool
report types.Report
currentSpecReport types.SpecReport
currentNode Node
skipAll bool
report types.Report
currentSpecReport types.SpecReport
currentSpecReportUserAccessLock *sync.Mutex
currentNode Node
client parallel_support.Client
}
func NewSuite() *Suite {
return &Suite{
tree: &TreeNode{},
phase: PhaseBuildTopLevel,
tree: &TreeNode{},
phase: PhaseBuildTopLevel,
currentSpecReportUserAccessLock: &sync.Mutex{},
}
}
@ -212,14 +215,20 @@ func (suite *Suite) pushCleanupNode(node Node) error {
Spec Running methods - used during PhaseRun
*/
func (suite *Suite) CurrentSpecReport() types.SpecReport {
suite.currentSpecReportUserAccessLock.Lock()
defer suite.currentSpecReportUserAccessLock.Unlock()
report := suite.currentSpecReport
if suite.writer != nil {
report.CapturedGinkgoWriterOutput = string(suite.writer.Bytes())
}
report.ReportEntries = make([]ReportEntry, len(report.ReportEntries))
copy(report.ReportEntries, suite.currentSpecReport.ReportEntries)
return report
}
func (suite *Suite) AddReportEntry(entry ReportEntry) error {
suite.currentSpecReportUserAccessLock.Lock()
defer suite.currentSpecReportUserAccessLock.Unlock()
if suite.phase != PhaseRun {
return types.GinkgoErrors.AddReportEntryNotDuringRunPhase(entry.Location)
}
@ -560,7 +569,7 @@ func (suite *Suite) runNode(node Node, interruptChannel chan interface{}, text s
suite.currentNode = Node{}
}()
if suite.config.EmitSpecProgress {
if suite.config.EmitSpecProgress && !node.MarkedSuppressProgressReporting {
if text == "" {
text = "TOP-LEVEL"
}

View File

@ -251,9 +251,13 @@ func (r *DefaultReporter) DidRun(report types.SpecReport) {
func (r *DefaultReporter) SuiteDidEnd(report types.Report) {
failures := report.SpecReports.WithState(types.SpecStateFailureStates)
if len(failures) > 1 {
if len(failures) > 0 {
r.emitBlock("\n\n")
r.emitBlock(r.f("{{red}}{{bold}}Summarizing %d Failures:{{/}}", len(failures)))
if len(failures) > 1 {
r.emitBlock(r.f("{{red}}{{bold}}Summarizing %d Failures:{{/}}", len(failures)))
} else {
r.emitBlock(r.f("{{red}}{{bold}}Summarizing 1 Failure:{{/}}"))
}
for _, specReport := range failures {
highlightColor, heading := "{{red}}", "[FAIL]"
switch specReport.State {

View File

@ -17,12 +17,12 @@ import (
)
func tcEscape(s string) string {
s = strings.Replace(s, "|", "||", -1)
s = strings.Replace(s, "'", "|'", -1)
s = strings.Replace(s, "\n", "|n", -1)
s = strings.Replace(s, "\r", "|r", -1)
s = strings.Replace(s, "[", "|[", -1)
s = strings.Replace(s, "]", "|]", -1)
s = strings.ReplaceAll(s, "|", "||")
s = strings.ReplaceAll(s, "'", "|'")
s = strings.ReplaceAll(s, "\n", "|n")
s = strings.ReplaceAll(s, "\r", "|r")
s = strings.ReplaceAll(s, "[", "|[")
s = strings.ReplaceAll(s, "]", "|]")
return s
}

View File

@ -79,8 +79,11 @@ receives a SpecReport. They are called before the spec starts.
You cannot nest any other Ginkgo nodes within a ReportBeforeEach node's closure.
You can learn more about ReportBeforeEach here: https://onsi.github.io/ginkgo/#generating-reports-programmatically
*/
func ReportBeforeEach(body func(SpecReport)) bool {
return pushNode(internal.NewReportBeforeEachNode(body, types.NewCodeLocation(1)))
func ReportBeforeEach(body func(SpecReport), args ...interface{}) bool {
combinedArgs := []interface{}{body}
combinedArgs = append(combinedArgs, args...)
return pushNode(internal.NewNode(deprecationTracker, types.NodeTypeReportBeforeEach, "", combinedArgs...))
}
/*
@ -90,8 +93,11 @@ receives a SpecReport. They are called after the spec has completed and receive
You cannot nest any other Ginkgo nodes within a ReportAfterEach node's closure.
You can learn more about ReportAfterEach here: https://onsi.github.io/ginkgo/#generating-reports-programmatically
*/
func ReportAfterEach(body func(SpecReport)) bool {
return pushNode(internal.NewReportAfterEachNode(body, types.NewCodeLocation(1)))
func ReportAfterEach(body func(SpecReport), args ...interface{}) bool {
combinedArgs := []interface{}{body}
combinedArgs = append(combinedArgs, args...)
return pushNode(internal.NewNode(deprecationTracker, types.NodeTypeReportAfterEach, "", combinedArgs...))
}
/*

View File

@ -65,7 +65,7 @@ func NewCodeLocationWithStackTrace(skip int) CodeLocation {
func PruneStack(fullStackTrace string, skip int) string {
stack := strings.Split(fullStackTrace, "\n")
// Ensure that the even entries are the method names and the
// the odd entries the source code information.
// odd entries the source code information.
if len(stack) > 0 && strings.HasPrefix(stack[0], "goroutine ") {
// Ignore "goroutine 29 [running]:" line.
stack = stack[1:]

View File

@ -1,3 +1,3 @@
package types
const VERSION = "2.1.4"
const VERSION = "2.1.6"