@@ -64,17 +64,24 @@ class SpecReporter extends Transform {
64
64
) , `\n${ indent } ` ) ;
65
65
return `\n${ indent } ${ message } \n` ;
66
66
}
67
- #formatTestReport( type , data , prefix = '' , indent = '' , hasChildren = false , skippedSubtest = false ) {
67
+ #formatTestReport( type , data , prefix = '' , indent = '' , hasChildren = false ) {
68
68
let color = colors [ type ] ?? white ;
69
69
let symbol = symbols [ type ] ?? ' ' ;
70
+ const { skip, todo } = data ;
70
71
const duration_ms = data . details ?. duration_ms ? ` ${ gray } (${ data . details . duration_ms } ms)${ white } ` : '' ;
71
- const title = `${ data . name } ${ duration_ms } ${ skippedSubtest ? ' # SKIP' : '' } ` ;
72
+ let title = `${ data . name } ${ duration_ms } ` ;
73
+
74
+ if ( skip !== undefined ) {
75
+ title += ` # ${ typeof skip === 'string' && skip . length ? skip : 'SKIP' } ` ;
76
+ } else if ( todo !== undefined ) {
77
+ title += ` # ${ typeof todo === 'string' && todo . length ? todo : 'TODO' } ` ;
78
+ }
72
79
if ( hasChildren ) {
73
80
// If this test has had children - it was already reported, so slightly modify the output
74
81
return `${ prefix } ${ indent } ${ color } ${ symbols [ 'arrow:right' ] } ${ white } ${ title } \n` ;
75
82
}
76
83
const error = this . #formatError( data . details ?. error , indent ) ;
77
- if ( skippedSubtest ) {
84
+ if ( skip !== undefined ) {
78
85
color = gray ;
79
86
symbol = symbols [ 'hyphen:minus' ] ;
80
87
}
@@ -101,9 +108,8 @@ class SpecReporter extends Transform {
101
108
ArrayPrototypeShift ( this . #reported) ;
102
109
hasChildren = true ;
103
110
}
104
- const skippedSubtest = subtest && data . skip && data . skip !== undefined ;
105
111
const indent = this . #indent( data . nesting ) ;
106
- return `${ this . #formatTestReport( type , data , prefix , indent , hasChildren , skippedSubtest ) } \n` ;
112
+ return `${ this . #formatTestReport( type , data , prefix , indent , hasChildren ) } \n` ;
107
113
}
108
114
#handleEvent( { type, data } ) {
109
115
switch ( type ) {
0 commit comments