Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support JSDOM #3554

Closed
itsezc opened this issue Jul 7, 2023 · 6 comments · Fixed by #15870
Closed

Support JSDOM #3554

itsezc opened this issue Jul 7, 2023 · 6 comments · Fixed by #15870
Assignees
Labels
enhancement New feature or request

Comments

@itsezc
Copy link

itsezc commented Jul 7, 2023

What is the problem this feature would solve?

Currently DOM testing can be achieved, albeit through a third party library, while this is fine it'd be great if we can standardise this to some extent similar to Vite / Vitest's approach, by making this an easily configurable option.

What is the feature you are proposing to solve the problem?

For tests, I believe the DOM should automatically be added in where for instance the tsconfig.json contains DOM in the lib field, or alternatively a configuration option in bunfig.toml. This could also additionally be used to enable DOM matchers (related to #1825).

JSDOM is the obvious candidate, but other alternatives could be considered here, such as happy-dom. Although from my (limited) understanding, JSDOM remains prevalent with many testing libraries out there.

Related to #198 and #1825

What alternatives have you considered?

N/A

@itsezc itsezc added the enhancement New feature or request label Jul 7, 2023
@robobun robobun closed this as not planned Won't fix, can't repro, duplicate, stale Jul 7, 2023
@robobun robobun reopened this Jul 7, 2023
@colinhacks colinhacks changed the title Add JSDOM to Bun tests defaults Support JSDOM Sep 13, 2023
@colinhacks
Copy link
Contributor

Hijacking this to serve as a tracking issue for JSDOM support.

Currently this is blocked on node-canvas which uses V8 C++ APIs internally.

@gitblit
Copy link

gitblit commented Dec 12, 2023

Adding a small failure sample here concerning vm.runInContext used by JSDOM. Same test works as expected on Node.

image

@niels-bosman
Copy link

I’d like to add that JSDOM support would not only enhance testing capabilities but also benefit applications that use JSDOM to convert XML data into a queryable DOM. Are there any plans to prioritize this in the short term?

@nektro nektro self-assigned this Oct 16, 2024
@quantizor

This comment has been minimized.

@niels-bosman
Copy link

You are a hero @Jarred-Sumner

@coopbri
Copy link

coopbri commented Dec 19, 2024

You are a hero @Jarred-Sumner

Truly a god among men

Jarred: but bun wait, there's more

probably-neb pushed a commit to probably-neb/bun that referenced this issue Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants