噶。 SyntaxError:期望一个标识符,但找到...而不是

时间:2017-12-29 13:11:56

标签: javascript ecmascript-6 karma-runner karma-jasmine

我最近更新了一个使用ES6的1.3到1.5的angularjs项目,当我运行grunt karma时,我的测试使用karma我得到以下错误:

  SyntaxError: Expected an identifier but found 'url' instead
  at target/grunt/components/variants/variants.js:52

variants.js的第52行是:let url = foo.com; 在它var url = foo.com工作之前。

如何让业力支持ES6?

这是我的karma.conf.js文件:

module.exports = function(config) {
  config.set({

    basePath : '',

    autoWatch : false,

    frameworks : ['jasmine'],

    browsers : ['PhantomJS'],

    plugins : [
      'karma-jasmine',
      'karma-phantomjs-launcher',
      'karma-chrome-launcher',
      'karma-firefox-launcher',
      'karma-junit-reporter'
    ],

    singleRun : true,

    reporters: ['progress', 'junit'],

    junitReporter : {
      outputFile: 'target/test-karma/unit.xml',
      suite: 'unit'
    },

    // Define log level. Possible values: LOG_DISABLE, LOG_ERROR, LOG_WARN, LOG_INFO, LOG_DEBUG
    logLevel: config.LOG_INFO
  });
};

package.json中,这是我与业力相关的devDependencies

  "grunt-karma": "~2.0.0",
    "grunt-notify": "~0.4.5",
    "grunt-script-link-tags": "~1.0.2",
    "http-server": "~0.9.0",
    "jasmine-core": "~2.5.2",
    "karma": "~1.5.0",
    "karma-jasmine": "~1.1.0",
    "karma-junit-reporter": "~1.2.0",
    "karma-phantomjs-launcher": "~1.0",
    "karma-chrome-launcher": "~2.0",
    "karma-firefox-launcher": "~1.0",

0 个答案:

没有答案