Haz @haz.dev · Jun 2

If you're using jsdom with Vitest, consider switching to happy-dom instead. It's much faster, but it comes with one caveat: its DOM spec coverage isn't as extensive as jsdom's. That's why I was using jsdom. But there's a better approach...

18 likes 1 replies

?

Replies

Haz · Jun 2

Set the default environment to happy-dom, then override it in test files that need jsdom with this comment: // @⁠vitest⁠-⁠environment jsdom This way, you get happy-dom's speed by default and use jsdom only in the files that actually need it.