mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
fix(tests): should run all unit tests (#9013)
This commit is contained in:
@ -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;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user