fix(vitest): add resolve.conditions to client test config#580
fix(vitest): add resolve.conditions to client test config#580AdrianGonz97 wants to merge 3 commits intomainfrom
vitest): add resolve.conditions to client test config#580Conversation
🦋 Changeset detectedLatest commit: 5b5d640 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
For clarity, the |
|
we want to rework the template based on https://scottspence.com/posts/migrating-from-testing-library-svelte-to-vitest-browser-svelte also if the output we currently do works in vitest 3.1 and breaks in 3.2 thats potentially a bug/regression in vitest. we should not have to mess with conditions anymore |
|
(the testing docs are due for an update as well, sveltejs/svelte#14243 (comment)) |
|
Should we go ahead with this or wait on the upstream fix, where @dominikg created the issue? (vitest-dev/vitest#8120) |
|
BTW, also glad to see that |
|
i'd rather see the jsdom setup replaced with browser-mode as mentioned above, also there is https://sveltest.dev now 🥳 can't tell what other effects these missing conditions have so maybe pinning vitest to 3.1 for the time being would be the better choice. |
|
Closing in favor of #584 |
closes #579
It looks like our default config broke in
vitest@3.2.0. Addingresolve.conditionsto the client test config seemingly fixes it (as mentioned in the related issue), though I'm unsure if it's the right fix.cc @dominikg @manuel3108
export default defineConfig({ // ... test: { projects: [ { extends: './vite.config.ts', plugins: [svelteTesting()], + resolve: { conditions: ['browser'] }, test: { name: 'client', environment: 'jsdom', clearMocks: true, include: ['src/**/*.svelte.{test,spec}.{js,ts}'], exclude: ['src/lib/server/**'], setupFiles: ['./vitest-setup-client.ts'] } }, { extends: './vite.config.ts', test: { name: 'server', environment: 'node', include: ['src/**/*.{test,spec}.{js,ts}'], exclude: ['src/**/*.svelte.{test,spec}.{js,ts}'] } } ] } });