Skip to content
This repository was archived by the owner on Jul 28, 2023. It is now read-only.

Commit ea3ed1e

Browse files
fix: Ensure the browser gets terminated
Before the _done callback was not properly called resulting in issues with the parallel limit option and shutdown
1 parent a28b817 commit ea3ed1e

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

index.js

+18-6
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,20 @@ var formatError = function (error) {
118118
return error.toString()
119119
}
120120

121-
var BrowserStackBrowser = function (id, emitter, args, logger,
121+
var BrowserStackBrowser = function (
122+
id, emitter, args, logger,
122123
/* config */ config,
123-
/* browserStackTunnel */ tunnel, /* browserStackClient */ client,
124-
baseLauncherDecorator) {
124+
/* browserStackTunnel */ tunnel,
125+
/* browserStackClient */ client,
126+
baseLauncherDecorator,
127+
captureTimeoutLauncherDecorator,
128+
retryLauncherDecorator
129+
) {
125130
var self = this
126131

127132
baseLauncherDecorator(self)
133+
captureTimeoutLauncherDecorator(self)
134+
retryLauncherDecorator(self)
128135

129136
var workerId = null
130137
var captured = false
@@ -217,6 +224,13 @@ var BrowserStackBrowser = function (id, emitter, args, logger,
217224
}
218225

219226
this.kill = function (done) {
227+
var allDone = function () {
228+
self._done()
229+
if (done) {
230+
done()
231+
}
232+
}
233+
220234
if (!alreadyKilling) {
221235
alreadyKilling = q.defer()
222236

@@ -239,9 +253,7 @@ var BrowserStackBrowser = function (id, emitter, args, logger,
239253
}
240254
}
241255

242-
if (done) {
243-
alreadyKilling.promise.then(done)
244-
}
256+
return alreadyKilling.promise.then(allDone)
245257
}
246258

247259
this.forceKill = function () {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
],
1616
"author": "Vojta Jina <[email protected]>",
1717
"dependencies": {
18-
"browserstack": "1.2.0",
18+
"browserstack": "1.3.1",
1919
"browserstacktunnel-wrapper": "~1.4.2",
2020
"q": "~1.4.1"
2121
},

0 commit comments

Comments
 (0)