Skip to content

Commit

Permalink
replace svelteTesting plugin with resolve config
Browse files Browse the repository at this point in the history
The svelteTesting plugin was causing issues with svelte-headless-table
components. Using the unit testing config recomendation from Svelte's
docs addresses the Vitest browser resolve requirments without breaking
svelte-headless-table.
  • Loading branch information
kenkunz committed Nov 21, 2024
1 parent 115411f commit 86b795e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { FileSystemIconLoader } from 'unplugin-icons/loaders';
import { sentrySvelteKit } from '@sentry/sveltekit';
import { enhancedImages } from '@sveltejs/enhanced-img';
import jsonServer from 'vite-plugin-simple-json-server';
import { svelteTesting } from '@testing-library/svelte/vite';

const customLogger = (({ warnOnce, ...otherLogMethods }) => {
return {
Expand Down Expand Up @@ -54,9 +53,6 @@ export default defineConfig({
}
}),

// Testing Library plugin for unit tests
svelteTesting(),

// vite plugin to create a mock JSON api for integration tests
// only available when using `npm run dev` or `npm run preview`
// https://github.com/alextim/vite-plugin-simple-json-server/
Expand All @@ -66,6 +62,10 @@ export default defineConfig({
})
],

// Tell Vitest to use the `browser` entry points in `package.json` files, even though it's running in Node
// see: https://svelte.dev/docs/svelte/testing#Unit-and-integration-testing-using-Vitest
resolve: process.env.VITEST ? { conditions: ['browser'] } : undefined,

server: {
fs: {
allow: [process.cwd()]
Expand Down

0 comments on commit 86b795e

Please sign in to comment.