boramalper
boramalper3d ago

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
},
}
{
"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.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?