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

🚀 Feature Request: Await waitUntils in unstable_dev #2474

Closed
WalshyDev opened this issue Dec 31, 2022 · 3 comments
Closed

🚀 Feature Request: Await waitUntils in unstable_dev #2474

WalshyDev opened this issue Dec 31, 2022 · 3 comments
Labels
enhancement New feature or request unstable_dev Relating to existing unstable_dev

Comments

@WalshyDev
Copy link
Member

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

@WalshyDev WalshyDev added the enhancement New feature or request label Dec 31, 2022
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Dec 31, 2022
WalshyDev added a commit to BlobDevelopment/workers-tracing that referenced this issue Dec 31, 2022
@rozenmd
Copy link
Contributor

rozenmd commented Jan 2, 2023

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.

@rozenmd rozenmd moved this from Untriaged to Selected for Development in workers-sdk Jan 2, 2023
@JacobMGEvans
Copy link
Contributor

JacobMGEvans commented Jan 12, 2023

I actually started working with the testing-library maintainer on an agnostic waitFor
testing-library/web-testing-library#3

@lrapoport-cf lrapoport-cf moved this from Selected for Development to Backlog in workers-sdk Feb 6, 2023
@lrapoport-cf lrapoport-cf added the unstable_dev Relating to existing unstable_dev label Feb 27, 2024
@github-project-automation github-project-automation bot moved this to Untriaged in workers-sdk Feb 27, 2024
@penalosa penalosa removed this from workers-sdk Apr 8, 2024
@penalosa
Copy link
Contributor

penalosa commented Nov 4, 2024

This should be possible with the Vitest integration, using the waitOnExecutionContext(ctx) API: https://developers.cloudflare.com/workers/testing/vitest-integration/test-apis/#events

@penalosa penalosa closed this as completed Nov 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request unstable_dev Relating to existing unstable_dev
Projects
None yet
Development

No branches or pull requests

5 participants