Mock out window.addEventListener globally (#34028)

* Mock out window.addEventListener globally

As some code uses it

* Move to setupGlobals

* clean up import

* Only needed if we don't have happy-dom

* thank you!

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
David Baker
2026-06-29 17:08:32 +00:00
committed by GitHub
co-authored by Michael Telatynski
parent aed2009b9f
commit 3e40e58b12
+5 -1
View File
@@ -16,5 +16,9 @@ vi.stubGlobal("AudioContext", function () {
if (globalThis.window === undefined) {
// We are in a node environment, stub a basic window so singletons work
vi.stubGlobal("window", {});
vi.stubGlobal("window", {
// Mock this as some code assumes it exists (needs to be done at the top level as
// things try to access it before the beforeEach blocks run)
addEventListener: vi.fn(),
});
}