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

Function runInlineTests

test/test-utils/index.ts:510–536  ·  view source on GitHub ↗
(
  structure: TestFsStructure,
  config?: RunVitestConfig,
  options?: VitestRunnerCLIOptions,
  task?: TestContext['task'],
)

Source from the content-addressed store, hash-verified

508}
509
510export async function runInlineTests(
511 structure: TestFsStructure,
512 config?: RunVitestConfig,
513 options?: VitestRunnerCLIOptions,
514 task?: TestContext['task'],
515) {
516 const root = resolve(process.cwd(), `vitest-test-${crypto.randomUUID()}`)
517 const fs = useFS(root, structure, undefined, task)
518 const vitest = await runVitest({
519 root,
520 ...config,
521 }, config?.$cliFilters ?? [], options)
522 return {
523 fs,
524 root,
525 ...vitest,
526 get results() {
527 return vitest.ctx?.state.getTestModules() || []
528 },
529 testTree() {
530 return buildTestTree(vitest.ctx?.state.getTestModules() || [])
531 },
532 buildTree(onResult: (testResult: TestCase) => any) {
533 return buildTestTree(vitest.ctx?.state.getTestModules() || [], onResult)
534 },
535 }
536}
537
538const isWindows = process.platform === 'win32'
539

Calls 3

useFSFunction · 0.85
runVitestFunction · 0.70
resolveFunction · 0.50

Tested by 3

runBrowserTestsFunction · 0.72
runBrowserTestsFunction · 0.72
runFixtureTestsFunction · 0.72