Uncaught TypeError: Cannot read property 'jasmineRequire' of undefined
gotofritz opened this issue · 2 comments
Hi
When I try to use karma-babel-preprocessor without even any files, but with the framework set to jasmine, I get: Uncaught TypeError: Cannot read property 'jasmineRequire' of undefined
karma.conf.js
module.exports = function(config) {
config.set({
browsers: ["Chrome"],
files: [
],
frameworks: [ "jasmine" ],
logLevel: 'LOG_DEBUG',
preprocessors: {
"./**/*.js": ["babel"]
},
"babelPreprocessor": {
}
});
};
Package.json
"jasmine": "2.3.1",
"jasmine-core": "2.3.4",
...
"karma-jasmine": "0.3.6",
If I remove the babel preprocessor everything works fine. Thanks
@gotofritz Sorry for this late reply. I could reproduce the error and found that it was caused by applying babel preprocessor to jasmine files. jasmine internally detect the running environment and babel seems to break the detection.
So it will make it work to explicitly specify the directories of your own scripts like:
preprocessors: {
"src/**/*.js": ["babel"],
"test/**/*.js": ["babel"]
}
It is generally a good idea not to apply unnecessary preprocessors to third-party libraries in terms of safety and performance. I'll write about it on README. Thanks for reporting!
Updated README. Closing.