You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Isolated DB throws this error TypeError: The "eventTargets" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal with npx vitest#39
Open
iammrsea opened this issue
Nov 21, 2024
· 5 comments
npx vitest throws the following error "TypeError: The "eventTargets" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal" with Isolated DB for testing.
A little bit of google searching landed me here, which is the root cause of the problem. You can check out the link for more context. Apparently, execa version 9 which is the current version of the package in the project relies on setMaxListeners export from node:events which throws error in jsdom environment because the AbortSignal from jsdom's AbortController is not node.js EventTarget.
I'm not exactly sure the best way to fix this problem. Of course, one option would be to downgrade execa to version 8 but not sure if that's a good idea based on this comment. However, I added this hack in the db-setup.ts file and it does work for me:
The text was updated successfully, but these errors were encountered:
iammrsea
changed the title
Isolated DB throws this error TypeError: The "eventTargets" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal
Isolated DB throws this error TypeError: The "eventTargets" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal with npx vitestNov 21, 2024
I have no idea why this would suddenly stop working.
I think here is probably the reason. execav9 now uses setMaxListenersexport from node:events module which throws that error because EventTarget in dom environment isn't the same as EventTarget in node environment.
npx vitest
throws the following error "TypeError: The "eventTargets" argument must be an instance of EventEmitter or EventTarget. Received an instance of AbortSignal" with Isolated DB for testing.A little bit of google searching landed me here, which is the root cause of the problem. You can check out the link for more context. Apparently,
execa
version9
which is the current version of the package in the project relies onsetMaxListeners
export fromnode:events
which throws error injsdom
environment because theAbortSignal
from jsdom'sAbortController
is not node.jsEventTarget
.I'm not exactly sure the best way to fix this problem. Of course, one option would be to downgrade
execa
to version8
but not sure if that's a good idea based on this comment. However, I added this hack in thedb-setup.ts
file and it does work for me:The text was updated successfully, but these errors were encountered: