Closed ultraq closed 6 years ago
Hmm, annoyingly, the library I used to shortcut creation of DOM elements, hyperscript, doesn't allow configuration of what "document" means to it, meaning I always get the html-element shim package instead of a JSDOM one 😕 I may have to write my own hyperscript wrapper...
Oh screw it, even Enzyme recommends copying those globals over into the Node global when doing testing that needs the DOM (see: https://github.com/airbnb/enzyme/blob/master/docs/guides/jsdom.md), so I don't feel so bad doing the same.
From JSDOM's own wiki and some reading of past issues, the way I'm testing things via jsdom-global is a rather unsupported hack 😛 See: https://github.com/tmpvar/jsdom/wiki/Don't-stuff-jsdom-globals-onto-the-Node-global
In the process of upgrading this dependency, I should also find a way to not have to rely on jsdom-global. I think what I'll need to do is outlined in that wiki article, which is to use the "window" object returned by a
new JSDOM
instance within the scope of the test, rather than assuming it exists there all the time.