mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
TKUnit: add exception guard and fail the test instead of crashing the app.
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user