Closed agoldis closed 6 years ago
Loading a web app that uses require-handlebars-plugin via jsdom confuses the initialization flow. The re-definition of fetchText function doesn't happen because jsdom doesn't fulfill any of the conditions below:
require-handlebars-plugin
jsdom
fetchText
if (typeof window !== 'undefined' && window.navigator && window.document && !window.navigator.userAgent.match(/Node.js/)) { ... } else if ( typeof process !== 'undefined' && process.versions && !!process.versions.node ) { ... } else if (typeof java !== 'undefined' && typeof java.io !== 'undefined') { ... }
Ended up by removing !window.navigator.userAgent.match(/Node.js/ to mimic browser-like behaviour in jsdom
!window.navigator.userAgent.match(/Node.js/
Loading a web app that uses
require-handlebars-plugin
viajsdom
confuses the initialization flow. The re-definition offetchText
function doesn't happen becausejsdom
doesn't fulfill any of the conditions below:Ended up by removing
!window.navigator.userAgent.match(/Node.js/
to mimic browser-like behaviour injsdom