src/mount.js

svelte-testing-library · packages/svelte-core/src/mount.js · javascript · MIT
ui

Mount Svelte components for testing, supporting Svelte 3/4/5

// Source: https://github.com/testing-library/svelte-testing-library | License: MIT | Copyright 2019 Ben Monro <ben.monro@gmail.com> (https://github.com/benmonro)
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * Component rendering core, with support for Svelte 3, 4, and 5
 */
import * as Svelte from 'svelte'

import { addCleanupTask, removeCleanupTask } from './cleanup.js'
import { createProps } from './props.svelte.js'
import { IS_MODERN_SVELTE } from './svelte-version.js'
import { getWrapperScaffold } from './wrapper.js'

/**
 * Mount a modern Svelte 5 component into the DOM.
 *
 * @template {import('../types.js').Component} C
 * @param {import('../types.js').ComponentType<C>} Component
 * @param {import('../types.js').MountOptions<C>} options
 * @returns {import(

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key