Open mnoorenberghe opened 1 month ago
Seems to be a bug from jest-junit
implementation.
failure
element should have a message
property to include the error.
failure element should have a message property to include the error.
Does use="optional"
mean it's optional? If so, then it doesn't mean it should.
The message
property or failure
element may be optional. According to the schema, error text should belong to the message property and not elsewhere.
I understand that many test frameworks do not consistently adhere to a specific pattern. It would be beneficial to address this within the jest-unit reporter. We are also open to making adjustments if this can benefit the community overall.
@mnoorenberghe we might have a workaround here.
According to jest-junit
plugin code, adding --noStackTrace
to your jest test should create the junit XML with nested message attributes (if everything else checks out) for failure tests.
https://github.com/jest-community/jest-junit/blob/master/utils/buildJsonResults.js#L86
Note: this would mean the entire stack trace will likely be removed and may not be reported to slack.
You could try adding a link to the test run/build in the notification for users to view the error message printed on the console instead.
The message property or failure element may be optional. According to the schema, error text should belong to the message property and not elsewhere.
I would be fine with it just omitting the Error: undefined
portion of the Slack message if that is undefined (since it's optional according to the xsd)
According to jest-junit plugin code, adding --noStackTraceto your jest test should create the junit XML with nested message attributes (if everything else checks out) for failure tests.
Thanks, I'll give that a try now.
According to jest-junit plugin code, adding --noStackTraceto your jest test should create the junit XML with nested message attributes (if everything else checks out) for failure tests.
Thanks, I'll give that a try now.
The code never sets the message
attribute AFAICT, regardless of --noStackTrace
.
Does this project have any interest in retrieving the error message from the contents of the <failure>
like how jest-junit produces it?
Example
junit.xml
fromjest-junit
: