Bun DOM Testing
Learn how to test DOM elements and components using Bun with happy-dom and React Testing Library
Install
npx skills add jarle/bun-skills --skill Bun DOM testinggit clone --depth 1 https://github.com/jarle/bun-skills.git /tmp/bun-skills
mkdir -p ~/.claude/skills
cp -r /tmp/bun-skills/skills/bun-test-dom ~/.claude/skills/Bun-DOM-testingPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# DOM testing
> Learn how to test DOM elements and components using Bun with happy-dom and React Testing Library
Bun's test runner plays well with existing component and DOM testing libraries, including React Testing Library and happy-dom.
## happy-dom
For writing headless tests for your frontend code and components, we recommend happy-dom. Happy DOM implements a complete set of HTML and DOM APIs in plain JavaScript, making it possible to simulate a browser environment with high fidelity.
To get started install the `@happy-dom/global-registrator` package as a dev dependency.
```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun add -d @happy-dom/global-registrator
```
We'll be using Bun's preload functionality to register the happy-dom globals before running our tests. This step will make browser APIs like `document` available in the global scope. Create a file called `happydom.ts` in the root of your project and add the following code:
```ts title="happydom.ts" icon="https://mintcdn.com/bun-1dd33a4e/nIz6GtMH5K-dfXeV/icons/typescript.svg?fit=max&auto=format&n=nIz6GtMH5K-dfXeV&q=85&s=5d73d76daf7eb7b158469d8c30d349b0" theme={"theme":{"light":"github-light","dark":"dracula"}}
import { GlobalRegistrator } from "@happy-dom/global-registrator";
GlobalRegistrator.register();
```
To preload this file before `bun test`, open or create a `bunfig.toml` file and add the following lines.Details
- Skill name
Bun DOM testing- Repository
- jarle/bun-skills
- Path
skills/bun-test-dom/SKILL.md- License
- MIT
- Repo updated
- 24 February 2026
FAQ
What does the Bun DOM Testing skill do?
Learn how to test DOM elements and components using Bun with happy-dom and React Testing Library
How do I install the Bun DOM Testing skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add jarle/bun-skills --skill Bun DOM testing. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Bun DOM Testing popular?
It lives in jarle/bun-skills, which has 9 GitHub stars and 1 forks.
Related skills
Bun Archive
9jarle/bun-skills
Create and extract tar archives with Bun's fast native implementation
Bun Auto Install
9jarle/bun-skills
Bun's automatic package installation feature for standalone script execution
Bun Bun Add
9jarle/bun-skills
Add packages to your project with Bun's fast package manager
Bun Finding Tests
9jarle/bun-skills
Learn how Bun's test runner discovers and filters test files in your project
Bun Dates and Times
9jarle/bun-skills
Learn how to manipulate time and dates in your Bun tests using setSystemTime and Jest compatibility functions
Bun Generate Code Coverage Reports with the Bun Test Runner
9jarle/bun-skills
Generate code coverage reports with the Bun test runner
Browse the most popular Claude skills, all testing & qa skills, or write your own with the skills generator.