@@ -59,11 +59,11 @@ func ParseTestResults(r io.Reader, verbose bool, env *ctrf.Environment) (*ctrf.R
59
59
report .Results .Summary .Stop = endTime
60
60
}
61
61
}
62
-
63
62
if event .Action == "pass" {
64
63
report .Results .Summary .Tests ++
65
64
report .Results .Summary .Passed ++
66
65
report .Results .Tests = append (report .Results .Tests , & ctrf.TestResult {
66
+ Suite : event .Package ,
67
67
Name : event .Test ,
68
68
Status : ctrf .TestPassed ,
69
69
Duration : duration ,
@@ -72,6 +72,7 @@ func ParseTestResults(r io.Reader, verbose bool, env *ctrf.Environment) (*ctrf.R
72
72
report .Results .Summary .Tests ++
73
73
report .Results .Summary .Failed ++
74
74
report .Results .Tests = append (report .Results .Tests , & ctrf.TestResult {
75
+ Suite : event .Package ,
75
76
Name : event .Test ,
76
77
Status : ctrf .TestFailed ,
77
78
Duration : duration ,
@@ -80,11 +81,13 @@ func ParseTestResults(r io.Reader, verbose bool, env *ctrf.Environment) (*ctrf.R
80
81
report .Results .Summary .Tests ++
81
82
report .Results .Summary .Skipped ++
82
83
report .Results .Tests = append (report .Results .Tests , & ctrf.TestResult {
84
+ Suite : event .Package ,
83
85
Name : event .Test ,
84
86
Status : ctrf .TestSkipped ,
85
87
Duration : duration ,
86
88
})
87
89
}
90
+
88
91
}
89
92
return report , nil
90
93
}
@@ -94,25 +97,19 @@ func WriteReportToFile(filename string, report *ctrf.Report) error {
94
97
if err != nil {
95
98
return err
96
99
}
97
-
98
100
fmt .Println ("go-ctrf-json-reporter: successfully written ctrf json to" , filename )
99
101
return nil
100
102
}
101
103
102
104
func secondsToMillis (seconds float64 ) int64 {
103
105
return int64 (seconds * 1000 )
104
106
}
105
- func parseTimeString (timeString string ) (int64 , error ) {
106
- // Define the layout for parsing the time string
107
- layout := time .RFC3339Nano
108
107
109
- // Parse the time string
108
+ func parseTimeString (timeString string ) (int64 , error ) {
109
+ layout := time .RFC3339Nano
110
110
t , err := time .Parse (layout , timeString )
111
111
if err != nil {
112
112
return 0 , err
113
113
}
114
-
115
- // Convert the time to Unix timestamp in milliseconds
116
- timestamp := t .UnixNano () / int64 (time .Millisecond )
117
- return timestamp , nil
114
+ return t .UnixNano () / int64 (time .Millisecond ), nil
118
115
}
0 commit comments