From ea54a7cc5bf95d70a0b4aa98d27ba75be880951d Mon Sep 17 00:00:00 2001 From: Innocenti Sedili Valerio Date: Tue, 28 Nov 2017 15:13:22 +0100 Subject: [PATCH] exception message in json formatter --- package.json | 2 +- src/formatter/json_formatter.js | 3 ++- yarn.lock | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index cf9901c8b..b7fd4b621 100644 --- a/package.json +++ b/package.json @@ -132,7 +132,7 @@ "node": ">=0.10" }, "dependencies": { - "assertion-error-formatter": "^2.0.0", + "assertion-error-formatter": "^2.0.1", "babel-runtime": "^6.11.6", "bluebird": "^3.4.1", "cli-table": "^0.3.1", diff --git a/src/formatter/json_formatter.js b/src/formatter/json_formatter.js index a10026397..ec8f348ab 100644 --- a/src/formatter/json_formatter.js +++ b/src/formatter/json_formatter.js @@ -3,6 +3,7 @@ import Formatter from './' import Status from '../status' import { formatLocation, GherkinDocumentParser, PickleParser } from './helpers' import { buildStepArgumentIterator } from '../step_arguments' +import { format } from 'assertion-error-formatter' const { getStepLineToKeywordMap, @@ -156,7 +157,7 @@ export default class JsonFormatter extends Formatter { data.result.duration = testStep.result.duration } if (status === Status.FAILED && exception) { - data.result.error_message = exception.stack || exception + data.result.error_message = format(exception) } } if (_.size(testStep.attachments) > 0) { diff --git a/yarn.lock b/yarn.lock index 1e05d11d5..35912edc9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -193,9 +193,9 @@ assert@^1.4.0: dependencies: util "0.10.3" -assertion-error-formatter@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/assertion-error-formatter/-/assertion-error-formatter-2.0.0.tgz#17a24289cc8440889b54318e6d1187ebee2d5494" +assertion-error-formatter@^2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/assertion-error-formatter/-/assertion-error-formatter-2.0.1.tgz#6bbdffaec8e2fa9e2b0eb158bfe353132d7c0a9b" dependencies: diff "^3.0.0" pad-right "^0.2.2"