Svelte API

Methods

mount

import { mount } from 'cypress/svelte'
Description Mounts a Svelte component inside the Cypress browser
Signature mount<T extends SvelteComponent>(Component: SvelteConstructor<T>, options?: MountOptions<T>): Cypress.Chainable<MountReturn<T>>
Generic Param T The component type
Returns Cypress.Chainable<MountReturn>
mount Parameters
Name Type Description
component SvelteConstructor Svelte component being mounted
options MountOptions<T> (optional) options to customize the component being mounted

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

members
Name Type Description
anchor Element (optional)
context Map<any, any> (optional)
intro boolean (optional)
log boolean (optional)
props Record<string any> (optional)

MountReturn

members
Name Type Description
component T