My angular test environment worked fine until a week ago when I started getting this error whenever I tried to start karma:
Chrome 53.0.2785 (Linux 0.0.0) ERROR
Uncaught ReferenceError: require is not defined
at node_modules/chai-as-promised/lib/chai-as-promised.js:2
This error first occurred on the CI platform. This was just beginning to happen in my local environment when I cleaned and reinstalled all application dependencies, so I can conclude that some kind of dependency has received an update, and now something is missing.
I found found a similar problem that recommended adding additional dependencies, such as requirejsand browserifyin the node list dependencies, as well as karma configuration file, but they did not help.
What else could cause this error? I have the following plugins loaded into karma:
plugins: [
'karma-jasmine',
'karma-mocha',
'karma-chrome-launcher',
'karma-chai',
'karma-chai-as-promised',
'karma-jquery-chai',
'karma-mocha',
'karma-coverage',
'karma-ng-html2js-preprocessor',
'karma-ng-json2js-preprocessor',
'karma-sinon',
'karma-sinon-chai'
]