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