DenoDDeno
Powered by
boramalperB
Denoβ€’11mo 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
FetchEvent
as an input. In my tests of that library, I want to instantiate a
FetchEvent
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
  },
}
{
  "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
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.
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

how I can install antd in my deno project?
mihainutuuMmihainutuu / help
3y ago
How can I run `deno test` on all `*.spec.ts` files contains in a specific directory ?
CarereCCarere / help
3y ago
Closing a websocket server in a unit test
v1rtlVv1rtl / help
4y ago