Switching from jsdom to happy-dom fixes Vitest worker crashes in GitHub Actions CI
A development team found that their Vitest test suite ran successfully locally but crashed entirely on GitHub Actions before executing a single test. The root cause was traced to a compatibility issue inside jsdom's bundled undici dependency, which failed during worker pool initialization with the error 'webidl.util.markAsUncloneable is not a function'. Because none of the test files ever started running, the CI pipeline reported 0% code coverage and a broken build. The team resolved the issue by replacing jsdom with happy-dom, a lighter test environment that implements only the browser APIs commonly needed for modern frontend unit testing. The fix was applied to a Next.js monorepo using pnpm, Vitest, and GitHub Actions running Node.js 20 on Ubuntu.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in