Skip to content

fix(vitest): add resolve.conditions to client test config #580

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/smart-adults-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'sv': patch
---

fix: add `resolve.conditions` to the `client` test config for the `vitest` add-on
3 changes: 2 additions & 1 deletion packages/addons/vitest-addon/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export default defineAddon({
const clientObjectExpression = object.create({
extends: common.createLiteral(`./vite.config.${ext}`),
plugins: common.expressionFromString('[svelteTesting()]'),
resolve: object.create({ conditions: common.expressionFromString("['browser']") }),
test: object.create({
name: common.createLiteral('client'),
environment: common.createLiteral('jsdom'),
Expand Down Expand Up @@ -141,7 +142,7 @@ export default defineAddon({
const vitestConfig = functions.argumentByIndex(defineWorkspaceCall, 0, object.createEmpty());
const testObject = object.property(vitestConfig, 'test', object.createEmpty());

const workspaceArray = object.property(testObject, 'workspace', array.createEmpty());
const workspaceArray = object.property(testObject, 'projects', array.createEmpty());
array.push(workspaceArray, clientObjectExpression);
array.push(workspaceArray, serverObjectExpression);

Expand Down