@@ -27,6 +27,7 @@ interface PrintErrorOptions {
27
27
fullStack ?: boolean
28
28
showCodeFrame ?: boolean
29
29
printProperties ?: boolean
30
+ screenshotPaths ?: string [ ]
30
31
}
31
32
32
33
interface PrintErrorResult {
@@ -110,14 +111,19 @@ export function printError(
110
111
}
111
112
} )
112
113
113
- const errorProperties = printProperties
114
- ? getErrorProperties ( e )
115
- : { }
116
-
117
114
if ( type ) {
118
115
printErrorType ( type , project . ctx )
119
116
}
120
117
printErrorMessage ( e , logger )
118
+ if ( options . screenshotPaths ?. length ) {
119
+ const length = options . screenshotPaths . length
120
+ logger . error ( `\nFailure screenshot${ length > 1 ? 's' : '' } :` )
121
+ logger . error ( options . screenshotPaths . map ( p => ` - ${ c . dim ( relative ( process . cwd ( ) , p ) ) } ` ) . join ( '\n' ) )
122
+ if ( ! e . diff ) {
123
+ logger . error ( )
124
+ }
125
+ }
126
+
121
127
if ( e . codeFrame ) {
122
128
logger . error ( `${ e . codeFrame } \n` )
123
129
}
@@ -132,6 +138,10 @@ export function printError(
132
138
logger . error ( c . yellow ( e . frame ) )
133
139
}
134
140
else {
141
+ const errorProperties = printProperties
142
+ ? getErrorProperties ( e )
143
+ : { }
144
+
135
145
printStack ( logger , project , stacks , nearest , errorProperties , ( s ) => {
136
146
if ( showCodeFrame && s === nearest && nearest ) {
137
147
const sourceCode = readFileSync ( nearest . file , 'utf-8' )
0 commit comments