---
id: app/component-testing/svelte/api
title: Svelte API
description: API for mounting Svelte components in Cypress tests.
section: app
source_path: docs/app/component-testing/svelte/api.mdx
version: e6988a974973e9090ce70406c38cb2b9e0eac9fa
updated_at: '2026-05-15T15:50:22.536Z'
---
# Svelte API

## Methods

### mount

```
import { mount } from 'cypress/svelte'
```

<table><tbody><tr><td>Description</td><td>Mounts a Svelte component inside the Cypress browser</td></tr><tr><td>Signature</td><td><p>mount(Component: Component&lt;Record&lt;string, any&gt;, Record&lt;string, any&gt;, any&gt;, options?: MountOptions): Cypress.Chainable&lt;MountReturn&gt;</p></td></tr><tr><td>Returns</td><td>Cypress.Chainable&lt;MountReturn&gt;</td></tr></tbody></table>

<table><caption>mount Parameters</caption><thead></thead><tbody><tr><td>Name</td><td>Type</td><td>Description</td></tr><tr><td>component</td><td><p>Component&lt;Record&lt;string, any&gt;, Record&lt;string, any&gt;, any&gt;</p></td><td>Svelte component being mounted</td></tr><tr><td>options</td><td>MountOptions (optional)</td><td>options to customize the component being mounted</td></tr></tbody></table>

#### Example

```
import Counter from './Counter.svelte'import { mount } from 'cypress/svelte'it('should render', () => {  mount(Counter, { props: { count: 42 } })  cy.get('button').contains(42)})
```

## Interfaces

### MountOptions

<table><caption>members</caption><thead></thead><tbody><tr><td>Name</td><td>Type</td><td>Description</td></tr><tr><td>anchor</td><td>Element (optional)</td><td></td></tr><tr><td>context</td><td>Map&lt;any, any&gt; (optional)</td><td></td></tr><tr><td>intro</td><td>boolean (optional)</td><td></td></tr><tr><td>log</td><td>boolean (optional)</td><td></td></tr><tr><td>props</td><td>Record&lt;string any&gt; (optional)</td><td></td></tr></tbody></table>

### MountReturn

Type that the `mount` function yields

<table><caption>members</caption><thead></thead><tbody><tr><td>Name</td><td>Type</td><td>Description</td></tr><tr><td>component</td><td>Record&lt;string, any&gt;</td><td></td></tr></tbody></table>
