mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 12:57:42 +08:00
TKUnit: add exception guard and fail the test instead of crashing the app.
This commit is contained in:
@ -120,13 +120,16 @@ function runAsync(testInfo: TestInfoEntry, recursiveIndex: number, testTimeout?:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (testInfo.instance) {
|
if (testInfo.instance) {
|
||||||
testInfo.testFunc.apply(testInfo.instance, [doneCallback]);
|
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);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user