assaf / zombie

Insanely fast, full-stack, headless browser testing using node.js
http://zombie.js.org/
MIT License
5.65k stars 518 forks source link

MessageChannel is not defined #1183

Open TheJoshuaEvans opened 5 years ago

TheJoshuaEvans commented 5 years ago

I am attempting to use Zombie.js for testing a Message Channel generation system. However, when attempting to create the channel I get the following stack trace:

ReferenceError: MessageChannel is not defined
  at WorldTree.<anonymous> (http://localhost:3000/bifrost.js:60:21)
  at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)
  at EventTargetImpl._dispatch (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:119:9)
  at EventTargetImpl.dispatchEvent (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:82:17)
  at Window.dispatchEvent (node_modules/jsdom/lib/jsdom/living/generated/EventTarget.js:157:21)
  at Window.DOM.EventTarget.dispatchEvent (node_modules/zombie/lib/dom/jsdom_patches.js:177:31)
  at Window.window.postMessage (node_modules/zombie/lib/document.js:452:10)
  at new RealmTower (http://localhost:3000/bifrost.js:170:29)
  at window.addEventListener (http://localhost:3000/ideal/child.html:script:21:26)
  at invokeEventListeners (node_modules/jsdom/lib/jsdom/living/events/EventTarget-impl.js:193:27)

It appears as though the MessageChannel "class" is not defined. This may be an underlying issue with JSDom (looking at the stack trace), rather than Zombie itself

According to the MDN documentation, MessageChannel is supported all the way back to IE10, so it seems strange to me that it's not valid here https://developer.mozilla.org/en-US/docs/Web/API/MessageChannel

TheJoshuaEvans commented 5 years ago

I did some testing and found that jsdom was the issue, and opened a new ticket there as well: https://github.com/jsdom/jsdom/issues/2448