SMellS
Denoβ€’3y ago
SMell

ES Module mocking workaround

Hello all, I've been using Deno and Fresh for the past few weeks on a personal project and I love it. My only issue I have is testing.

Basic testing on routes and pages is fine but I am having issues mocking 3rd party ES Modules such as mocking out my getSessionId function from
kv_oauth
. I've tried using Sinon and Deno's stubs but I haven't had any luck, would people recommend using a deno or npm tool to convert to CommonJS just to mock in tests is there a better way of doing this?

Happy to provide more info or examples if needed, thanks! πŸ™‚
Was this page helpful?