nikku / karma-browserify

A fast Browserify integration for Karma that handles large projects with ease
MIT License
321 stars 49 forks source link

Unable to use karma-browserify when using browserify-shim #170

Closed pelizza closed 8 years ago

pelizza commented 8 years ago

I'm trying to use karma-browserify together with browserify-shim with no success. Here is a repo to reproduce the error: https://github.com/pelizza/karma-browserify-shim

PhantomJS 2.1.1 (Mac OS X 0.0.0) ERROR TypeError: undefined is not an object (evaluating 'module.exports = ex') at /var/folders/_0/ql88mbyd6v34qsmysr5kf4780000gn/T/e0c5e5ebe3f49930de3d988c7196737f.browserify:40308 <- bower_components/jquery/dist/jquery.js:9837:0

Everything works fine when bundling with browserify, by it seems that karma simply doesn't find shimmed dependencies when preprocessing files with karma-browserify. I couldn't find much about this problem, except this one at stack overflow, without a solution: http://stackoverflow.com/questions/29050811/karma-browserify-throws-error-when-trying-to-load-modules-shimmed-with-browserif

nikku commented 8 years ago

I've got no idea about browserify-shim. But as you added it to your package.json as a transform it should not be necessary to redeclare it as part of the Karma configuration.

I may be wrong about that :wink:.

pelizza commented 8 years ago

Yep, you are totally right. That fixed the problem :)

Also, I just updated the repo removing browserify-shim from karma configuration.

Thanks!

dmitriz commented 7 years ago

Use Chrome instead of Phantom and your problem may go away :)