The first one offers a way to run tests in the production environment, which I’m quite reluctant to do, to be honest. The second uses a package that is no longer maintained.
I’d like to know if there are some best practices for writing tests for workers. Where should I look for it?
You could “split” your worker into two, staging and production.
Use Jest and Fetch to specifically test critical points on your staging worker, after all tests pass you can move it to production.
You could use Cloudflare Access to shield the staging worker from unwanted access.
I’m also new to Cloudflare and didn’t know about Cloudflare Access. It seems that it indeed does the trick.
I think I’m going to write some tests that fetch against a wrangler dev in my own machine and some other tests to go a staging worker, as you suggested.
Thanks a lot.