Testing on latests wrangler
Can someone point me to some examples to testing my worker using vitest/jest?
I encountered the miniflare 2 documentation examples but these seem to be deprecated. Unclear on the recommendations for the latest write tests.
2 Replies
Hey 👋
Testing is definitely in a bit of a weird spot right now with the miniflare 2 / 3 split.
Tldr when writing unit tests you will mostly be working in a miniflare 2 environment right now.
When running your worker locally you would use miniflare 3 (wrangler 3.x)
I can point you to my project - https://github.com/AdiRishi/turborepo-remote-cache-cloudflare . It uses vitest + vitest-environment-miniflare to do testing.
The CF team is definitely working on porting the vitest/jest testing packages to miniflare 3, but no idea what the timeline for that looks like
I forget the issues I ran into, but I ended up downgrading to miniflare 2 for my testing.