Skip to content

Commit

Permalink
fix: collect nested suite serially
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Feb 14, 2022
1 parent b3a4354 commit c7f2637
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions packages/vitest/src/runtime/suite.ts
@@ -1,5 +1,5 @@
import { format } from 'util'
import type { File, MutableArray, RunMode, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Test, TestAPI, TestFunction } from '../types'
import type { File, MutableArray, RunMode, Suite, SuiteAPI, SuiteCollector, SuiteFactory, SuiteHooks, Task, Test, TestAPI, TestFunction } from '../types'
import { isObject, noop, toArray } from '../utils'
import { createChainable } from './chain'
import { collectTask, context, normalizeTest, runWithSuite } from './context'
Expand Down Expand Up @@ -114,10 +114,10 @@ function createSuiteCollector(name: string, factory: SuiteFactory = () => { }, m
if (factory)
await runWithSuite(collector, () => factory(test))

const allChildren = await Promise.all(
[...factoryQueue, ...tasks]
.map(i => i.type === 'collector' ? i.collect(file) : i),
)
const allChildren: Task[] = []

for (const i of [...factoryQueue, ...tasks])
allChildren.push(i.type === 'collector' ? await i.collect(file) : i)

suite.file = file
suite.tasks = allChildren
Expand Down

0 comments on commit c7f2637

Please sign in to comment.