Skip to content

Commit 10bbb1a

Browse files
committed
chore: render stack traces in results
1 parent c8234ad commit 10bbb1a

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

packages/case-core/src/connectors/resultPrinter/resultFormatter.ts

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,17 @@ const camelToCapital = (camel: string) =>
3333
const makePrintError =
3434
(printer: ResultPrinter) =>
3535
(error: CaseError, context: DataContext): void => {
36-
const locationTag = locationString({
37-
...context,
38-
'_case:currentRun:context:location': Array.isArray(error.location)
39-
? error.location
40-
: [],
41-
});
36+
const locationTag =
37+
'userFacingStackTrace' in error &&
38+
typeof error.userFacingStackTrace === 'string' &&
39+
error.userFacingStackTrace !== ''
40+
? error.userFacingStackTrace
41+
: locationString({
42+
...context,
43+
'_case:currentRun:context:location': Array.isArray(error.location)
44+
? error.location
45+
: [],
46+
});
4247

4348
const errorTypeTag =
4449
'matcher' in error ? error.matcher['_case:matcher:type'] : error.code;

packages/dsl-java/src/main/java/io/contract_testing/contractcase/internal/edge/default_implementations/LogPrinterStandardOut.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void printMessageError(
129129
+ whiteBright.format(
130130
description.getMessage())) + "\n\n" + spaces(
131131
12, white.format(
132-
" - " + description.getLocation() + " ["
132+
" - " + description.getLocationTag() + " ["
133133
+ description.getErrorTypeTag() + "]")));
134134
}
135135

0 commit comments

Comments
 (0)