Skip to content

Commit

Permalink
feat: serialize suite errors in ndjson reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Jan 4, 2025
1 parent d0462fb commit 5a8a9f9
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/reporters/ndjson.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ export class NdJSONReporter extends BaseReporter {
/**
* Serialize errors to JSON
*/
#serializeErrors(errors: TestEndNode['errors']) {
#serializeErrors(
errors: TestEndNode['errors'] | GroupEndNode['errors'] | SuiteEndNode['errors']
) {
return errors.map((error) => ({
phase: error.phase,
error: serializeError(error.error),
Expand Down Expand Up @@ -94,7 +96,9 @@ export class NdJSONReporter extends BaseReporter {
console.log(
JSON.stringify({
event: 'suite:end',
...payload,
name: payload.name,
hasError: payload.hasError,
errors: this.#serializeErrors(payload.errors),
})
)
}
Expand Down

0 comments on commit 5a8a9f9

Please sign in to comment.