KonnorRogers / shadow-dom-testing-library

An extension of DOM-testing-library to provide hooks into the shadow dom
MIT License
98 stars 2 forks source link

fix: remove jsdom so polyfills arent needed. #37

Closed KonnorRogers closed 2 years ago

KonnorRogers commented 2 years ago

Fixes #34

CreativeTechGuy commented 2 years ago

Just FYI, DOMParser is a browser API so it won't work in Node. It happens to still work here because JSDOM implements it. So in a roundabout way, this still depends on JSDOM globals being added. I think this sort of solves the problem since as long as this function isn't executed, it won't cause any problems. But if someone tries to execute this in a Node environment, it'll still crash as DOMParser doesn't exist.

KonnorRogers commented 2 years ago

@CreativeTechGuy I think its a fair tradeoff only because I wouldn't expect to be running "DOM-testing-library" in an environment that wasn't at least JSDOM

andyleanlibrary commented 2 years ago

@CreativeTechGuy yep, that someone is me :-). This broke our tests, but adding jsdom in as a dependency fixed this.

KonnorRogers commented 2 years ago

Apologies @andyleanlibrary !

I'll add a note to the docs.