adds saucelabs integration to unit tests

This commit is contained in:
Jim Witschey 2014-07-25 11:23:47 -04:00
parent c8e0d917f7
commit 6a1ab4e39f
6 changed files with 158 additions and 6 deletions

View file

@ -1,7 +1,34 @@
function test(condition) {
var duration = 0;
var start = 0;
var result = true;
if (performance.now) {
start = performance.now();
}
try {if (!condition()) throw new Error}
catch (e) {console.error(e);test.failures.push(condition)}
catch (e) {result = false;console.error(e);test.failures.push(condition)}
if (performance.now) {
duration = performance.now() - start;
}
test.total++
test_obj = {
name: "" + test.total,
result: result,
duration: duration
}
if (!result) {
message: "failed: " + condition,
window.global_test_results.tests.push(test_obj)
}
window.global_test_results.duration += duration;
if (result) {
window.global_test_results.passed++;
} else {
window.global_test_results.failed++;
}
}
test.total = 0
test.failures = []