enzymejs/enzyme

Silently failing tests with JSDOM

Open

#621 创建于 2016年10月3日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)JavaScript (19,979 star) (2,016 fork)batch import
docshelp wanted

描述

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.

贡献者指南