enzymejs/enzyme

Silently failing tests with JSDOM

開放

#621 建立於 2016年10月3日

 (0 則留言) (0 個反應) (0 位負責人)JavaScript (1,967 個分叉)batch import
docshelp wanted

倉庫指標

星標
 (19,826 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

This is likely closely related to #543.

My mocha test suite runs after a setup script.

The problem is that examples fail silently if document.defaultView.XMLHttpRequest is assigned to global.XMLHttpRequest.

Similarly, I worked around it with

if (typeof global[property] === 'undefined' && property !== 'XMLHttpRequest') {
  global[property] = document.defaultView[property];
}

I can't really pinpoint the root cause of this, but if nothing else it may be worthwhile to update the JSDOM guide.

貢獻者指南