enzymejs/enzyme

Silently failing tests with JSDOM

Aberta

#621 aberto em 3 de out. de 2016

 (0 comentário) (0 reação) (0 responsável)JavaScript (1.967 forks)batch import
docshelp wanted

Métricas do repositório

Stars
 (19.826 estrelas)
Métricas de merge de PR
 (Métricas PR pendentes)

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.

Guia do colaborador