thlorenz / proxyquire

🔮 Proxies nodejs require in order to allow overriding dependencies during testing.
MIT License
2.75k stars 100 forks source link

Unable to run it with Karma #235

Closed ghost closed 5 years ago

ghost commented 5 years ago

Hello,

When I run my test through karma I get the following error, running it with just jasmine it's fine. Is there specific settings for it in karma for proxyrequire?

TypeError: proxyquire is not a function at at UserContext.beforeEach (/var/folders/5w/rflxm6z54kl6bjwkf0z7cl8r0000gn/T/3d2194b4e9ce64940188886c80746ca1.browserify.js:65583:14) at

module.exports = function (config) { config.set({ basePath: '', frameworks: ['jasmine', 'browserify'], files: [ 'src/**/**/*.spec.js' ], exclude: [ 'node_module/**/*.js' ], preprocessors: { '**/*.spec.js': ['browserify'] }, plugins: ['karma-browserify', 'karma-jasmine', 'karma-chrome-launcher'], reporters: ['progress'], port: 9876, colors: true, logLevel: config.LOG_INFO, autoWatch: true, browsers: ['Chrome'], singleRun: false, concurrency: Infinity })

bendrucker commented 5 years ago

proxyquire is a node-specific package. For browserify, check out https://github.com/thlorenz/proxyquireify which has a mostly compatible API.