为什么我不能在karma配置文件中使用对象键作为变量?

时间:2015-10-03 23:21:01

标签: javascript karma-runner

为了避免重复有关目录的信息,我创建了一组要在config对象中重用的变量。但是,由于某种原因,Karma不接受变量作为对象键。 为什么键" [模板]"和" [剧本]"打破我的karma.config?

module.exports = function(config) {

  var root = 'public/src/';
  var templates = root + '**/*.html';

  config.set({

    preprocessors : {
      [templates] : 'ng-html2js'
    }

  }

}

正如您所看到的,我只是展示了我感兴趣的文件部分,并且更容易(为您)理解我的问题。 我得到的错误如下:

ERROR [config]: Invalid config file!
[templates] : 'ng-html2js',
^
SyntaxError: Unexpected token [

0 个答案:

没有答案