From 290887ae660ec2c97939d6d1695138c96e6ed681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Westk=C3=A4mper?= Date: Wed, 14 Aug 2024 15:10:31 +0300 Subject: [PATCH] Add DOM cleanup --- spec/setup.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spec/setup.js b/spec/setup.js index eb0428a..4b515ea 100644 --- a/spec/setup.js +++ b/spec/setup.js @@ -1,5 +1,6 @@ import "@testing-library/jest-dom/vitest" import { JSDOM } from "jsdom" +import { afterEach } from "vitest" const { window } = new JSDOM("", { url: "http://localhost", @@ -12,4 +13,10 @@ global.localStorage = window.localStorage global.navigator = window.navigator // test mode flag -global.window.nostoReactTest = true \ No newline at end of file +global.window.nostoReactTest = true + +afterEach(() => { + window.nosto = undefined + document.head.innerHTML = "" + document.body.innerHTML = "" +}) \ No newline at end of file