Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/vitest-dev/vitest. Next generation testing framework powered by Vite. vitest.dev
test testing-tools vite
Something went wrong. Try again.
TypeScript
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859import type { UserConfig as ViteUserConfig } from 'vite'import type { TestUserConfig } from 'vitest/node'import type { RunVitestConfig, TestFsStructure, VitestRunnerCLIOptions } from '../../test-utils'import { runInlineTests, runVitest } from '../../test-utils'import { instances, provider } from '../settings'
export { instances, provider } from '../settings'
export async function runInlineBrowserTests( structure: TestFsStructure, config?: RunVitestConfig, options?: VitestRunnerCLIOptions,) { return runInlineTests( structure, { watch: false, reporters: 'none', ...config, browser: { enabled: true, provider, instances, headless: true, ...config?.browser, } as TestUserConfig['browser'], }, options, )}
export async function runBrowserTests( config?: Omit<TestUserConfig, 'browser'> & { browser?: Partial<TestUserConfig['browser']> }, include?: string[], viteOverrides?: Partial<ViteUserConfig>, runnerOptions?: VitestRunnerCLIOptions,) { const result = await runVitest( { watch: false, reporters: 'none', ...config, browser: { headless: true, ...config?.browser }, $viteConfig: viteOverrides, }, include, runnerOptions, )
return { ...result, ctx: result.ctx!, stderr: result.stderr.replace( "Testing types with tsc and vue-tsc is an experimental feature.\nBreaking changes might not follow SemVer, please pin Vitest's version when using it.\n", '', ), }}