Skip to content

Commit

Permalink
fixed build task in gruntfile to get real coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
yoavniran committed Jun 13, 2015
1 parent 7145a7a commit 4ea7908
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
9 changes: 5 additions & 4 deletions gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ module.exports = function (grunt) {

blanket: { //output the instrumented files
output: {
files: [
{src: "./src/", dest: "./output/coverage/src"}
]
src: "./src/",
dest: "./output/coverage/src"
}
},

Expand Down Expand Up @@ -85,7 +84,9 @@ module.exports = function (grunt) {
grunt.registerTask("test", ["mochaTest:test"]);
grunt.registerTask("localcov", ["clean", "blanket", "copy:test", "mochaTest:htmlcov"]);
grunt.registerTask("coverage", ["clean", "blanket", "copy:test", "mochaTest:coverage", "mochaTest:htmlcov", "coveralls"]);
grunt.registerTask("build", ["jshint", "test", "coverage", "mochaTest:travis-cov"]);
grunt.registerTask("build", ["jshint", "coverage", "test", "mochaTest:travis-cov"]);

grunt.registerTask("bla", ["test","clean", "blanket", "copy:test", "mochaTest:coverage", "mochaTest:travis-cov" ]);

grunt.registerTask("default", ["jshint", "test", "localcov"]);
};
21 changes: 15 additions & 6 deletions src/providers/sockjs/Provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ var SockJSProvider = (function () {
ProviderBase.call(this, options);

this._server = null;
this._onNewConnectionHandler = null;
};

util.inherits(SockJSProvider, ProviderBase);
Expand All @@ -40,11 +41,14 @@ var SockJSProvider = (function () {
return this;
};

SockJSProvider.prototype.stop = function(){
SockJSProvider.prototype.stop = function () {

debug("stop called - stopping SockJS provider server");

this._server.
if (this._onNewConnectionHandler) {
this._server.removeListener("connection", this._onNewConnectionHandler);
this._onNewConnectionHandler = null;
}

this._server = null;

Expand All @@ -53,14 +57,19 @@ var SockJSProvider = (function () {

SockJSProvider.prototype.onNewConnection = function (cb, options) {

this._server.on("connection", function (sjConn) {
var connection = new Connection(sjConn, options);
cb(connection);
});
this._onNewConnectionHandler = _onNewConnection.bind(this, cb, options);
this._server.on("connection", this._onNewConnectionHandler);

return this;
};

function _onNewConnection(cb, options, sjConn) {

debug("new sock js connection");
var connection = new Connection(sjConn, options);
cb(connection);
}

return SockJSProvider;
})();

Expand Down
1 change: 1 addition & 0 deletions src/providers/ws/Provider.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ var WSProvider = (function () {

function _onNewConnection(cb, options, client) {

debug("new ws connection");
var connection = new Connection(client, options);
cb(connection);
}
Expand Down

0 comments on commit 4ea7908

Please sign in to comment.