TKUnit: add exception guard and fail the test instead of crashing the app.

This commit is contained in:
Hristo Deshev
2015-06-12 18:58:12 +03:00
parent e2a0c7d587
commit acfb51bba2

View File

@ -120,12 +120,15 @@ function runAsync(testInfo: TestInfoEntry, recursiveIndex: number, testTimeout?:
} }
} }
if (testInfo.instance) { try {
testInfo.testFunc.apply(testInfo.instance, [doneCallback]); if (testInfo.instance) {
} testInfo.testFunc.apply(testInfo.instance, [doneCallback]);
else { } else {
var func: any = testInfo.testFunc; var func: any = testInfo.testFunc;
func(doneCallback); func(doneCallback);
}
} catch (e) {
doneCallback(e);
} }
setTimeout(checkFinished, 0); setTimeout(checkFinished, 0);
@ -342,4 +345,4 @@ var doModalAndroid = function (quitLoop: () => boolean, timeoutSec: number) {
quit = true; quit = true;
} }
} }
}; };