diff --git a/packages/runner/src/utils/tasks.ts b/packages/runner/src/utils/tasks.ts index e80fd52343d3..40464ce8b067 100644 --- a/packages/runner/src/utils/tasks.ts +++ b/packages/runner/src/utils/tasks.ts @@ -6,7 +6,22 @@ function isAtomTest(s: Task): s is Test | TaskCustom { } export function getTests(suite: Arrayable): (Test | TaskCustom)[] { - return toArray(suite).flatMap(s => isAtomTest(s) ? [s] : s.tasks.flatMap(c => isAtomTest(c) ? [c] : getTests(c))) + const tests: (Test | TaskCustom)[] = [] + const suite_arr = toArray(suite) + for (const s of suite_arr) { + if (isAtomTest(s)) { + tests.push(s) + } + else { + for (const task of s.tasks) { + if (isAtomTest(task)) + tests.push(task) + else + tests.push(...getTests(task)) + } + } + } + return tests } export function getTasks(tasks: Arrayable = []): Task[] {