cloudflare-docs icon indicating copy to clipboard operation
cloudflare-docs copied to clipboard

Document how to write tests for workers

Open vinaypuppal opened this issue 4 years ago • 7 comments

I found these two old articles

  1. https://blog.cloudflare.com/unit-testing-workers-in-cloudflare-workers/
  2. https://findwork.dev/blog/testing-cloudflare-workers/

And this issue https://github.com/cloudflare/wrangler/issues/1026

Now the wrangler dev is out of beta, it would be nice to have an official page in docs on how to test workers locally and with CI tools.

vinaypuppal avatar Sep 07 '20 16:09 vinaypuppal

yes! we'd like to support this better in the platform. for now, check out the #testing-strategies channel in our discord server to talk w/ folks doing this. leaving this ticket open tho because we eventually want to add content in our docs for this! thanks for filing an issue 👍

kristianfreeman avatar Jun 15 '21 17:06 kristianfreeman

Yes, please. Another very promising article on testing Cloudflare Workers uses a package which is no longer maintained: https://blog.cloudflare.com/unit-testing-worker-functions/

grahamlyons avatar Aug 11 '21 14:08 grahamlyons

Hey all,

Thanks for bringing this up. We're working on an internal solution for testing Workers locally! We'll update our docs as soon as we have something and I've got a list of those outdated resources (thanks for sharing those!) In the meantime, Miniflare is a really cool community project that a lot of people use for that!

cc @grahamlyons @vinaypuppal

jkup avatar Aug 31 '21 17:08 jkup

I started using Miniflare and it's changed my life. I recommend it highly.

grahamlyons avatar Aug 31 '21 18:08 grahamlyons

So happy to hear that :)

jkup avatar Aug 31 '21 18:08 jkup

@lauragift21 I've been leaving this one open because the DevProd team is hard at work on a test runner for Wrangler https://github.com/cloudflare/wrangler2/issues/1183

Whenever that work is completed, we should update the docs with instructions on how to use that!

jkup avatar Jul 06 '22 14:07 jkup

Sure thanks! @jkup I'll an eye on this issue.

lauragift21 avatar Jul 08 '22 09:07 lauragift21

Confirmed this issue is being tracked internally, so closing it out here for now.

haleycode avatar Oct 06 '22 14:10 haleycode

https://github.com/cloudflare/cloudflare-docs/pull/6501

deadlypants1973 avatar Nov 07 '22 16:11 deadlypants1973