Skip to content
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

feat: vitest use client and server side testing for kit #311

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

manuel3108
Copy link
Member

Closes #270

Copy link

changeset-bot bot commented Nov 15, 2024

🦋 Changeset detected

Latest commit: 5622141

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
sv Patch

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

Copy link

pkg-pr-new bot commented Nov 15, 2024

Open in Stackblitz

npm i https://pkg.pr.new/sveltejs/cli/sv@311
npm i https://pkg.pr.new/sveltejs/cli/svelte-migrate@311

commit: 5622141

@manuel3108 manuel3108 force-pushed the feat/vitest-addon-use-workspaces branch from 6bf4bec to 1f5c62e Compare November 15, 2024 17:18
@manuel3108

This comment was marked as outdated.

@dominikg
Copy link
Member

dominikg commented Nov 15, 2024

requires an update to .gitignore for vitest.workspace temporary bundle files, similar to vite.config and vitest.config

depending on which tsconfig is used, vitest.workspace.ts needs to be added to that too

@dominikg
Copy link
Member

also if this is combined with storybook addon and that addon configures vitest for stories with play functions to become tests too, the code needs to be modified differently.

@manuel3108
Copy link
Member Author

also if this is combined with storybook addon and that addon configures vitest for stories with play functions to become tests too, the code needs to be modified differently.

For storybook we are just executing npx stoybook init. So there is not much we can change on our side. But we can probably get things rolling. Additionally, csf is currently not setup by that cli.

@manuel3108
Copy link
Member Author

requires an update to .gitignore for vitest.workspace temporary bundle files, similar to vite.config and vitest.config

Does this file get's generated for you? For me i only see vite.config.ts.timestamp-* being generated, even while running pnpm test. Additionally it seems like vite recently merged a PR that's going to generate those files outside of the project root either way. Looks like this will be a change that will be introduced in vite@6

depending on which tsconfig is used, vitest.workspace.ts needs to be added to that too

Why should this be necessary?

@manuel3108 manuel3108 marked this pull request as ready for review November 16, 2024 16:32
@manuel3108
Copy link
Member Author

Requires further modifications as pointed out by @dominikg here dominikg/vitest-example-svelte5#1

@manuel3108 manuel3108 marked this pull request as draft December 9, 2024 20:06
@dominikg
Copy link
Member

Requires further modifications as pointed out by @dominikg here dominikg/vitest-example-svelte5#1

those changes are required for vite-6, however given vitest only works with an override (no-go for our cli) or as a beta with that, i suggest we roll back the vite version in our templates to vite-5 until vitest@3 was released and we were able to ensure the config we create actually works.

By the time vitest@3 is out, i hope that users that created projects from now till then can just keep using the setup and update versions. If a breaking change in vitest@3 requires a config change, i wonder if we have the ability to run an upgrade command as well?

@manuel3108 manuel3108 mentioned this pull request Dec 11, 2024
@mxfactorial
Copy link

If a breaking change in vitest@3 requires a config change, i wonder if we have the ability to run an upgrade command as well?

will settle for a closed issue documenting the error and new config

may have to share the link a few times but we'll catch up

@manuel3108
Copy link
Member Author

manuel3108 commented Dec 23, 2024

Needs the following things to be done

  • use vite@6 in create templates again
  • wait for full vitest@3 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

testing of client and server code with vitest
4 participants