enzymejs/enzyme

Silently failing tests with JSDOM

Open

#621 opened on Oct 3, 2016

View on GitHub
 (0 comments) (0 reactions) (0 assignees)JavaScript (2,016 forks)batch import
docshelp wanted

Repository metrics

Stars
 (19,979 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

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.

Contributor guide