nzbin / photoviewer

🖼️ A JS plugin to view images just like in Windows.
https://nzbin.github.io/photoviewer/
MIT License
356 stars 55 forks source link

Incompatible with happy-dom #47

Open danazag opened 11 months ago

danazag commented 11 months ago

Hi there! I'm using Vitest to run my tests, and for a performance boost I'm investigating rendering with happy-dom. However, when I try to run my tests, I get this error:

TypeError: Cannot set property isConnected of [object Object] which has only a getter
 ❯ new Node node_modules/happy-dom/src/nodes/node/Node.ts:57:29
 ❯ new Element node_modules/happy-dom/lib/nodes/element/Element.js:25:9
 ❯ new HTMLElement node_modules/happy-dom/lib/nodes/html-element/HTMLElement.js:17:9
 ❯ HTMLDocument.createElementNS node_modules/happy-dom/src/nodes/document/Document.ts:834:19
 ❯ HTMLDocument.createElement node_modules/happy-dom/src/nodes/document/Document.ts:803:15
 ❯ Object.<anonymous> node_modules/photoviewer/dist/photoviewer.common.js:97:22

I've seen this issue in a few libraries, including the axe-core library https://github.com/capricorn86/happy-dom/issues/978 where they documented a trivial workaround.

Thanks for all your work on this library, it's awesome.

nzbin commented 11 months ago

Thanks for your advice, I'm unfamiliar with happy-dom and I don't know what should to do.