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) {
|
||||
allTests[singleTest] = tempTest;
|
||||
} else {
|
||||
console.log("Test does not exist", singleTest);
|
||||
console.log('Test does not exist', singleTest);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const testsSuitesWithLongDelay = {
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
export function runAll(testSelector?: string) {
|
||||
testsSelector = testSelector;
|
||||
@ -505,7 +513,7 @@ export function runAll(testSelector?: string) {
|
||||
testsQueue.push(new TestInfo(test.setUpModule, test));
|
||||
}
|
||||
|
||||
for (const testName in test) {
|
||||
for (const testName of getAllProperties(test)) {
|
||||
if (singleTestName && singleTestName !== testName.toLowerCase()) {
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user