1
1
function colorize ( type , text ) {
2
2
if ( type === 'pass' ) {
3
3
const whiteText = `\x1b[30m${ text } `
4
- // Green background with black text
5
- return `\x1b[42m${ whiteText } \x1b[0m`
4
+ const boldWhiteText = `\x1b[1m${ whiteText } `
5
+ // Green background with white text
6
+ return `\x1b[42m${ boldWhiteText } \x1b[0m`
6
7
}
7
8
8
9
if ( type === 'fail' ) {
9
10
const blackText = `\x1b[37m${ text } `
10
- // Red background with white text
11
- return `\x1b[41m${ blackText } \x1b[0m`
11
+ const boldBlackText = `\x1b[1m${ blackText } `
12
+ // Red background with black text
13
+ return `\x1b[41m${ boldBlackText } \x1b[0m`
12
14
}
13
15
14
16
return text
@@ -23,18 +25,17 @@ function formatDiagnosticStr (str) {
23
25
async function * reporter ( source ) {
24
26
const failed = new Set ( )
25
27
const diagnostics = new Set ( )
26
- diagnostics . add ( '\n\n' )
27
28
28
29
for await ( const event of source ) {
29
30
switch ( event . type ) {
30
31
case 'test:pass' : {
31
- yield `${ colorize ( 'pass' , 'PASSED' ) } : ${ event . data . file } \n`
32
+ yield `${ colorize ( 'pass' , 'PASSED' ) } : ${ event . data . file || event . data . name } \n`
32
33
break
33
34
}
34
35
35
36
case 'test:fail' : {
36
- failed . add ( event . data . file )
37
- yield `${ colorize ( 'fail' , 'FAILED' ) } : ${ event . data . file } \n`
37
+ failed . add ( event . data . name || event . data . file )
38
+ yield `${ colorize ( 'fail' , 'FAILED' ) } : ${ event . data . file || event . data . name } \n`
38
39
break
39
40
}
40
41
@@ -54,13 +55,13 @@ async function * reporter (source) {
54
55
for ( const file of failed ) {
55
56
yield `${ file } \n`
56
57
}
58
+ yield '\n'
57
59
}
58
60
59
- diagnostics . add ( '\n' )
60
-
61
61
for ( const diagnostic of diagnostics ) {
62
62
yield `${ diagnostic } `
63
63
}
64
+ yield '\n'
64
65
}
65
66
66
67
export default reporter
0 commit comments