cloudnativedaysjp / dreamkast-ui

MIT License
7 stars 2 forks source link

flakyなtestの対処 #458

Open hrk091 opened 1 year ago

hrk091 commented 1 year ago

https://github.com/cloudnativedaysjp/dreamkast-ui/actions/runs/5701667795/job/15452585580?pr=455

testが、runnerのCPU負荷次第でtiming issueでこけてしまうので、こけないように修正する

FAIL src/components/hooks/__tests__/useRunAfter.spec.tsx
  ● useRunAfter › should run callback after specified delay and skip calls in the middle

    expect(received).toBeLessThan(expected)

    Expected: < 5
    Received:   5

      25 |     expect(trials).toBeGreaterThan(8)
      26 |     expect(fn.mock.calls.length).toBeGreaterThan(1)
    > 27 |     expect(fn.mock.calls.length).toBeLessThan(5)
         |                                  ^
      28 |   })
      29 | })
      30 |

      at Object.toBeLessThan (src/components/hooks/__tests__/useRunAfter.spec.tsx:27:34)