Skip to content

Module API to start the SvelteKit (vite) dev server #2921

Closed
@JessicaSachs

Description

@JessicaSachs

Describe the problem

Hello! I'm adding Svelte (and SvelteKit) support for Cypress Component Testing.

For component testing in Cypress, we use a dev-server based architecture to bundle and serve each of your components (and their tests!) in isolation. Kind of like if each of your Spec files got its own HTML page.

Whenever we add support for a new app framework, we need the ability to start the user's local dev server from a node process and receive a handle to the server that was started.

Since SvelteKit is built on top of Vite, I can just use our existing @cypress/vite-dev-server, except that because SvelteKit's svelte.config.js config file augments the Vite Config with its own internal options (similar to how CRA, NextJS and Vue CLI wrap Webpack) I need to be able to get at the resolved configuration.

Describe the proposed solution

I would like one of two things. Either:

  • A method to resolve the merged SvelteKit Config + Vite Config options
  • A module API to start the SvelteKit dev server and return the server instance just started

Alternatives considered

No response

Importance

Cannot use SvelteKit without this.

Additional Information

I can likely work around this for simple use cases, but without Unless SvelteKit exposes the resolved options or there's a module API to start the server, we'll be unable to test components that reference the $app module.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions