You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am setting up unit tests using angular 1, karma and jasmine. All our modules and plugins and scripts are statically included. When using jasmine and angular-mocks module is defined in the window scope. So when leaflet.GeometryUtil tries to add itself to leaflet it assumes module.export will exist (because the module object is defined), but it doesn't exist. In my case I expect it to install itself to a global L that is statically included, and not required.
we are using a few other leaflet plugins, but this seems to be the only one with this problem.
// Supports UMD. AMD, CommonJS/Node.js and browser contextif(typeofmodule!=="undefined"&&module.exports){module.exports=factory(require('heatmap.js'),require('leaflet'));}elseif(typeofdefine==="function"&&define.amd){define(['heatmap.js','leaflet'],factory);}else{// browser globalsif(typeofwindow.h337==='undefined'){thrownewError('heatmap.js must be loaded before the leaflet heatmap plugin');}if(typeofwindow.L==='undefined'){thrownewError('Leaflet must be loaded before the leaflet heatmap plugin');}context[name]=factory(window.h337,window.L);}
I think an extra check for the fully qualified module.exports would solve my problem.
Why they put that in the global scope to begin with, I am not sure.
I cant upgrade frameworks for business reasons.
The text was updated successfully, but these errors were encountered:
I am setting up unit tests using angular 1, karma and jasmine. All our modules and plugins and scripts are statically included. When using jasmine and angular-mocks module is defined in the window scope. So when leaflet.GeometryUtil tries to add itself to leaflet it assumes module.export will exist (because the module object is defined), but it doesn't exist. In my case I expect it to install itself to a global L that is statically included, and not required.
we are using a few other leaflet plugins, but this seems to be the only one with this problem.
Perhaps you can look to see what these ones are doing when performing the // Packaging/modules magic dance.
Leaflet-semicircle
Leaflet-heatmap
Leaflet.markercluster
this is what the heatmap plugin is doing:
I think an extra check for the fully qualified module.exports would solve my problem.
Why they put that in the global scope to begin with, I am not sure.
I cant upgrade frameworks for business reasons.
The text was updated successfully, but these errors were encountered: