@@ -3,6 +3,7 @@ package testingtproxy_test
3
3
import (
4
4
"os"
5
5
"runtime"
6
+ "time"
6
7
7
8
. "github.com/onsi/ginkgo/v2"
8
9
. "github.com/onsi/gomega"
@@ -301,18 +302,47 @@ var _ = Describe("Testingtproxy", func() {
301
302
Ω (string (buf .Contents ())).Should (Equal (" hi 3\n " ))
302
303
})
303
304
304
- It ("can provides a correctly configured Ginkgo Formatter" , func () {
305
+ It ("can provide a correctly configured Ginkgo Formatter" , func () {
305
306
Ω (t .F ("{{blue}}%d{{/}}" , 3 )).Should (Equal ("3" ))
306
307
})
307
308
308
- It ("can printf to the GinkgoWriter " , func () {
309
+ It ("can provide a correctly configured Ginkgo Formatter, with indentation " , func () {
309
310
Ω (t .Fi (1 , "{{blue}}%d{{/}}" , 3 )).Should (Equal (" 3" ))
310
311
})
311
312
312
- It ("can println to the GinkgoWriter " , func () {
313
+ It ("can provide a correctly configured Ginkgo Formatter, with indentation and width constraints " , func () {
313
314
Ω (t .Fiw (1 , 5 , "{{blue}}%d{{/}} a number" , 3 )).Should (Equal (" 3 a\n number" ))
314
315
})
315
316
317
+ It ("can render the timeline of the current spec" , func () {
318
+ cl := types .NewCustomCodeLocation ("cl" )
319
+ reportToReturn .CapturedGinkgoWriterOutput = "ABCDEFGHIJKLMNOP"
320
+ reportToReturn .SpecEvents = append (reportToReturn .SpecEvents , types.SpecEvent {
321
+ TimelineLocation : types.TimelineLocation {Offset : 5 , Order : 1 },
322
+ SpecEventType : types .SpecEventNodeStart ,
323
+ Message : "The Test" ,
324
+ CodeLocation : cl ,
325
+ NodeType : types .NodeTypeIt ,
326
+ })
327
+ reportToReturn .SpecEvents = append (reportToReturn .SpecEvents , types.SpecEvent {
328
+ TimelineLocation : types.TimelineLocation {Offset : 10 , Order : 3 },
329
+ SpecEventType : types .SpecEventNodeEnd ,
330
+ Message : "The Test" ,
331
+ CodeLocation : cl ,
332
+ NodeType : types .NodeTypeIt ,
333
+ Duration : time .Second ,
334
+ })
335
+ reportToReturn .State = types .SpecStateFailed
336
+ reportToReturn .Failure = types.Failure {
337
+ Message : "The Failure" ,
338
+ FailureNodeType : types .NodeTypeIt ,
339
+ Location : cl ,
340
+ TimelineLocation : types.TimelineLocation {Offset : 10 , Order : 2 },
341
+ }
342
+
343
+ Ω (t .RenderTimeline ()).Should (Equal ("ABCDE\n > Enter \x1b [1m[It]\x1b [0m The Test \x1b [38;5;243m- cl @ 01/01/01 00:00:00\x1b [0m\n FGHIJ\n \x1b [38;5;9m[FAILED] The Failure\x1b [0m\n \x1b [38;5;9mIn \x1b [1m[It]\x1b [0m\x1b [38;5;9m at: \x1b [1mcl\x1b [0m \x1b [38;5;243m@ 01/01/01 00:00:00\x1b [0m\n < Exit \x1b [1m[It]\x1b [0m The Test \x1b [38;5;243m- cl @ 01/01/01 00:00:00 (1s)\x1b [0m\n KLMNOP" ))
344
+ })
345
+
316
346
It ("can provide GinkgoRecover" , func () {
317
347
Ω (recoverCall ).Should (BeFalse ())
318
348
t .GinkgoRecover ()
0 commit comments