diff --git a/apps/tests/TKUnit.ts b/apps/tests/TKUnit.ts index ef4e4eee2..3c607b265 100644 --- a/apps/tests/TKUnit.ts +++ b/apps/tests/TKUnit.ts @@ -120,12 +120,15 @@ function runAsync(testInfo: TestInfoEntry, recursiveIndex: number, testTimeout?: } } - if (testInfo.instance) { - testInfo.testFunc.apply(testInfo.instance, [doneCallback]); - } - else { - var func: any = testInfo.testFunc; - func(doneCallback); + try { + if (testInfo.instance) { + testInfo.testFunc.apply(testInfo.instance, [doneCallback]); + } else { + var func: any = testInfo.testFunc; + func(doneCallback); + } + } catch (e) { + doneCallback(e); } setTimeout(checkFinished, 0); @@ -342,4 +345,4 @@ var doModalAndroid = function (quitLoop: () => boolean, timeoutSec: number) { quit = true; } } -}; \ No newline at end of file +};