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

Template Unit Tests #4143

Closed
vhscom opened this issue Feb 27, 2022 · 5 comments
Closed

Template Unit Tests #4143

vhscom opened this issue Feb 27, 2022 · 5 comments

Comments

@vhscom
Copy link

vhscom commented Feb 27, 2022

Describe the problem

When scaffolding a new project I'd like a way to get started with Unit Testing using Vitest. This follows from the recent introduction of a template option to add Playwright.

Describe the proposed solution

Like with Playright, add an option to add Vitest for unit testing during project scaffolding.

Alternatives considered

Following the README instructions for https://github.com/nickbreaton/vitest-svelte-kit during set-up.

Importance

nice to have

Additional Information

Leaning into Vitest as opposed to Jest will help code created with SvelteKit projects to be more streamlined given an integration with the Vite built pipeline and help eliminate years of potentially inapplicable search results for React- and Vue-based test configurations.

@dominikg
Copy link
Member

dominikg commented Feb 27, 2022

the way you can use vitest with sveltekit is going to improve. As long as it isn't stable (see also https://github.com/nickbreaton/vitest-svelte-kit#stability) it's not suitable as an option in create-svelte.

In the interim, a svelte-adder could be implemented: svelte-add/svelte-add#191

@vhscom
Copy link
Author

vhscom commented Feb 27, 2022

I hear you. It's a bit of a chicken and the egg scenario. Kit is still in beta and I'm thinking more about man-hours spent trying to get Jest working with it as opposed to growing together with Vitest.

@rmunn
Copy link
Contributor

rmunn commented Feb 28, 2022

I think writing an adder for https://github.com/svelte-add/svelte-add is the best way to solve the chicken-and-egg problem, or if not solve it completely at least get around the largest issue. Things shouldn't go into create-svelte until they're stable, but if there's an unofficial (or semi-official) adder package, people won't have the same expectation of stability. So any errors due to rapidly-moving targets won't reflect badly on Svelte-Kit for people trying it out for the first time. But at the same time, it could be mentioned in the documentation (in the FAQ section, perhaps) as a recommended way to set up unit testing that's simpler than using Jest.

@Rich-Harris Rich-Harris added this to the whenever milestone Mar 5, 2022
@vhscom
Copy link
Author

vhscom commented Apr 16, 2022

Closing due to low priority to reduce noise. Check out this Discord server for chat about configuring Vitest. 👍

@vhscom vhscom closed this as completed Apr 16, 2022
@vhscom
Copy link
Author

vhscom commented Jul 24, 2022

Further discussion and voting #5285

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

No branches or pull requests

4 participants