vitest-browser-svelte
Version:
Render Svelte components in Vitest Browser Mode
28 lines (24 loc) • 722 B
JavaScript
/**
* Rendering core for svelte-testing-library.
*
* Defines how components are added to and removed from the DOM.
* Will switch to legacy, class-based mounting logic
* if it looks like we're in a Svelte <= 4 environment.
*/
import * as LegacyCore from './legacy.js'
import * as ModernCore from './modern.svelte.js'
import {
UnknownSvelteOptionsError,
createValidateOptions,
} from './validate-options.js'
const { mount, unmount, updateProps, allowedOptions }
= ModernCore.IS_MODERN_SVELTE ? ModernCore : LegacyCore
/** Validate component options. */
const validateOptions = createValidateOptions(allowedOptions)
export {
mount,
UnknownSvelteOptionsError,
unmount,
updateProps,
validateOptions,
}