karma-sauce-launcher
Advanced tools
Comparing version 4.1.3 to 4.1.4
@@ -0,1 +1,8 @@ | ||
## [4.1.4](https://github.com/karma-runner/karma-sauce-launcher/compare/v4.1.3...v4.1.4) (2020-04-28) | ||
### Bug Fixes | ||
* remove heartbeat function ([#205](https://github.com/karma-runner/karma-sauce-launcher/issues/205)) ([10e93cc](https://github.com/karma-runner/karma-sauce-launcher/commit/10e93cc5f9787c275db8c72f159dea65690b77f1)) | ||
## [4.1.3](https://github.com/karma-runner/karma-sauce-launcher/compare/v4.1.2...v4.1.3) (2020-04-13) | ||
@@ -2,0 +9,0 @@ |
@@ -24,28 +24,7 @@ "use strict"; | ||
let connectedDrivers = []; | ||
// number of pending cancellations for heartbeat functionality | ||
let pendingCancellations = 0; | ||
// Setup Browser name that will be printed out by Karma. | ||
this.name = browserName + ' on SauceLabs'; | ||
let pendingHeartBeat; | ||
const formatSauceError = (err) => { | ||
return err.message + '\n' + (err.data ? ' ' + err.data : ''); | ||
}; | ||
// Heartbeat function to keep alive sessions on Sauce Labs via webdriver JSON wire calls | ||
const heartbeat = () => { | ||
pendingHeartBeat = setTimeout((driver) => { | ||
log.debug('Heartbeat to Sauce Labs (%s) - fetching title', browserName); | ||
if (driver === undefined) { | ||
log.error('Heartbeat to %s failed: driver is null\n %s', browserName); | ||
clearTimeout(pendingHeartBeat); | ||
return this._done('failure'); | ||
} | ||
driver.getTitle() | ||
.then(null, (err) => { | ||
log.error('Heartbeat to %s failed\n %s', browserName, formatSauceError(err)); | ||
clearTimeout(pendingHeartBeat); | ||
return this._done('failure'); | ||
}); | ||
heartbeat(); | ||
}, 60000); | ||
}; | ||
// Listen for the start event from Karma. I know, the API is a bit different to how you | ||
@@ -85,10 +64,4 @@ // would expect, but we need to follow this approach unless we want to spend more work | ||
yield driver.get(pageUrl); | ||
heartbeat(); | ||
} | ||
catch (e) { | ||
// determine if there are still pending cancellations based on the heartbeat | ||
if (pendingCancellations > 0) { | ||
pendingCancellations--; | ||
return; | ||
} | ||
log.error(e); | ||
@@ -100,6 +73,2 @@ // Notify karma about the failure. | ||
this.on('kill', (doneFn) => __awaiter(this, void 0, void 0, function* () { | ||
// If there is still pending heartbeats, clear the timeout | ||
if (pendingHeartBeat) { | ||
clearTimeout(pendingHeartBeat); | ||
} | ||
try { | ||
@@ -106,0 +75,0 @@ yield Promise.all(connectedDrivers.map(driver => driver.quit())); |
{ | ||
"name": "karma-sauce-launcher", | ||
"version": "4.1.3", | ||
"version": "4.1.4", | ||
"description": "A Karma plugin. Launch any browser on SauceLabs!", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
50520
283