Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mock "timers/promise" module #469

Open
fatso83 opened this issue May 22, 2023 · 2 comments
Open

Mock "timers/promise" module #469

fatso83 opened this issue May 22, 2023 · 2 comments

Comments

@fatso83
Copy link
Contributor

fatso83 commented May 22, 2023

In #467 @swenzel-arc added the support for the timers module in NodeJS. Node also exports a non-callback async/Promise version of that API that needs to be mocked. We can probably very easily piggy-pack on top of the existing work done in the referenced PR.

Also see the over-arching #418

haphut added a commit to HSLdevcom/transitdata-partial-apc-expander-combiner that referenced this issue Dec 13, 2023
Unfortunately jest cannot currently handle mocking setTimeout from
"node:timers/promises", see issue
sinonjs/fake-timers#469 .
We do not wish to mix callbacks and async functions. To keep our code
testable with jest, let's create our own cancellable wrapper around the
callback-based setTimeout.
haphut added a commit to HSLdevcom/transitdata-partial-apc-expander-combiner that referenced this issue Dec 13, 2023
Unfortunately jest cannot currently handle mocking setTimeout from
"node:timers/promises", see issue
sinonjs/fake-timers#469 .
We do not wish to mix callbacks and async functions. To keep our code
testable with jest, let's create our own cancellable wrapper around the
callback-based setTimeout.
Copy link

stale bot commented Dec 27, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Dec 27, 2023
@KholdStare
Copy link

Not stale

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants