DenoDDeno
Powered by
Bustin BaseB
Denoβ€’3y ago
Bustin Base

FakeTime seems to break async tests

I am attempting to use FakeTime similarly to in the Faking time example of https://deno.land/manual@v1.35.1/basics/testing/mocking

But whenever I run the tests it responds with:

error: Promise resolution is still pending but the event loop has already resolved"

The test partially runs but it seems to reach a point where it calls setTimeout and then just exits.

If I remove the reference to fake time then the test runs as expected, it just takes a little more time.

Does anyone have any experience with using FakeTime in an asynchronous test? The function its getting hung up on is the std library
retry
retry
function.
Deno
Mocking | Manual | Deno
Test spies are function stand-ins that are used to assert if a function's
internal behavior matches expectations. Test spies on methods keep the original
behavior but allow you to test how the method
Mocking | Manual | Deno
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

BDD with async tests
FjordWardenFFjordWarden / help
3y ago
adding async data to array?
JordanJJordan / help
4y ago
async map
leighLleigh / help
3y ago