MCPcopy
hub / github.com/vitest-dev/vitest / getTests

Function getTests

packages/runner/src/utils/tasks.ts:9–31  ·  view source on GitHub ↗
(suite: Arrayable<Task>)

Source from the content-addressed store, hash-verified

7}
8
9export function getTests(suite: Arrayable<Task>): Test[] {
10 const tests: Test[] = []
11 const arraySuites = toArray(suite)
12 for (const s of arraySuites) {
13 if (isTestCase(s)) {
14 tests.push(s)
15 }
16 else {
17 for (const task of s.tasks) {
18 if (isTestCase(task)) {
19 tests.push(task)
20 }
21 else {
22 const taskTests = getTests(task)
23 for (const test of taskTests) {
24 tests.push(test)
25 }
26 }
27 }
28 }
29 }
30 return tests
31}
32
33export function getTasks(tasks: Arrayable<Task> = []): Task[] {
34 return toArray(tasks).flatMap(s =>

Callers 7

hasFailedSnapshotFunction · 0.90
onAfterRunSuiteMethod · 0.90
reportTestSummaryFunction · 0.90
printErrorsSummaryFunction · 0.90
reportBenchmarkSummaryFunction · 0.90
onTestRunEndMethod · 0.90
renderTableFunction · 0.90

Calls 2

toArrayFunction · 0.90
isTestCaseFunction · 0.85

Tested by

no test coverage detected