@@ -30,6 +30,7 @@ const symbols = {
30
30
'test:pass' : '\u2714 ' ,
31
31
'test:diagnostic' : '\u2139 ' ,
32
32
'arrow:right' : '\u25B6 ' ,
33
+ 'hyphen:minus' : '\uFE63 ' ,
33
34
} ;
34
35
class SpecReporter extends Transform {
35
36
#stack = [ ] ;
@@ -60,8 +61,8 @@ class SpecReporter extends Transform {
60
61
return `\n${ indent } ${ message } \n` ;
61
62
}
62
63
#handleEvent( { type, data } ) {
63
- const color = colors [ type ] ?? white ;
64
- const symbol = symbols [ type ] ?? ' ' ;
64
+ let color = colors [ type ] ?? white ;
65
+ let symbol = symbols [ type ] ?? ' ' ;
65
66
66
67
switch ( type ) {
67
68
case 'test:fail' :
@@ -81,15 +82,20 @@ class SpecReporter extends Transform {
81
82
ArrayPrototypeUnshift ( this . #reported, msg ) ;
82
83
prefix += `${ this . #indent( msg . nesting ) } ${ symbols [ 'arrow:right' ] } ${ msg . name } \n` ;
83
84
}
85
+ const skippedSubtest = subtest && data . skip && data . skip !== undefined ;
84
86
const indent = this . #indent( data . nesting ) ;
85
87
const duration_ms = data . details ?. duration_ms ? ` ${ gray } (${ data . details . duration_ms } ms)${ white } ` : '' ;
86
- const title = `${ data . name } ${ duration_ms } ` ;
88
+ const title = `${ data . name } ${ duration_ms } ${ skippedSubtest ? ' # SKIP' : '' } ` ;
87
89
if ( this . #reported[ 0 ] && this . #reported[ 0 ] . nesting === data . nesting && this . #reported[ 0 ] . name === data . name ) {
88
- // If this test has had children - it was already reporter , so slightly modify the output
90
+ // If this test has had children - it was already reported , so slightly modify the output
89
91
ArrayPrototypeShift ( this . #reported) ;
90
92
return `${ prefix } ${ indent } ${ color } ${ symbols [ 'arrow:right' ] } ${ white } ${ title } \n\n` ;
91
93
}
92
94
const error = this . #formatError( data . details ?. error , indent ) ;
95
+ if ( skippedSubtest ) {
96
+ color = gray ;
97
+ symbol = symbols [ 'hyphen:minus' ] ;
98
+ }
93
99
return `${ prefix } ${ indent } ${ color } ${ symbol } ${ title } ${ error } ${ white } \n` ;
94
100
}
95
101
case 'test:start' :
0 commit comments