Skip to content

Commit

Permalink
feat(vitest): add the svelte testing library
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexAegis committed May 20, 2024
1 parent 78231f1 commit 23ae364
Show file tree
Hide file tree
Showing 3 changed files with 519 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/vitest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
},
"dependencies": {
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"@testing-library/svelte": "^5.1.0",
"@vitest/coverage-v8": "^1.6.0",
"@vitest/ui": "^1.6.0",
"jsdom": "24.0.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/vitest/src/configs/vitest-svelte.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
import { svelte } from '@sveltejs/vite-plugin-svelte';
import { svelteTesting } from '@testing-library/svelte/vite';
import { mergeConfig } from 'vitest/config';
import { vitestWebConfig } from './vitest-web.config.js';

/**
* This vitest config contains the svelte plugin from @sveltejs/vite-plugin-svelte
* and the svelteTesting plugin from @testing-library/svelte/vite
*/
export const vitestSvelteConfig = mergeConfig(vitestWebConfig, {
plugins: [svelte({ hot: !process.env['VITEST'] })],
plugins: [svelte({ hot: !process.env['VITEST'] }), svelteTesting()],
});
Loading

0 comments on commit 23ae364

Please sign in to comment.