Reputation: 988
I'm trying to set up an angular testing environment using Karma, Jasmine, and Phantomjs. It's a rails app using hamlcoffee as template language.
My problem is that when i try to run the tests i get the following error:
PhantomJS 1.9.7 (Linux) ERROR
SyntaxError: Parse error at /home/me/.rvm/gems/ruby-2.1.2/bundler/gems/haml_coffee_assets-a3c2951eca00/vendor/assets/javascripts/hamlcoffee.js.coffee.erb:1
It looks like the file hamlcoffee.js.coffee.erb
is the problem here, so i tried adding everything ending with .erb
to the exclude list in the karma config file, but unfortunately with no luck.
This is my Karma config file:
// Karma configuration
module.exports = function(config) {
config.set({
// base path, based on tmp/ folder
basePath: '..',
// frameworks to use
frameworks: ['jasmine', 'ng-scenario'],
// list of files / patterns to load in the browser
files: [
APPLICATION_SPEC,
'app/assets/javascripts/*/*.{coffee,js}',
'spec/javascripts/**/*_spec.{coffee,js}',
'app/assets/*.haml'
],
// list of files to exclude
exclude: [
'**/*.erb'
],
// test results reporter to use
// possible values: 'dots', 'progress', 'junit', 'growl', 'coverage'
reporters: ['progress'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: true,
// Start these browsers, currently available:
// - Chrome
// - ChromeCanary
// - Firefox
// - Opera (has to be installed with `npm install karma-opera-launcher`)
// - Safari (only Mac; has to be installed with `npm install karma-safari-launcher`)
// - PhantomJS
// - IE (only Windows; has to be installed with `npm install karma-ie-launcher`)
browsers: ['PhantomJS'],
// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
// Continuous Integration mode
// if true, it capture browsers, run tests and exit
singleRun: false,
// Preprocessors
preprocessors: {
'**/*.coffee' : 'coffee',
'app/assets/javascripts/**/*.hamlc' : 'haml'
},
hamlPreprocessor: {
options: {
language: 'coffee'
}
}
});
};
I'm using the karma-haml-preprocessor for my .hamlc
templates.
Upvotes: 1
Views: 323