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: karma-browserify throws error when trying to load modules shimmed with browserify-shim
Found the solution: just remove the browserify-shim transform from the karma configuration file if it was already declared as a transform on package.json.
I have updated the repo with this fix.
Here is the discussion about this issue: https://github.com/nikku/karma-browserify/issues/170#issuecomment-187372309