Local Integration Testing
I need to test my stripe webhook and also test against my d1 database after the webhook is ran which is not possible via vitest.
I cannot use vitest-pool-workers because the endpoint will not be available to my local machine, only the internal testing environment.
This is not possible
stripe listen --forward-to localhost:PORT/endpoint
The first option listed here looks like my best choice:
https://developers.cloudflare.com/workers/testing/integration-testing/
My question is that if there is a better way to setup my tests than the following (Resembles option #1 from the above link):
- Create my tests and route them to the following endpoint /test/...
- Start dev server
- curl localhost:PORT/test/...
Example of test
Cloudflare Docs
Integration testing · Cloudflare Workers docs
Test multiple units of your Worker working together.
0 Replies