在添加运行时,Karma不执行e2e测试

时间:2014-01-13 19:11:44

标签: javascript angularjs gruntjs karma-runner angularjs-e2e

我正在使用Grunt,Angular和Karma,我有以下问题 - 我读到我必须将“:run”添加到karma任务的名称,以便在后台运行所有测试并仅使用一个卡玛的一个例子。听起来不错,简单。它适用于单元测试,但是当我使用e2e测试尝试相同的东西时,它不起作用。出于某种原因,我得到了:

Running "karma:e2e:run" (karma) task
NOT FOUND

当我删除“:run”时,每次触发测试时我都会收到一个新的Chrome窗口。

我的gruntfile的相关部分如下所示:

karma : {
  e2e : {
    configFile : 'src/config/karma-e2e.conf.js',
    background : true
  },      
  unit : {
    configFile : 'src/config/karma.conf.js',
    background : true
  }
},

watch : {
  scripts : {
    files : ["src/app/*.coffee", "src/partials/*.html","src/*.html","src/styl/*.styl"],
    tasks : ['nah'],
    options : {
      spawn : false,
      livereload: true
    }
  }
}

grunt.registerTask('nah', ['stylus','coffeelint','coffee','concat','karma:unit:run','karma:e2e:run','watch']);

我的Karma配置如下:

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

    basePath : '../',

    files : [
        '../test/e2e/*.js'
    ],

    autoWatch : false,

    //singleRun : true,

    reporters : 'dots',

    frameworks : ['ng-scenario'],

    browsers : ['Chrome'],

    proxies : {
      '/': 'http://localhost:3000/src/'
    },

    urlRoot : '/__e2e/',

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

    junitReporter : {
      outputFile: 'test_out/e2e.xml',
      suite: 'e2e'
    }

});
};

我不确定什么是未找到以及如何修复它,因为我一直在谷歌搜索并搞乱它没有任何结果我决定在这里问。谢谢!

0 个答案:

没有答案