You can consider edge-mock as implementing (almost) all the types declare in the @cloudflare/workers-types typescript types package. While edge-mock i

samuelcolvin / edge-mock

submited by
Style Pass
2021-06-19 18:30:02

You can consider edge-mock as implementing (almost) all the types declare in the @cloudflare/workers-types typescript types package.

While edge-mock is designed to be useful when developing CloudFlare worker applications, it should be usable while developing any service-worker app including for (future) alternative edge worker implementations.

edge-mock is written in TypeScript and while you may be able to use it from vanilla javascript projects, you'd be better off writing your code in TypeScript!

There's also fetch_live (import with import live_fetch from 'edge-mock/live_fetch') which is an implementation of fetch which makes actual http requests using node-fetch. It is installed by default instead of stub_fetch in the dev server, see below.

Please Note: all the above types are designed for use with node while testing and are vanilla in-memory only implementations. They are not designed for production use or with large payloads.

Leave a Comment
Related Posts