---
id: app/component-testing/vue/overview
title: Vue component testing
description: >-
  Learn how to set up component tests in Vue and configure Cypress for Vue
  projects.
section: app
source_path: docs/app/component-testing/vue/overview.mdx
version: fbc9225067c51c52ee13224e3b702cf8a025ec12
updated_at: '2026-08-14T12:36:26.878Z'
---
# Vue Component Testing

What you'll learn

*   How to set up component tests in Vue
*   How to configure Cypress for Vue projects

## Framework Support

Cypress Component Testing supports Vue 3+ with the following frameworks:

*   [Vue with Vite](#Vue-with-Vite)
*   [Vue with Webpack](#Vue-with-Webpack)

## Tutorial

Visit the [Getting Started Guide](/llm/markdown/app/component-testing/get-started.md) for a step-by-step tutorial on adding component testing to any project and how to write your first tests.

## Installation

To get up and running with Cypress Component Testing in Vue, install Cypress into your project:

*   npm
*   Yarn
*   pnpm
*   Bun

```
npm install cypress --save-dev
```

```
yarn add cypress --dev
```

```
pnpm add --save-dev cypress
```

```
bun add --dev cypress
```

Open Cypress:

*   npm
*   Yarn
*   pnpm
*   Bun

```
npx cypress open
```

```
yarn cypress open
```

```
pnpm cypress open
```

```
bunx cypress open
```

Choose Component Testing

The Cypress Launchpad will guide you through configuring your project.

For a step-by-step guide on how to create a component test, refer to the [Getting Started](/llm/markdown/app/component-testing/get-started.md) guide.

For usage and examples, visit the [Vue Examples](/llm/markdown/app/component-testing/vue/examples.md) guide.

## Framework Configuration

Cypress Component Testing works out of the box with [Vite](https://vitejs.dev/), and a custom [Webpack](https://webpack.js.org/) config. Cypress will automatically detect one of these frameworks during setup and configure them properly.

For a full explanation of how the dev server and bundler work — including automatic config detection and override options — see [Component Testing Configuration — Dev Server and Bundler](/llm/markdown/app/component-testing/component-framework-configuration.md#Dev-Server-and-Bundler).

The examples below are for quick reference.

### Vue with Vite

Cypress Component Testing works with Vue apps that use Vite 5+ as the bundler.

#### Vite Configuration

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')module.exports = defineConfig({  component: {    devServer: {      framework: 'vue',      bundler: 'vite',    },  },})
```

```
import { defineConfig } from 'cypress'export default defineConfig({  component: {    devServer: {      framework: 'vue',      bundler: 'vite',    },  },})
```

#### Vue Vite Sample Apps

*   [Vue 3 Vite with TypeScript](https://github.com/cypress-io/cypress-component-testing-apps/tree/main/vue3-vite-ts)

### Vue with Webpack

Cypress Component Testing works with Vue apps that use Webpack 5+ as the bundler.

#### Webpack Configuration

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')const webpackConfig = require('./webpack.config')module.exports = defineConfig({  component: {    devServer: {      framework: 'vue',      bundler: 'webpack',      // optionally pass in webpack config      webpackConfig,      webpackConfig: async () => {        // ... do things ...        const modifiedConfig = await injectCustomConfig(baseConfig)        return modifiedConfig      },    },  },})
```

```
import { defineConfig } from 'cypress'import webpackConfig from './webpack.config'export default defineConfig({  component: {    devServer: {      framework: 'vue',      bundler: 'webpack',      // optionally pass in webpack config      webpackConfig,      webpackConfig: async () => {        // ... do things ...        const modifiedConfig = await injectCustomConfig(baseConfig)        return modifiedConfig      },    },  },})
```

If you don't provide one, Cypress will try to infer your webpack config. If Cypress cannot or you want to make modifications to your config, you can pass it in manually via the `webpackConfig` option.

#### Vue Webpack Sample Apps

*   [Vue 3 Webpack 5 with TypeScript](https://github.com/cypress-io/cypress-component-testing-apps/tree/main/vue3-webpack-ts)

## Using Cypress with Nuxt

Cypress does not ship a dedicated [Nuxt](https://nuxt.com/) framework definition, and it does not read `nuxt.config`. Instead, you component test a Nuxt 3+ app the same way you test any Vue 3 + Vite project, by setting the `vue` framework and the `vite` bundler:

*   cypress.config.js
*   cypress.config.ts

```
const { defineConfig } = require('cypress')module.exports = defineConfig({  component: {    devServer: {      framework: 'vue',      bundler: 'vite',    },  },})
```

```
import { defineConfig } from 'cypress'export default defineConfig({  component: {    devServer: {      framework: 'vue',      bundler: 'vite',    },  },})
```

Because Cypress does not execute `nuxt.config`, the bundler behavior Nuxt normally provides is not applied for you. Account for the following in the config you pass to Cypress:

*   **Path aliases** — Nuxt's `~` and `@` aliases are not visible to Cypress. Declare the ones your components use via `viteConfig`. See [Meta-frameworks that own the bundler config](/llm/markdown/app/component-testing/component-framework-configuration.md#Meta-frameworks-that-own-the-bundler-config).
*   **Auto-imports** — Nuxt auto-imports components and composables (such as `ref`, `useRoute`, and `useRuntimeConfig`). These are not available when a component is mounted in isolation, so either import what your component relies on explicitly or add the equivalent Vite plugin to your `viteConfig`.

## See also

*   [Component Testing code coverage](/llm/markdown/app/tooling/code-coverage.md#component-testing-code-coverage)
