I'm trying to create few simple tests for my Angular.JS app, but unfortunately, I can't resolve missing dependencies due to very short output from Angular / Karma (?)
My Karma config looks as follows:
module.exports = function (config) {
config.set({
basePath: '',
singleRun: true,
autoWatch: false,
frameworks: ['jasmine'],
browsers: ['PhantomJS'],
preprocessors: {
'./src/app/myApp.app.js': ['babel']
},
files: [
'./node_modules/angular/angular.js',
'./node_modules/angular-mocks/angular-mocks.js',
'./src/app/myApp.app.js',
'./test.js'
],
plugins: [
'karma-mocha-reporter',
'karma-jasmine',
'karma-babel-preprocessor',
'karma-phantomjs-launcher'
],
babelPreprocessor: {
options: {
presets: ['env'],
sourceMap: 'inline'
},
sourceFileName: function (file) {
return file.originalPath;
}
},
reporters: ['mocha']
});
}
What I'm doing here is basically including angular, angular-mocks, entry module for my app and one file with tests. Of course, some dependencies are missing now, but I'd like to add only required ones (and learn about missing steps after karma start).
Unfortunately, after running karma start I can only see that test has failed, and that's all - nothing more (for example, at runtime you can see 'rich' error message in browser's console, based on which you can include missing dependencies). Take a look at this error:
x it should do something funny
PhantomJS 2.1.1 (Mac OS X 0.0.0)
node_modules/angular/angular.js:4693:53
forEach@node_modules/angular/angular.js:325:24
loadModules@node_modules/angular/angular.js:4653:12
createInjector@node_modules/angular/angular.js:4575:30
WorkFn@node_modules/angular-mocks/angular-mocks.js:3120:60
And that's all. If I include minified version of Angular, I see a browser-like error message, based on which I can add required dependencies. With non-minified version, it's working like I've described. So my question is - how can I make error messages rich in karma tests?