vitest-dev/vitest · error · Error

Tester HTML file "${testerHtmlPath}" doesn't exist.

Error message

Tester HTML file "${testerHtmlPath}" doesn't exist.

What it means

When `ProjectBrowser` is constructed, it resolves the tester HTML path — either `browser.testerHtmlPath` (resolved against `config.root`) or the built-in `distRoot/client/tester/tester.html` — and checks it exists. If missing, the orchestrator cannot load tests in the browser, so it throws immediately.

Source

Thrown at packages/browser/src/node/project.ts:52

  public state: BrowserServerState = new BrowserServerState()

  constructor(
    public parent: ParentBrowserProject,
    public project: TestProject,
    public base: string,
  ) {
    this.vitest = project.vitest
    this.config = project.config
    this.vite = parent.vite

    // instances can override testerHtmlPath
    const testerHtmlPath = project.config.browser.testerHtmlPath
      ? resolve(project.config.root, project.config.browser.testerHtmlPath)
      : resolve(distRoot, 'client/tester/tester.html')
    // TODO: when config resolution is rewritten, project and parentProject should be created before the vite server is started
    if (!existsSync(testerHtmlPath)) {
      throw new Error(`Tester HTML file "${testerHtmlPath}" doesn't exist.`)
    }
    this.testerFilepath = testerHtmlPath
    this.testerHtml = readFile(
      this.testerFilepath,
      'utf8',
    ).then(html => (this.testerHtml = html))
  }

  private commands = {} as Record<string, BrowserCommand<any, any>>

  public registerCommand<K extends keyof BrowserCommands>(
    name: K,
    cb: BrowserCommand<
      Parameters<BrowserCommands[K]>,
      ReturnType<BrowserCommands[K]>
    >,
  ): void {
    if (!/^[a-z_$][\w$]*$/i.test(name)) {

View on GitHub (pinned to d568f8ce37)

Solutions

  1. If you set `browser.testerHtmlPath`, verify the file exists relative to `config.root` (use an absolute path to disambiguate).
  2. Remove the override to use the built-in tester: delete `browser.testerHtmlPath`.
  3. Reinstall `@vitest/browser` (and `vitest`) to restore the built-in `client/tester/tester.html`.
  4. If building from source, run the client build step (`pnpm build` in the browser package).

Example fix

// before
export default defineConfig({
  test: { browser: { testerHtmlPath: './tester.html' } },
})

// after — file actually exists, or drop the override
export default defineConfig({
  test: { browser: { enabled: true } },
})
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs'
import { resolve } from 'pathe'

function assertTesterHtml(root: string, override?: string): void {
  const path = override ? resolve(root, override) : undefined
  if (path && !existsSync(path)) {
    throw new Error(`Custom browser.testerHtmlPath not found at ${path}`)
  }
}

Prevention

When it happens

Trigger: Configuring `browser.testerHtmlPath` to a path that doesn't exist; or a corrupt/missing Vitest install where the built-in `tester.html` is absent.

Common situations: Typo or wrong relative path in `testerHtmlPath`; pointing at a custom template that was moved/deleted; partial install of `@vitest/browser` (missing `client/tester/tester.html`); building from source and forgetting to run the client build.

Related errors


AI-assisted analysis of vitest-dev/vitest@d568f8ce37 (2026-08-03). Data as JSON: /data/errors/0e782de344636d3d.json. Report an issue: GitHub.