DOMException is not defined
thecodecafe opened this issue · 3 comments
Hi, I'm trying to test for an aborted request but keep getting this reference error, DOMException is not defined
, I've included the AbortController
and AbortSignal
polypill for fetch in my test environment and everything works fine until it gets here, is there a way to get an actual AbortError
exception using jest-fetch-mock when a request is aborted?
Thanks!
What is your jest "testEnvironment" set to? It's probably supposed to be "jsdom" if you're testing an app that runs in a browser.
Hi @yinzara it was set to node
as I was working on a react-native
project but changing to jsdom
made it work, I'm hoping this does not cause problems in the future but right now, that solved the problem.
Thanks a bunch!
Actually, taking a look at this again, I'm going to reopen this. We should be using some kind of Polyfill of DOMException as it is not present in Node. Asking you to change your test environment to jsdom is not appropriate.