Skip to content

Commit d7840c3

Browse files
mojavelinuxgabrielcsapo
authored andcommitted
add return value to listen method (#44)
resolves #43
1 parent 4c974e3 commit d7840c3

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/git.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,7 @@ class Git extends EventEmitter {
433433
* @param {Buffer|String=} options.key - the key file for the https server
434434
* @param {Buffer|String=} options.cert - the cert file for the https server
435435
* @param {Function} callback - the function to call when server is started or error has occured
436+
* @return {Git} - the Git instance, useful for chaining
436437
*/
437438
listen(port, options, callback) {
438439
const self = this;
@@ -447,6 +448,7 @@ class Git extends EventEmitter {
447448
});
448449

449450
this.server.listen(port, callback);
451+
return this;
450452
}
451453
/**
452454
* closes the server instance

test/git.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ test('git', (t) => {
604604

605605
const repos = new GitServer(repoDir);
606606
const port = Math.floor(Math.random() * ((1 << 16) - 1e4)) + 1e4;
607-
repos.listen(port);
607+
t.equal(repos.listen(port), repos);
608608

609609
process.chdir(srcDir);
610610
async.waterfall([

0 commit comments

Comments
 (0)