gulp karma问题浏览器永远不会启动

时间:2016-04-21 19:42:37

标签: gulp karma-runner gulp-karma

我有 node 4.4.3 npm 3.8.6 全局安装protractor: 3.2.2 gulp 3.9.1全局和本地安装了一个链接

package.json

"devDependencies": {
        "connect": "3.4.1",
        "gulp-load-plugins": "1.2.0",
        "gulp-protractor": "2.1.0",
        "serve-static": "1.10.2",
        "karma":"0.13.22",
        "karma-chrome-launcher": "0.2.3",
        "karma-jasmine": "0.3.8"
    }

gulpfile.js

var  Server = require('karma').Server;

gulp.task('test3', function (done) {
Server.start({
        configFile: __dirname + '/karma.conf.js'

    }, done);
});

当我运行任务时,我得到的唯一反馈是

[11:10:03] Starting 'test3'...

21 04 2016 11:10:04.008:WARN [karma]: No captured browser, open http://localhost:9876/

21 04 2016 11:10:04.016:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/

然后它永远等待

当我执行任务时," old"方式:

 var karma = require('karma').server;
    var karmaConf = require('./karma.conf.js')();
    karma.start(karmaConf, done);

工作正常

我确实有一个正确配置的karma.conf.js。 感谢

1 个答案:

答案 0 :(得分:0)

好的,我找到了 我的karma.conf.js就是这样的

module.exports = function () {
    return {...};
};

我做了更改,使其像这样

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

这使它起作用