This library requires three bits of setup to work correctly with Vitest
Browser bundle resolution
Testing library cleanup
jest-dom matchers (optional, but pretty much everyone wants it)
Setting these up is a bit fiddly and results in inbound issues in this repository
Proposal
The most effective method at resolving (1) appears to be setting up a simple Vite plugin. A Vite plugin would also be capable of configuring (2) and maybe even (3). I think we should add a Vite plugin as an export to this library.
Usage (e.g. with SvelteKit)
// vite.config.ts
import { defineConfig } from 'vite'
import { svelteTesting } from '@testing-library/svelte/vite-plugin'
import { svelteKit } from '@sveltejs/kit/vite'
export default defineConfig({
plugins: [svelteKit(), svelteTesting()],
})
Overview
This library requires three bits of setup to work correctly with Vitest
jest-dom
matchers (optional, but pretty much everyone wants it)Setting these up is a bit fiddly and results in inbound issues in this repository
Proposal
The most effective method at resolving (1) appears to be setting up a simple Vite plugin. A Vite plugin would also be capable of configuring (2) and maybe even (3). I think we should add a Vite plugin as an export to this library.
Usage (e.g. with SvelteKit)
Related issues
222
358