function itAsyncDone(name, cb, timeout) {
  it(
    name,
    done => {
      let doneCalled = false
      const wrappedDone = (...args) => {
        if (doneCalled) {
          return
        }

        doneCalled = true
        done(...args)
      }

      wrappedDone.fail = err => {
        if (doneCalled) {
          return
        }

        doneCalled = true

        done(err)
      }

      cb(wrappedDone).catch(wrappedDone)
    },
    timeout
  )
}
@see https://github.com/facebook/jest/issues/10529#issuecomment-904608475