4.0.0 • Published 1 year ago

@skidding/async-retry v4.0.0

Weekly downloads
26
License
MIT
Repository
github
Last release
1 year ago

async-retry

ci status coverage status

Wait until cb doesn't throw or time out.

Install @skidding/async-retry.

Why not zeit/async-retry?

I use this package for testing async behavior where running times are sensitive. What's different here?

  • No exponential backoff strategy
  • Callback is ran immediately
  • Default loop interval is minimal
  • Default timeout is less than a usual test timeout

These settings minimize the time spent waiting and don't require custom options in most cases. They work for tests because assertion execution is usually cheap (I think ¯\_(ツ)_/¯).

Usage

retry(callback: Function, options: Object): Promise

See async-until for available options.

await retry(() => {
  expect(onChange).toHaveBeenCalledWith({ count: 3 });
});
4.0.0

1 year ago

3.0.0

2 years ago

2.0.0

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago