boramalperB
Denoβ€’9mo agoβ€’
2 replies
boramalper

How can I instantiate a FetchEvent in my test?

Hi! I'm testing my Service Worker library that accepts a FetchEvent as an input. In my tests of that library, I want to instantiate a FetchEvent to test it, but I'm getting
error: ReferenceError: FetchEvent is not defined
instead.

My compiler options are:
{
  "compilerOptions": {
    "lib": ["ES2023", "WebWorker", "deno.ns"],
    "strictNullChecks": true
  },
}


Deno version:
deno 2.2.10 (stable, release, aarch64-apple-darwin)
v8 13.5.212.10-rusty
typescript 5.7.3


Thank you!

May 7 edit: Also asked on StackOverflow now.
Was this page helpful?