To simplify the configuration of the karma config file, I have utilized variables to store specific parts of the path.
var publicfolder = "public"
var mypath = "packages/vendor/package/";
files: [
publicfolder+'/assets/libs/jquery/dist/jquery.js',
publicfolder+'/assets/libs/angular/angular.js',
publicfolder+'/assets/libs/**/*.js',
publicfolder+'/app/**/*.js',
mypath +'/public/app/**/*.test.js',
mypath +'/public/app/**/*.html'
],
preprocessors: {
mypath +'/public/app/**/*.html':['ng-html2js']
},
However, during testing, an error occurred:
E:\www\project\karma.conf.js:83
mypath +'/public/app/**/*.html':['ng-html2js']
^
ERROR [config]: Invalid config file!
SyntaxError: Unexpected token +
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
My question is WHY? Why am I unable to use a variable in one place but not in another within the configuration?