使用带有Grails karma-test-runner插件的karma-remote-reporter时连接关闭错误

时间:2015-02-16 22:09:33

标签: grails karma-runner karma-jasmine

我正在尝试将我的karma \ jasmine客户端测试集成到我们的grails环境中,以便在grails test-app的CI服务器中运行它们。

使用karma start path\to\karma.conf.js从命令行运行测试。

我的Grails测试课程定义如下:

import de.is24.util.karmatestrunner.junit.KarmaTestSuiteRunner
import org.junit.runner.RunWith

@RunWith(KarmaTestSuiteRunner.class)
@KarmaTestSuiteRunner.KarmaRemoteServerPort(8888)
@KarmaTestSuiteRunner.KarmaConfigPath("test/unit/javascript/karma.conf.js")
class JavaScriptUnitTestKarmaSuite {
}

业力配置是:

/*global module: false*/
module.exports = function (config) {
    "use strict";
    config.set({

        basePath: '.',

        frameworks: ['jasmine'],

        files: [
            /* files under test go here */
            'spec/**/*.js'
        ],

        reporters: ['remote'],

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

        remoteReporter: {
            host: 'localhost',
            port: '8888'
        },

         // web server port
        port: 9876,

        logLevel: config.LOG_INFO,

        autoWatch: false,

        browsers: ['PhantomJS'],

        singleRun: true
    });
};

运行这些测试的结果是:

|Running 1 javascript test...
Karma result receiver server startet at port: 8888
INFO [karma]: Karma v0.12.31 server started at http://localhost:9876/
INFO [launcher]: Starting browser PhantomJS
INFO [reporter.remote]: Connected to localhost:8888
INFO [PhantomJS 1.9.8 (Windows 7)]: Connected on socket Em1lBUzTMKsGT3mgVETX with id 3845261
INFO [reporter.remote]: browser + connectionPhantomJS 1.9.8 (Windows 7)
INFO [reporter.remote]: onBrowserStart: 3845261
INFO [reporter.remote]: Connection closed
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
ERROR [reporter.remote]: Not connected to server.
INFO [reporter.remote]: Error while communicate to remote server ("localhost:8888") to report test results. 
Error: This socket has been ended by the other party
INFO [reporter.remote]: Karma finished...
Program terminated!

我认为问题可能是因为karma-remote-runner使用直接套接字而不是websockets,因此降级为grails插件引用的版本,但错误是相同的。

我的package.json文件是:

{
  "devDependencies": {
    "karma": "~0.12.31",
    "jasmine-core": "~2.2.0",
    "karma-jasmine": "~0.2.2",
    "karma-phantomjs-launcher": "~0.1.4",
    "karma-coverage": "~0.2.7",
    "karma-junit-reporter": "~0.2.2",
    "karma-remote-reporter": "0.1.5"
  }
}

我在Window 7上运行。

任何帮助都会很棒,我整晚都在为此而斗争!

0 个答案:

没有答案