2
2
// SPDX-License-Identifier: MIT OR Apache-2.0
3
3
4
4
use crate :: { serialize:: serialize_report, SerializeError } ;
5
+ #[ cfg( feature = "timestamps" ) ]
5
6
use chrono:: { DateTime , FixedOffset } ;
6
7
use indexmap:: map:: IndexMap ;
7
8
#[ cfg( feature = "uuids" ) ]
@@ -41,6 +42,7 @@ pub struct Report {
41
42
/// The time at which the first test in this report began execution.
42
43
///
43
44
/// This is not part of the JUnit spec, but may be useful for some tools.
45
+ #[ cfg( feature = "timestamps" ) ]
44
46
pub timestamp : Option < DateTime < FixedOffset > > ,
45
47
46
48
/// The overall time taken by the test suite.
@@ -68,6 +70,7 @@ impl Report {
68
70
name : name. into ( ) ,
69
71
#[ cfg( feature = "uuids" ) ]
70
72
uuid : None ,
73
+ #[ cfg( feature = "timestamps" ) ]
71
74
timestamp : None ,
72
75
time : None ,
73
76
tests : 0 ,
@@ -96,6 +99,7 @@ impl Report {
96
99
}
97
100
98
101
/// Sets the start timestamp for the report.
102
+ #[ cfg( feature = "timestamps" ) ]
99
103
pub fn set_timestamp ( & mut self , timestamp : impl Into < DateTime < FixedOffset > > ) -> & mut Self {
100
104
self . timestamp = Some ( timestamp. into ( ) ) ;
101
105
self
@@ -174,6 +178,7 @@ pub struct TestSuite {
174
178
pub failures : usize ,
175
179
176
180
/// The time at which the TestSuite began execution.
181
+ #[ cfg( feature = "timestamps" ) ]
177
182
pub timestamp : Option < DateTime < FixedOffset > > ,
178
183
179
184
/// The overall time taken by the TestSuite.
@@ -201,6 +206,7 @@ impl TestSuite {
201
206
Self {
202
207
name : name. into ( ) ,
203
208
time : None ,
209
+ #[ cfg( feature = "timestamps" ) ]
204
210
timestamp : None ,
205
211
tests : 0 ,
206
212
disabled : 0 ,
@@ -215,6 +221,7 @@ impl TestSuite {
215
221
}
216
222
217
223
/// Sets the start timestamp for the TestSuite.
224
+ #[ cfg( feature = "timestamps" ) ]
218
225
pub fn set_timestamp ( & mut self , timestamp : impl Into < DateTime < FixedOffset > > ) -> & mut Self {
219
226
self . timestamp = Some ( timestamp. into ( ) ) ;
220
227
self
@@ -318,6 +325,7 @@ pub struct TestCase {
318
325
/// The time at which this test case began execution.
319
326
///
320
327
/// This is not part of the JUnit spec, but may be useful for some tools.
328
+ #[ cfg( feature = "timestamps" ) ]
321
329
pub timestamp : Option < DateTime < FixedOffset > > ,
322
330
323
331
/// The time it took to execute this test case.
@@ -346,6 +354,7 @@ impl TestCase {
346
354
name : name. into ( ) ,
347
355
classname : None ,
348
356
assertions : None ,
357
+ #[ cfg( feature = "timestamps" ) ]
349
358
timestamp : None ,
350
359
time : None ,
351
360
status,
@@ -369,6 +378,7 @@ impl TestCase {
369
378
}
370
379
371
380
/// Sets the start timestamp for the test case.
381
+ #[ cfg( feature = "timestamps" ) ]
372
382
pub fn set_timestamp ( & mut self , timestamp : impl Into < DateTime < FixedOffset > > ) -> & mut Self {
373
383
self . timestamp = Some ( timestamp. into ( ) ) ;
374
384
self
@@ -557,6 +567,7 @@ pub struct TestRerun {
557
567
/// The time at which this rerun began execution.
558
568
///
559
569
/// This is not part of the JUnit spec, but may be useful for some tools.
570
+ #[ cfg( feature = "timestamps" ) ]
560
571
pub timestamp : Option < DateTime < FixedOffset > > ,
561
572
562
573
/// The time it took to execute this rerun.
@@ -590,6 +601,7 @@ impl TestRerun {
590
601
pub fn new ( kind : NonSuccessKind ) -> Self {
591
602
TestRerun {
592
603
kind,
604
+ #[ cfg( feature = "timestamps" ) ]
593
605
timestamp : None ,
594
606
time : None ,
595
607
message : None ,
@@ -602,6 +614,7 @@ impl TestRerun {
602
614
}
603
615
604
616
/// Sets the start timestamp for this rerun.
617
+ #[ cfg( feature = "timestamps" ) ]
605
618
pub fn set_timestamp ( & mut self , timestamp : impl Into < DateTime < FixedOffset > > ) -> & mut Self {
606
619
self . timestamp = Some ( timestamp. into ( ) ) ;
607
620
self
0 commit comments