cssinjs / jss

JSS is an authoring tool for CSS which uses JavaScript as a host language.
https://cssinjs.org
MIT License
7.08k stars 399 forks source link

cover undef possibility on getHead #1470

Closed jstamariz closed 3 years ago

jstamariz commented 3 years ago

Corresponding issue (if exists):

TypeError: Cannot read property 'appendChild' of undefined

Changelog

I just added a condiitonal access operator becuase it was failing on my jest test suites at DomRenderer.js (Line: 249)

image

kof commented 3 years ago

Something is wrong with your setup, jest should provide JSDOM with a head element ready

jstamariz commented 3 years ago

Thanks for the fast response, but i think that's the best solution bcz when I handle it with the conditional access operator all my tests suites run properly, I'm working with react.

image

kof commented 3 years ago

There are more problems you are not aware of with this. If you don't render to JSDOM, you can disable DOMRenderer

jstamariz commented 3 years ago

So I must be wrong, sorry for wasting your time bro, one last thing, how can I disable the DOMRenderer?

kof commented 3 years ago

https://cssinjs.org/jss-api?v=v10.6.0#setup-jss-instance

Renderer: null

kof commented 3 years ago

I am assuming you want to skip css rendering and only test components.

jstamariz commented 3 years ago

Thanks, have a nice day, greetings from Dominican Republic dude! 🇩🇴