Skip to content

Commit

Permalink
fix: launcher kill method which was throwing an error if no callback …
Browse files Browse the repository at this point in the history
…was specified

bug introduced in 8647266

In server.js when singleRun = true, no callback is passed to when a browser complete to launcher.kill so if a browser is not yet connected but one has already finished the process throw an error.

TypeError: undefined is not a function
    at process._tickCallback (node.js:415:13)
  • Loading branch information
inspector-ambitious committed Oct 6, 2013
1 parent 85637ae commit 5439f1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ var Launcher = function(emitter, injector) {
}
}

process.nextTick(callback);
if (callback) {
process.nextTick(callback);
}
return false;
};

Expand Down
7 changes: 7 additions & 0 deletions test/unit/launcher.spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,13 @@ describe 'launcher', ->
expect(l.kill 'weid-id', done).to.equal false
expect(browser.kill).not.to.have.been.called

it 'should not resolve callback if none was defined', (done) ->
l.launch ['Fake']
browser = FakeBrowser._instances.pop()

expect(l.kill 'weid-id').to.equal false
process.nextTick ->
done()

describe 'killAll', ->
exitSpy = null
Expand Down

0 comments on commit 5439f1c

Please sign in to comment.