Skip to main content

One post tagged with "testes"

View all tags

jsdom or happy-dom? Pros, cons and a benchmark you can reproduce

· 10 min read
Bruno Carneiro
Fundador da @TautornTech
jsdom vs happy-dom

Every front-end project using Vitest reaches this question at some point: environment: 'jsdom' or environment: 'happy-dom'?

The answer you usually find is "happy-dom is 2 to 4 times faster". I went looking for where that number comes from and, in most articles, it has no code, no methodology and no versions. So I decided to measure it.

I built a suite with 240 React component tests and ran it in both environments, under different Vitest configurations, several times. I also checked 20 browser APIs and behaviors in both to see what each one actually implements. The result has a surprise: Vitest's configuration matters more than the choice of library.