@@ -104,18 +104,7 @@ class RPFormatter extends Formatter {
104
104
}
105
105
if ( step . attachment ) {
106
106
for ( const attachment of step . attachment ) {
107
- const attachmentData = {
108
- name : 'attachment' ,
109
- type : attachment . mediaType ,
110
- content : this . prepareContent ( attachment ) ,
111
- } ;
112
- const log = await this . rpClient . sendLog ( nestedTestItem . tempId , {
113
- level : 'INFO' ,
114
- message : 'Attachment' ,
115
- time : this . rpClient . helpers . now ( )
116
- } , attachmentData ) ;
117
- this . promiseQ . push ( log . promise ) ;
118
- await log . promise ;
107
+ await this . sendAttachment ( attachment , nestedTestItem ) ;
119
108
}
120
109
}
121
110
const nestedItemFinish = this . rpClient . finishTestItem ( nestedTestItem . tempId , {
@@ -167,10 +156,11 @@ class RPFormatter extends Formatter {
167
156
}
168
157
169
158
getStatus ( step ) {
170
- if ( step . result . status !== Status . PASSED ) {
171
- return Status . FAILED . toLowerCase ( )
159
+ switch ( step . result . status ) {
160
+ case Status . PASSED : return Status . PASSED . toLowerCase ( ) ;
161
+ case Status . SKIPPED : return Status . SKIPPED . toLowerCase ( ) ;
162
+ default : return Status . FAILED . toLowerCase ( )
172
163
}
173
- return Status . PASSED . toLowerCase ( )
174
164
}
175
165
176
166
formatTable ( dataTable ) {
@@ -196,6 +186,29 @@ class RPFormatter extends Formatter {
196
186
: attachment . body
197
187
}
198
188
189
+ async sendAttachment ( attachment , testItem ) {
190
+ let log ;
191
+ if ( attachment . mediaType === 'text/x.cucumber.log+plain' ) {
192
+ log = await this . rpClient . sendLog ( testItem . tempId , {
193
+ level : 'INFO' ,
194
+ message : attachment . body ,
195
+ time : this . rpClient . helpers . now ( )
196
+ } ) ;
197
+ } else {
198
+ const attachmentData = {
199
+ name : 'attachment' ,
200
+ type : attachment . mediaType ,
201
+ content : this . prepareContent ( attachment ) ,
202
+ } ;
203
+ log = await this . rpClient . sendLog ( testItem . tempId , {
204
+ level : 'INFO' ,
205
+ message : 'Attachment' ,
206
+ time : this . rpClient . helpers . now ( )
207
+ } , attachmentData ) ;
208
+ }
209
+ this . promiseQ . push ( log . promise ) ;
210
+ await log . promise ;
211
+ }
199
212
}
200
213
201
214
module . exports = RPFormatter
0 commit comments