workers-sdk
workers-sdk copied to clipboard
🚀 Feature Request: Await waitUntils in unstable_dev
Describe the solution
I'm using unstable_dev extensively in testing right now but just hit a roadblock. I have a fetch being done in a waitUntil
which I need to happen before all my expects
.
There is no way to wait for this today in unstable_dev
from what I can tell. It would be great to have a function on UnstableDevWorker
like waitForWaitUntils
.
Miniflare does have something for this already: https://miniflare.dev/testing/vitest#waiting-for-waituntiled-promises
However, this requires me to use the Miniflare test env. I want to avoid this and rely on solely Wrangler here. A lot of users may not even know that Miniflare will run these tests so there needs to be some option in Wrangler (not to forget you can also use workerd
though still through Miniflare)
Regardless, this would be great to have before dev
goes stable :)
cc: @rozenmd
First thoughts:
Sounds like a good idea and something useful to add - and no, there's no way to do this with unstable_dev
AFAIK.
But it sounds like it'd be an additive change - I wouldn't block promoting unstable_dev
to dev
over it in that case.
I actually started working with the testing-library maintainer on an agnostic waitFor
https://github.com/testing-library/web-testing-library/issues/3