@@ -35,7 +35,7 @@ import { annotateStacktrace } from '../core/stacktrace';
35
35
* Objects with cyclical references will be stringifed as
36
36
* "[Circular]" as they cannot otherwise be represented.
37
37
*/
38
- function prettyYamlValue ( value , indent = 4 ) {
38
+ function prettyYamlValue ( value , indent = 2 ) {
39
39
if ( value === undefined ) {
40
40
// Not supported in JSON/YAML, turn into string
41
41
// and let the below output it as bare string.
@@ -94,7 +94,7 @@ function prettyYamlValue (value, indent = 4) {
94
94
95
95
// See also <https://yaml-multiline.info/>
96
96
// Support IE 9-11: Avoid ES6 String#repeat
97
- const prefix = ( new Array ( indent + 1 ) ) . join ( ' ' ) ;
97
+ const prefix = ( new Array ( ( indent * 2 ) + 1 ) ) . join ( ' ' ) ;
98
98
99
99
const trailingLinebreakMatch = value . match ( / \n + $ / ) ;
100
100
const trailingLinebreaks = trailingLinebreakMatch
@@ -126,8 +126,13 @@ function prettyYamlValue (value, indent = 4) {
126
126
}
127
127
}
128
128
129
+ const prefix = ( new Array ( indent + 1 ) ) . join ( ' ' ) ;
130
+
129
131
// Handle null, boolean, array, and object
130
- return JSON . stringify ( decycledShallowClone ( value ) , null , 2 ) ;
132
+ return JSON . stringify ( decycledShallowClone ( value ) , null , 2 )
133
+ . split ( '\n' )
134
+ . map ( ( line , i ) => i === 0 ? line : prefix + line )
135
+ . join ( '\n' ) ;
131
136
}
132
137
133
138
/**
@@ -223,11 +228,11 @@ export default class TapReporter {
223
228
this . log ( `ok ${ this . testCount } ${ test . fullName . join ( ' > ' ) } ` ) ;
224
229
} else if ( test . status === 'skipped' ) {
225
230
this . log (
226
- `ok ${ this . testCount } ${ kleur . yellow ( `# SKIP ${ test . fullName . join ( ' > ' ) } ` ) } `
231
+ `ok ${ this . testCount } ${ kleur . yellow ( test . fullName . join ( ' > ' ) ) } # SKIP `
227
232
) ;
228
233
} else if ( test . status === 'todo' ) {
229
234
this . log (
230
- `not ok ${ this . testCount } ${ kleur . cyan ( `# TODO ${ test . fullName . join ( ' > ' ) } ` ) } `
235
+ `not ok ${ this . testCount } ${ kleur . cyan ( test . fullName . join ( ' > ' ) ) } # TODO `
231
236
) ;
232
237
test . errors . forEach ( ( error ) => this . logAssertion ( error , 'todo' ) ) ;
233
238
} else {
0 commit comments