fix(tests): should run all unit tests (#9013)

This commit is contained in:
Eduardo Speroni
2020-11-07 16:04:04 -03:00
committed by GitHub
parent 9797dfd78d
commit d30b22c9a3

View File

@ -318,11 +318,10 @@ export function isRunningOnEmulator(): boolean {
if (tempTest) { if (tempTest) {
allTests[singleTest] = tempTest; allTests[singleTest] = tempTest;
} else { } else {
console.log("Test does not exist", singleTest); console.log('Test does not exist', singleTest);
} }
} }
const testsSuitesWithLongDelay = { const testsSuitesWithLongDelay = {
HTTP: 15 * 1000, HTTP: 15 * 1000,
}; };
@ -451,6 +450,15 @@ function log(): void {
TKUnit.write(testsName + ' COMPLETED for ' + duration.toFixed(2) + ' BACKSTACK DEPTH: ' + Frame.topmost().backStack.length, Trace.messageType.info); TKUnit.write(testsName + ' COMPLETED for ' + duration.toFixed(2) + ' BACKSTACK DEPTH: ' + Frame.topmost().backStack.length, Trace.messageType.info);
} }
function getAllProperties(obj: any) {
let properties = new Set<string>();
let currentObj = obj;
do {
Object.getOwnPropertyNames(currentObj).map((item) => properties.add(item));
} while ((currentObj = Object.getPrototypeOf(currentObj)) && currentObj !== Object.prototype);
return [...properties.keys()];
}
let testsSelector: string; let testsSelector: string;
export function runAll(testSelector?: string) { export function runAll(testSelector?: string) {
testsSelector = testSelector; testsSelector = testSelector;
@ -505,7 +513,7 @@ export function runAll(testSelector?: string) {
testsQueue.push(new TestInfo(test.setUpModule, test)); testsQueue.push(new TestInfo(test.setUpModule, test));
} }
for (const testName in test) { for (const testName of getAllProperties(test)) {
if (singleTestName && singleTestName !== testName.toLowerCase()) { if (singleTestName && singleTestName !== testName.toLowerCase()) {
continue; continue;
} }