-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Deno support #669
Comments
Booo! 😆 lol, but in all seriousness, I'd be curious to know what it takes to support Deno, but I don't think we need an issue open about this as it's not a priority until someone could reasonably make JSDOM (or similar) work in Deno, so I'm going to close this. |
Hey @kentcdodds , I've started messing about with deno & react, using aleph.js and wanted to look at using react-testing-library or a deno equivalent, and stumbled across this. We can use JSDOM in deno, example here https://github.com/YOU54F/deno-examples/blob/main/jsdom/jsdom.test.ts Only started using deno yesterday, out of curiosity to build an express like provider, and react based consumer equiv and exploring the available testing tools. |
You could also check https://github.com/b-fuze/deno-dom in a similar style, a more deno native lib. |
Hello. Libraries like JSDOM are working in Deno. I am trying to get testing-library to work and keep getting the error:
I have tried globalThis.document = document;
globalThis.window.document = document; I keep getting that error. I'm not sure how to patch it correctly, since Deno provides a When using import 'npm:global-jsdom/register' But that throws the error:
The DOM libraries are working by themselves. They just can't be put on the global object easily. Maybe there can be a way to configure/pass the document object to testing-library? That would make it easy to swap the DOM library. |
@kentcdodds Can we open this ticket again? Being able to do proper component tests will make Deno a much more reliable platform for doing React apps. Would be great if the https://github.com/denoland/fresh starter would include some component tests as an example and used |
If someone wants to work on that it's great by me! I don't have the bandwidth to work on it personally. As far as I'm aware, nothing has changed since my last comment on this so I don't see a reason to reopen 🤷♂️ |
I was eventually able to get this working but it's very messy, summarized here https://github.com/john-griffin/deno-dom-test |
Sorry, https://twitter.com/kentcdodds/status/1260716918526242816
:)
The text was updated successfully, but these errors were encountered: