qunit-harness
Advanced tools
Comparing version 0.1.13 to 0.1.14
@@ -20,2 +20,3 @@ 'use strict'; | ||
var CHECK_RESULTS_TIMEOUT = 1000 * 2; | ||
var REPORTING_TIMEOUT = 1000 * 30; | ||
@@ -86,4 +87,31 @@ //Utils | ||
}; | ||
this.tasks = []; | ||
this.reportingInterval = null; | ||
} | ||
SauceLabsAdapter.prototype._report = function _report() { | ||
var total = this.tasks.length; | ||
var queued = this.tasks.filter(function (task) { | ||
return task.status === 'queued'; | ||
}).length; | ||
var inProgress = this.tasks.filter(function (task) { | ||
return task.status === 'progress'; | ||
}).length; | ||
var completed = this.tasks.filter(function (task) { | ||
return task.status === 'completed'; | ||
}).length; | ||
console.log('Tasks total: ' + total + ', queued: ' + queued + ', in progress: ' + inProgress + ', completed: ' + completed); | ||
}; | ||
SauceLabsAdapter.prototype._runReporting = function _runReporting() { | ||
var _this = this; | ||
this._report(); | ||
this.reportingInterval = setInterval(function () { | ||
return _this._report(); | ||
}, REPORTING_TIMEOUT); | ||
}; | ||
SauceLabsAdapter.prototype._startTask = function _startTask(browsers, url) { | ||
@@ -127,5 +155,12 @@ var params, body, taskIds; | ||
case 7: | ||
this.tasks = taskIds.map(function (id) { | ||
return { id: id, status: 'queued' }; | ||
}); | ||
this._runReporting(); | ||
return context$2$0.abrupt('return', taskIds); | ||
case 8: | ||
case 10: | ||
case 'end': | ||
@@ -154,3 +189,10 @@ return context$2$0.stop(); | ||
var result = body['js tests'] && body['js tests'][0]; | ||
var status = null; | ||
if (body.completed) status = 'completed';else if (result) status = result.status.indexOf('queued') > -1 ? 'queued' : 'progress'; | ||
runner.tasks.filter(function (task) { | ||
return task.id === taskId; | ||
})[0]['status'] = status; | ||
if (!body.completed) { | ||
@@ -178,2 +220,5 @@ return wait(CHECK_RESULTS_TIMEOUT).then(checkResult); | ||
return _promise2.default.all(completeTaskPromises); | ||
}).then(function (result) { | ||
clearInterval(runner.reportingInterval); | ||
return result; | ||
}); | ||
@@ -180,0 +225,0 @@ }); |
{ | ||
"name": "qunit-harness", | ||
"version": "0.1.13", | ||
"version": "0.1.14", | ||
"description": "A library for running qunit tests on a local machine and in the SauceLabs environment.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/AlexanderMoskovkin/qunit-harness", |
440738
12217