Skip to content

Commit c3b1453

Browse files
committed
exception message in json formatter
1 parent 7bb5a3b commit c3b1453

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/formatter/json_formatter.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,14 @@ export default class JsonFormatter extends Formatter {
156156
data.result.duration = testStep.result.duration
157157
}
158158
if (status === Status.FAILED && exception) {
159-
data.result.error_message = exception.stack || exception
159+
if (_.isString(exception)) {
160+
data.result.error_message = exception
161+
} else {
162+
let { message = '', stack = '' } = exception
163+
message = _.includes(stack, message) ? '' : message + '\n'
164+
data.result.error_message =
165+
message + stack || JSON.stringify(exception)
166+
}
160167
}
161168
}
162169
if (_.size(testStep.attachments) > 0) {

0 commit comments

Comments
 (0)