vitest-dev/vitest · error · Error

Unsupported framework: ${framework}

Error message

Unsupported framework: ${framework}

What it means

Thrown by getFrameworkTestPackage() in packages/vitest/src/create/browser/creator.ts during the `vitest init` browser scaffolding flow. The function maps a framework name (vanilla/vue/svelte/react/lit/preact/solid/marko/qwik) to the test-renderer package to install; reaching the throw means the framework value is not one of the supported keys. Because the prompt constrains the choice, this usually indicates an externally driven call or a future/typo'd framework name passed into the scaffolder.

Source

Thrown at packages/vitest/src/create/browser/creator.ts:114

      return null
    case 'vue':
      return 'vitest-browser-vue'
    case 'svelte':
      return 'vitest-browser-svelte'
    case 'react':
      return 'vitest-browser-react'
    case 'lit':
      return 'vitest-browser-lit'
    case 'preact':
      return 'vitest-browser-preact'
    case 'solid':
      return '@solidjs/testing-library'
    case 'marko':
      return '@marko/testing-library'
    case 'qwik':
      return 'vitest-browser-qwik'
  }
  throw new Error(`Unsupported framework: ${framework}`)
}

function getFrameworkPluginPackage(framework: string) {
  switch (framework) {
    case 'vue':
      return '@vitejs/plugin-vue'
    case 'svelte':
      return '@sveltejs/vite-plugin-svelte'
    case 'react':
      return '@vitejs/plugin-react'
    case 'preact':
      return '@preact/preset-vite'
    case 'solid':
      return 'vite-plugin-solid'
    case 'marko':
      return '@marko/vite'
    case 'qwik':
      return '@builder.io/qwik/optimizer'

View on GitHub (pinned to d568f8ce37)

Solutions

  1. Pick one of the supported frameworks: vanilla, vue, svelte, react, lit, preact, solid, marko, qwik.
  2. If you are extending Vitest, add the new framework to both getFramework() (prompt list) and getFrameworkTestPackage()/getFrameworkPluginPackage().
  3. Update vitest to the latest patch — the framework may have been added in a newer release.
  4. Run vitest init interactively rather than scripting it, so the prompt enforces valid values.
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED_FRAMEWORKS = ['vanilla','vue','svelte','react','lit','preact','solid','marko','qwik'] as const
function isSupportedFramework(f: string): f is typeof SUPPORTED_FRAMEWORKS[number] {
  return (SUPPORTED_FRAMEWORKS as readonly string[]).includes(f)
}

Type guard

const SUPPORTED = new Set(['vanilla','vue','svelte','react','lit','preact','solid','marko','qwik'])
const isSupportedFramework = (f: string): boolean => SUPPORTED.has(f)

Prevention

When it happens

Trigger: Programmatically invoking the create() flow with a framework string outside the supported list; a stale fork of creator.ts whose prompt choices were edited without updating getFrameworkTestPackage; corrupted prompt input returning an unexpected value.

Common situations: Contributing a new framework to the scaffolder and forgetting to update the switch; running a patched/older vitest init against a newer prompt list; user typing a custom framework name in a non-interactive invocation.

Related errors


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