forked from onsi/ginkgo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
deprecated_dsl.go
135 lines (112 loc) · 4.78 KB
/
deprecated_dsl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
package ginkgo
import (
"time"
"github.com/onsi/ginkgo/v2/internal"
"github.com/onsi/ginkgo/v2/internal/global"
"github.com/onsi/ginkgo/v2/reporters"
"github.com/onsi/ginkgo/v2/types"
)
/*
Deprecated: Done Channel for asynchronous testing
The Done channel pattern is no longer supported in Ginkgo 2.0.
See here for better patterns for asynchronous testing: https://onsi.github.io/ginkgo/#patterns-for-asynchronous-testing
For a migration guide see: https://onsi.github.io/ginkgo/MIGRATING_TO_V2#removed-async-testing
*/
type Done = internal.Done
/*
Deprecated: Custom Ginkgo test reporters are deprecated in Ginkgo 2.0.
Use Ginkgo's reporting nodes instead and 2.0 reporting infrastructure instead. You can learn more here: https://onsi.github.io/ginkgo/#reporting-infrastructure
For a migration guide see: https://onsi.github.io/ginkgo/MIGRATING_TO_V2#removed-custom-reporters
*/
type Reporter = reporters.DeprecatedReporter
/*
Deprecated: Custom Reporters have been removed in Ginkgo 2.0. RunSpecsWithDefaultAndCustomReporters will simply call RunSpecs()
Use Ginkgo's reporting nodes instead and 2.0 reporting infrastructure instead. You can learn more here: https://onsi.github.io/ginkgo/#reporting-infrastructure
For a migration guide see: https://onsi.github.io/ginkgo/MIGRATING_TO_V2#removed-custom-reporters
*/
func RunSpecsWithDefaultAndCustomReporters(t GinkgoTestingT, description string, _ []Reporter) bool {
deprecationTracker.TrackDeprecation(types.Deprecations.CustomReporter())
return RunSpecs(t, description)
}
/*
Deprecated: Custom Reporters have been removed in Ginkgo 2.0. RunSpecsWithCustomReporters will simply call RunSpecs()
Use Ginkgo's reporting nodes instead and 2.0 reporting infrastructure instead. You can learn more here: https://onsi.github.io/ginkgo/#reporting-infrastructure
For a migration guide see: https://onsi.github.io/ginkgo/MIGRATING_TO_V2#removed-custom-reporters
*/
func RunSpecsWithCustomReporters(t GinkgoTestingT, description string, _ []Reporter) bool {
deprecationTracker.TrackDeprecation(types.Deprecations.CustomReporter())
return RunSpecs(t, description)
}
/*
Deprecated: GinkgoTestDescription has been replaced with SpecReport.
Use CurrentSpecReport() instead.
You can learn more here: https://onsi.github.io/ginkgo/#getting-a-report-for-the-current-spec
The SpecReport type is documented here: https://pkg.go.dev/github.com/onsi/ginkgo/v2/types#SpecReport
*/
type DeprecatedGinkgoTestDescription struct {
FullTestText string
ComponentTexts []string
TestText string
FileName string
LineNumber int
Failed bool
Duration time.Duration
}
type GinkgoTestDescription = DeprecatedGinkgoTestDescription
/*
Deprecated: CurrentGinkgoTestDescription has been replaced with CurrentSpecReport.
Use CurrentSpecReport() instead.
You can learn more here: https://onsi.github.io/ginkgo/#getting-a-report-for-the-current-spec
The SpecReport type is documented here: https://pkg.go.dev/github.com/onsi/ginkgo/v2/types#SpecReport
*/
func CurrentGinkgoTestDescription() DeprecatedGinkgoTestDescription {
deprecationTracker.TrackDeprecation(
types.Deprecations.CurrentGinkgoTestDescription(),
types.NewCodeLocation(1),
)
report := global.Suite.CurrentSpecReport()
if report.State == types.SpecStateInvalid {
return GinkgoTestDescription{}
}
componentTexts := []string{}
componentTexts = append(componentTexts, report.ContainerHierarchyTexts...)
componentTexts = append(componentTexts, report.LeafNodeText)
return DeprecatedGinkgoTestDescription{
ComponentTexts: componentTexts,
FullTestText: report.FullText(),
TestText: report.LeafNodeText,
FileName: report.LeafNodeLocation.FileName,
LineNumber: report.LeafNodeLocation.LineNumber,
Failed: report.State.Is(types.SpecStateFailureStates),
Duration: report.RunTime,
}
}
/*
Deprecated: GinkgoParallelNode() has been renamed to GinkgoParallelProcess()
*/
func GinkgoParallelNode() int {
deprecationTracker.TrackDeprecation(
types.Deprecations.ParallelNode(),
types.NewCodeLocation(1),
)
return GinkgoParallelProcess()
}
/*
Deprecated: Benchmarker has been removed from Ginkgo 2.0
Use Gomega's gmeasure package instead.
You can learn more here: https://onsi.github.io/ginkgo/#benchmarking-code
*/
type Benchmarker interface {
Time(name string, body func(), info ...interface{}) (elapsedTime time.Duration)
RecordValue(name string, value float64, info ...interface{})
RecordValueWithPrecision(name string, value float64, units string, precision int, info ...interface{})
}
/*
Deprecated: Measure() has been removed from Ginkgo 2.0
Use Gomega's gmeasure package instead.
You can learn more here: https://onsi.github.io/ginkgo/#benchmarking-code
*/
func Measure(_ ...interface{}) bool {
deprecationTracker.TrackDeprecation(types.Deprecations.Measure(), types.NewCodeLocation(1))
return true
}