{
  "doc": {
    "id": "app/component-testing/svelte/overview",
    "title": "Svelte Component Testing",
    "description": "Learn how to set up component tests in Svelte, configure Cypress for Svelte projects, and test Svelte components with Vite and a custom Webpack config.",
    "section": "app",
    "source_path": "/llm/markdown/app/component-testing/svelte/overview.md",
    "version": "24a73f8a97175663aaffd3b016289fb2a523a4ea",
    "updated_at": "2026-05-14T20:17:33.301Z",
    "headings": [
      {
        "id": "app/component-testing/svelte/overview#svelte-component-testing",
        "text": "Svelte Component Testing",
        "level": 1
      },
      {
        "id": "app/component-testing/svelte/overview#what-youll-learn",
        "text": "What you'll learn",
        "level": 5
      },
      {
        "id": "app/component-testing/svelte/overview#framework-support",
        "text": "Framework Support",
        "level": 2
      },
      {
        "id": "app/component-testing/svelte/overview#tutorial",
        "text": "Tutorial",
        "level": 2
      },
      {
        "id": "app/component-testing/svelte/overview#installation",
        "text": "Installation",
        "level": 2
      },
      {
        "id": "app/component-testing/svelte/overview#framework-configuration",
        "text": "Framework Configuration",
        "level": 2
      },
      {
        "id": "app/component-testing/svelte/overview#svelte-with-vite",
        "text": "Svelte with Vite",
        "level": 3
      },
      {
        "id": "app/component-testing/svelte/overview#vite-configuration",
        "text": "Vite Configuration",
        "level": 4
      },
      {
        "id": "app/component-testing/svelte/overview#svelte-vite-sample-apps",
        "text": "Svelte Vite Sample Apps",
        "level": 4
      },
      {
        "id": "app/component-testing/svelte/overview#svelte-with-webpack",
        "text": "Svelte with Webpack",
        "level": 3
      },
      {
        "id": "app/component-testing/svelte/overview#webpack-configuration",
        "text": "Webpack Configuration",
        "level": 4
      },
      {
        "id": "app/component-testing/svelte/overview#svelte-webpack-sample-apps",
        "text": "Svelte Webpack Sample Apps",
        "level": 4
      }
    ]
  },
  "chunks": [
    {
      "id": "app/component-testing/svelte/overview#what-youll-learn",
      "doc_id": "app/component-testing/svelte/overview",
      "heading": "What you'll learn",
      "heading_level": 5,
      "content_markdown": "##### What you'll learn\n\n*   How to set up component tests in Svelte\n*   How to configure Cypress for Svelte projects\n*   How to test Svelte components with Vite and a custom Webpack config\n",
      "section": "app",
      "anchors": [
        "what-youll-learn"
      ],
      "path": "/llm/json/chunked/app/component-testing/svelte/overview.json",
      "token_estimate": 45
    },
    {
      "id": "app/component-testing/svelte/overview#framework-support",
      "doc_id": "app/component-testing/svelte/overview",
      "heading": "Framework Support",
      "heading_level": 2,
      "content_markdown": "## Framework Support\n\nCypress Component Testing supports Svelte 5 in a variety of different frameworks:\n\n*   [Svelte with Vite](#Svelte-with-Vite)\n*   [Svelte with Webpack](#Svelte-with-Webpack)\n\nSvelte is currently in alpha support for component testing.\n",
      "section": "app",
      "anchors": [
        "framework-support"
      ],
      "path": "/llm/json/chunked/app/component-testing/svelte/overview.json",
      "token_estimate": 43
    },
    {
      "id": "app/component-testing/svelte/overview#installation",
      "doc_id": "app/component-testing/svelte/overview",
      "heading": "Installation",
      "heading_level": 2,
      "content_markdown": "## Installation\n\nTo get up and running with Cypress Component Testing in Svelte, install Cypress into your project:\n\n*   npm\n*   yarn\n*   pnpm\n\n```\nnpm install cypress --save-dev\n```\n\n```\nyarn add cypress --dev\n```\n\n```\npnpm add --save-dev cypress\n```\n\nOpen Cypress:\n\n*   npm\n*   yarn\n*   pnpm\n\n```\nnpx cypress open\n```\n\n```\nyarn cypress open\n```\n\n```\npnpm cypress open\n```\n\nChoose Component Testing\n\nThe Cypress Launchpad will guide you through configuring your project.\n\nFor 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.\n\nFor usage and examples, visit the [Svelte Examples](/llm/markdown/app/component-testing/svelte/examples.md) guide.\n",
      "section": "app",
      "anchors": [
        "installation"
      ],
      "path": "/llm/json/chunked/app/component-testing/svelte/overview.json",
      "token_estimate": 139
    },
    {
      "id": "app/component-testing/svelte/overview#framework-configuration",
      "doc_id": "app/component-testing/svelte/overview",
      "heading": "Framework Configuration",
      "heading_level": 2,
      "content_markdown": "## Framework Configuration\n\nCypress 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. The examples below are for reference purposes.\n\n### Svelte with Vite\n\nCypress Component Testing works with Svelte apps that use Vite 5+ as the bundler.\n\n#### Vite Configuration\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'vite',    },  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'vite',    },  },})\n```\n\n#### Svelte Vite Sample Apps\n\n*   [Svelte 5 Vite with Typescript](https://github.com/cypress-io/cypress-component-testing-apps/tree/main/svelte-vite-ts)\n\n### Svelte with Webpack\n\nCypress Component Testing works with Svelte apps that use Webpack 5+ as the bundler.\n\n#### Webpack Configuration\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')const webpackConfig = require('./webpack.config')module.exports = defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'webpack',      // optionally pass in webpack config      webpackConfig,    },  },})\n```\n\n```\nimport { defineConfig } from 'cypress'import webpackConfig from './webpack.config'export default defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'webpack',      // optionally pass in webpack config      webpackConfig,    },  },})\n```\n\nIf 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.\n\n#### Svelte Webpack Sample Apps\n\n*   [Svelte 5 Webpack 5 with Typescript](https://github.com/cypress-io/cypress-component-testing-apps/tree/main/svelte-webpack-ts)\n",
      "section": "app",
      "anchors": [
        "framework-configuration"
      ],
      "path": "/llm/json/chunked/app/component-testing/svelte/overview.json",
      "token_estimate": 329
    },
    {
      "id": "app/component-testing/svelte/overview#svelte-with-vite",
      "doc_id": "app/component-testing/svelte/overview",
      "heading": "Svelte with Vite",
      "heading_level": 3,
      "content_markdown": "### Svelte with Vite\n\nCypress Component Testing works with Svelte apps that use Vite 5+ as the bundler.\n\n#### Vite Configuration\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'vite',    },  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'vite',    },  },})\n```\n\n#### Svelte Vite Sample Apps\n\n*   [Svelte 5 Vite with Typescript](https://github.com/cypress-io/cypress-component-testing-apps/tree/main/svelte-vite-ts)\n",
      "section": "app",
      "anchors": [
        "svelte-with-vite"
      ],
      "path": "/llm/json/chunked/app/component-testing/svelte/overview.json",
      "token_estimate": 101
    },
    {
      "id": "app/component-testing/svelte/overview#vite-configuration",
      "doc_id": "app/component-testing/svelte/overview",
      "heading": "Vite Configuration",
      "heading_level": 4,
      "content_markdown": "#### Vite Configuration\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')module.exports = defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'vite',    },  },})\n```\n\n```\nimport { defineConfig } from 'cypress'export default defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'vite',    },  },})\n```\n",
      "section": "app",
      "anchors": [
        "vite-configuration"
      ],
      "path": "/llm/json/chunked/app/component-testing/svelte/overview.json",
      "token_estimate": 63
    },
    {
      "id": "app/component-testing/svelte/overview#svelte-with-webpack",
      "doc_id": "app/component-testing/svelte/overview",
      "heading": "Svelte with Webpack",
      "heading_level": 3,
      "content_markdown": "### Svelte with Webpack\n\nCypress Component Testing works with Svelte apps that use Webpack 5+ as the bundler.\n\n#### Webpack Configuration\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')const webpackConfig = require('./webpack.config')module.exports = defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'webpack',      // optionally pass in webpack config      webpackConfig,    },  },})\n```\n\n```\nimport { defineConfig } from 'cypress'import webpackConfig from './webpack.config'export default defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'webpack',      // optionally pass in webpack config      webpackConfig,    },  },})\n```\n\nIf 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.\n\n#### Svelte Webpack Sample Apps\n\n*   [Svelte 5 Webpack 5 with Typescript](https://github.com/cypress-io/cypress-component-testing-apps/tree/main/svelte-webpack-ts)\n",
      "section": "app",
      "anchors": [
        "svelte-with-webpack"
      ],
      "path": "/llm/json/chunked/app/component-testing/svelte/overview.json",
      "token_estimate": 176
    },
    {
      "id": "app/component-testing/svelte/overview#webpack-configuration",
      "doc_id": "app/component-testing/svelte/overview",
      "heading": "Webpack Configuration",
      "heading_level": 4,
      "content_markdown": "#### Webpack Configuration\n\n*   cypress.config.js\n*   cypress.config.ts\n\n```\nconst { defineConfig } = require('cypress')const webpackConfig = require('./webpack.config')module.exports = defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'webpack',      // optionally pass in webpack config      webpackConfig,    },  },})\n```\n\n```\nimport { defineConfig } from 'cypress'import webpackConfig from './webpack.config'export default defineConfig({  component: {    devServer: {      framework: 'svelte',      bundler: 'webpack',      // optionally pass in webpack config      webpackConfig,    },  },})\n```\n\nIf 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.\n",
      "section": "app",
      "anchors": [
        "webpack-configuration"
      ],
      "path": "/llm/json/chunked/app/component-testing/svelte/overview.json",
      "token_estimate": 136
    }
  ]
}