Skip to content

Commit 10a06d8

Browse files
authored
fix(happy-dom): properly teardown additional keys (#8888)
1 parent 197caf2 commit 10a06d8

File tree

1 file changed

+3
-1
lines changed
  • packages/vitest/src/integrations/env

1 file changed

+3
-1
lines changed

packages/vitest/src/integrations/env/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ export function populateGlobal(
5252

5353
const originals = new Map<string | symbol, any>()
5454

55+
const overridenKeys = new Set([...KEYS, ...options.additionalKeys || []])
56+
5557
const overrideObject = new Map<string | symbol, any>()
5658
for (const key of keys) {
5759
const boundFunction
@@ -60,7 +62,7 @@ export function populateGlobal(
6062
&& !isClassLikeName(key)
6163
&& win[key].bind(win)
6264

63-
if (KEYS.includes(key) && key in global) {
65+
if (overridenKeys.has(key) && key in global) {
6466
originals.set(key, global[key])
6567
}
6668

0 commit comments

Comments
 (0)