1

我已经 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/

然后它永远等待

当我以“旧”方式运行任务时:

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

它工作正常

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

4

1 回答 1

0

好的,我发现我的 karma.conf.js 是这样的

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

我做了一些改变使它像这样

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

这使它工作

于 2016-04-21T23:12:36.697 回答