Post

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...

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.

0 reposts8 likes

No replies yet.