Hazyzh/jest-html-reporters

Add custom info on test fails

rootlinux2 opened this issue · 4 comments

I want to add custom information to my test report, like addAttach for images, I want to be able to add text.
It Will be nice to have a way to expose information to the report like console.log(my_var) but see the result in the HTML report info.

For example, I'm making a test to an API endpoint, my endpoint returns an object with a key {"result":1, ...} in my test y expect the result to be 1 but is my test fails I want to show in the report the response object, to be able to see the error cause.

Hey @rootlinux2

You'll be able to achieve what you need with the addAttach() function, by doing the following:

await addAttach('', 'Your Text');

Its not pretty though. I added an addMsg() function in the @carits-qa/jest-html-reporters package and prettified the output a little bit as a temporary solution

Your request is marked as an enhancement so will hopefully be added soon (and I'll bin off my forked repo)

Hey @aruiz-caritsqa
The addMsg function is great, I think you can create a PR adding this function.
Just a little detail if you add a message the info button color should be Light Blue.

same as the issue #64 .

New version(2.0.3) which include the addMsg function has been released . Thanks for the contribution of @aruiz-caritsqa .