( config: SerializedConfig, moduleRunner: TestModuleRunner, )
| 10 | import { TestRunner } from './test' |
| 11 | |
| 12 | async function getTestRunnerConstructor( |
| 13 | config: SerializedConfig, |
| 14 | moduleRunner: TestModuleRunner, |
| 15 | ): Promise<VitestRunnerConstructor> { |
| 16 | if (!config.runner) { |
| 17 | return ( |
| 18 | config.mode === 'test' ? TestRunner : NodeBenchmarkRunner |
| 19 | ) as any as VitestRunnerConstructor |
| 20 | } |
| 21 | const mod = await moduleRunner.import(config.runner) |
| 22 | if (!mod.default && typeof mod.default !== 'function') { |
| 23 | throw new Error( |
| 24 | `Runner must export a default function, but got ${typeof mod.default} imported from ${ |
| 25 | config.runner |
| 26 | }`, |
| 27 | ) |
| 28 | } |
| 29 | return mod.default as VitestRunnerConstructor |
| 30 | } |
| 31 | |
| 32 | export async function resolveTestRunner( |
| 33 | config: SerializedConfig, |
no test coverage detected