Skip to content

feat(create-rslib): use happy-dom instead of jsdom#1412

Merged
9aoy merged 1 commit intomainfrom
rstest-happy-dom
Dec 25, 2025
Merged

feat(create-rslib): use happy-dom instead of jsdom#1412
9aoy merged 1 commit intomainfrom
rstest-happy-dom

Conversation

@9aoy
Copy link
Copy Markdown
Contributor

@9aoy 9aoy commented Dec 25, 2025

Summary

Use happy-dom instead of jsdom as default testEnvironment in Rstest template.

happy-dom is considered faster than jsdom, but it lacks some APIs.

https://github.com/capricorn86/happy-dom/wiki/

hyperfine 'pnpm test --testEnvironment jsdom' 'pnpm test --testEnvironment happy-dom'

Benchmark 1: pnpm test --testEnvironment jsdom
  Time (mean ± σ):     899.7 ms ± 118.5 ms    [User: 830.1 ms, System: 295.0 ms]
  Range (min … max):   835.9 ms … 1231.8 ms    10 runs
  
Benchmark 2: pnpm test --testEnvironment happy-dom
  Time (mean ± σ):     757.9 ms ±  17.2 ms    [User: 754.3 ms, System: 276.4 ms]
  Range (min … max):   745.9 ms … 802.8 ms    10 runs
 
Summary
  pnpm test --testEnvironment happy-dom ran
    1.19 ± 0.16 times faster than pnpm test --testEnvironment jsdom

Related Links

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings December 25, 2025 11:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates from jsdom to happy-dom as the default test environment for all rstest templates in the create-rslib package. The change is motivated by performance improvements (approximately 10% faster according to the benchmark in the PR description), though happy-dom has fewer APIs than jsdom.

Key Changes:

  • Replaced jsdom dependency with happy-dom (version ^20.0.11) across all rstest templates
  • Updated testEnvironment configuration from 'jsdom' to 'happy-dom' in all rstest config files
  • Applied changes consistently across React and Vue templates, both JavaScript and TypeScript variants

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/create-rslib/template-[vue]-[rstest]-ts/rstest.config.ts Updated testEnvironment to happy-dom for Vue TypeScript rstest template
packages/create-rslib/template-[vue]-[rstest]-ts/package.json Replaced jsdom dependency with happy-dom for Vue TypeScript rstest template
packages/create-rslib/template-[vue]-[rstest]-js/rstest.config.js Updated testEnvironment to happy-dom for Vue JavaScript rstest template
packages/create-rslib/template-[vue]-[rstest]-js/package.json Replaced jsdom dependency with happy-dom for Vue JavaScript rstest template
packages/create-rslib/template-[vue]-[rstest,storybook]-ts/rstest.config.ts Updated testEnvironment to happy-dom for Vue TypeScript rstest+storybook template
packages/create-rslib/template-[vue]-[rstest,storybook]-ts/package.json Replaced jsdom dependency with happy-dom for Vue TypeScript rstest+storybook template
packages/create-rslib/template-[vue]-[rstest,storybook]-js/rstest.config.js Updated testEnvironment to happy-dom for Vue JavaScript rstest+storybook template
packages/create-rslib/template-[vue]-[rstest,storybook]-js/package.json Replaced jsdom dependency with happy-dom for Vue JavaScript rstest+storybook template
packages/create-rslib/template-[react]-[rstest]-ts/rstest.config.ts Updated testEnvironment to happy-dom for React TypeScript rstest template
packages/create-rslib/template-[react]-[rstest]-ts/package.json Replaced jsdom dependency with happy-dom for React TypeScript rstest template
packages/create-rslib/template-[react]-[rstest]-js/rstest.config.js Updated testEnvironment to happy-dom for React JavaScript rstest template
packages/create-rslib/template-[react]-[rstest]-js/package.json Replaced jsdom dependency with happy-dom for React JavaScript rstest template
packages/create-rslib/template-[react]-[rstest,storybook]-ts/rstest.config.ts Updated testEnvironment to happy-dom for React TypeScript rstest+storybook template
packages/create-rslib/template-[react]-[rstest,storybook]-ts/package.json Replaced jsdom dependency with happy-dom for React TypeScript rstest+storybook template
packages/create-rslib/template-[react]-[rstest,storybook]-js/rstest.config.js Updated testEnvironment to happy-dom for React JavaScript rstest+storybook template
packages/create-rslib/template-[react]-[rstest,storybook]-js/package.json Replaced jsdom dependency with happy-dom for React JavaScript rstest+storybook template
packages/create-rslib/fragments/tools/rstest-vue-ts/rstest.config.ts Updated testEnvironment to happy-dom in Vue TypeScript rstest fragment
packages/create-rslib/fragments/tools/rstest-vue-ts/package.json Replaced jsdom dependency with happy-dom in Vue TypeScript rstest fragment
packages/create-rslib/fragments/tools/rstest-vue-js/rstest.config.js Updated testEnvironment to happy-dom in Vue JavaScript rstest fragment
packages/create-rslib/fragments/tools/rstest-vue-js/package.json Replaced jsdom dependency with happy-dom in Vue JavaScript rstest fragment
packages/create-rslib/fragments/tools/rstest-react-ts/rstest.config.ts Updated testEnvironment to happy-dom in React TypeScript rstest fragment
packages/create-rslib/fragments/tools/rstest-react-ts/package.json Replaced jsdom dependency with happy-dom in React TypeScript rstest fragment
packages/create-rslib/fragments/tools/rstest-react-js/rstest.config.js Updated testEnvironment to happy-dom in React JavaScript rstest fragment
packages/create-rslib/fragments/tools/rstest-react-js/package.json Replaced jsdom dependency with happy-dom in React JavaScript rstest fragment

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@9aoy 9aoy merged commit 31b64d9 into main Dec 25, 2025
25 checks passed
@9aoy 9aoy deleted the rstest-happy-dom branch December 25, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants