Skip to content

Commit

Permalink
Merge pull request #99 from Nosto/dom-cleanup
Browse files Browse the repository at this point in the history
Add DOM cleanup
  • Loading branch information
timowestnosto authored Aug 14, 2024
2 parents 79e2d09 + 290887a commit d3dec6b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion spec/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import "@testing-library/jest-dom/vitest"
import { JSDOM } from "jsdom"
import { afterEach } from "vitest"

const { window } = new JSDOM("<html></html>", {
url: "http://localhost",
Expand All @@ -12,4 +13,10 @@ global.localStorage = window.localStorage
global.navigator = window.navigator

// test mode flag
global.window.nostoReactTest = true
global.window.nostoReactTest = true

afterEach(() => {
window.nosto = undefined
document.head.innerHTML = ""
document.body.innerHTML = ""
})

0 comments on commit d3dec6b

Please sign in to comment.