jest-junit icon indicating copy to clipboard operation
jest-junit copied to clipboard

report transient retry failures

Open bencsr opened this issue 1 year ago • 3 comments

Hi!

I use jest to run integration tests, and publish the output of jest-junit to Azure DevOps, and use the Test Analytics feature to monitor test execution.

I'd like to use jest.retryTimes to retry flaky test cases. But it would be really great to keep track of the transient failures as well. That's why I created an option, to put the transient failures also to the report.

Related to #157

In this example jest.retryTimes(5) was used, and the first two invocations were failing, and the third invocation succeeded.

<?xml version="1.0" encoding="UTF-8"?>
<testsuites name="tests" tests="1" failures="0" errors="0" time="17.456">
  <testsuite name="Suite 1" errors="0" failures="0" skipped="0" timestamp="2024-12-06T15:41:18" time="16.788" tests="1">
    <testcase classname="fooo bar" name="fooo bar" time="0.324">
      <failure>Error: expect(received).toBeFalsy()</failure>
    </testcase>
    <testcase classname="fooo bar" name="fooo bar" time="0.324">
      <failure>Error: expect(received).toBeFalsy()</failure>
    </testcase>
    <testcase classname="fooo bar" name="fooo bar" time="0.324">
    </testcase>
  </testsuite>
</testsuites>

bencsr avatar Dec 07 '24 08:12 bencsr

This change looks good to me. Thanks! Seems like a reasonable way to handle this case and I like that it's opt-in.

I need to do some debugging on jest-junit's CI setup since it is failing as of recent. So I may need some time to fix that before I can merge this.

palmerj3 avatar Dec 07 '24 14:12 palmerj3

@palmerj3 I also had issues locally when installing the dependencies, I think libxmljs2 was the culprit for me as well. I switched back to Node 16 on my machine

bencsr avatar Dec 08 '24 08:12 bencsr

@palmerj3 @bencsr I came across this today as it's functionality that I'm looking for for the same reason. I'd be happy to help with rebasing or updating. Is this something we could look at prioritizing in an upcoming release?

ryanwilsonperkin avatar Mar 10 '25 18:03 ryanwilsonperkin