@@ -3,6 +3,7 @@ package testingtproxy_test
33import (
44 "os"
55 "runtime"
6+ "time"
67
78 . "github.com/onsi/ginkgo/v2"
89 . "github.com/onsi/gomega"
@@ -301,18 +302,47 @@ var _ = Describe("Testingtproxy", func() {
301302 Ω (string (buf .Contents ())).Should (Equal (" hi 3\n " ))
302303 })
303304
304- It ("can provides a correctly configured Ginkgo Formatter" , func () {
305+ It ("can provide a correctly configured Ginkgo Formatter" , func () {
305306 Ω (t .F ("{{blue}}%d{{/}}" , 3 )).Should (Equal ("3" ))
306307 })
307308
308- It ("can printf to the GinkgoWriter " , func () {
309+ It ("can provide a correctly configured Ginkgo Formatter, with indentation " , func () {
309310 Ω (t .Fi (1 , "{{blue}}%d{{/}}" , 3 )).Should (Equal (" 3" ))
310311 })
311312
312- It ("can println to the GinkgoWriter " , func () {
313+ It ("can provide a correctly configured Ginkgo Formatter, with indentation and width constraints " , func () {
313314 Ω (t .Fiw (1 , 5 , "{{blue}}%d{{/}} a number" , 3 )).Should (Equal (" 3 a\n number" ))
314315 })
315316
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+
316346 It ("can provide GinkgoRecover" , func () {
317347 Ω (recoverCall ).Should (BeFalse ())
318348 t .GinkgoRecover ()
0 commit comments