-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Svelte 4 breaks unit tests involving stores #8994
Comments
I have a similar issue while importing
|
Since Svelte does only provide an ESM version of the runtime now, this probably involves configuring Jest in a way that it transpiles the ESM modules in |
svelte-jester has been tested to support Svelte 4. You may be able to either use it directly or as an example. I've posted tips on how to set that up over in that repo: svelteness/svelte-jester#121 (comment) I'll also take a minute to suggest that vitest is better than jest for most Svelte users. It has a largely compatible API, so you might consider migrating, which hopefully wouldn't be too hard given the API similarity. If not for your whole test suite, then at least for a portion that gives you the most difficulty in combination with jest. |
Svelte 4 support was added to |
The problem seems to lie with jest. However, I have not been able to find a solution. None of the instructions for supporting ESM dependencies work. |
The issue is stemming from helper functions in regular |
This is probably because Svelte 4 removed the CJS version of the Svelte runtime, which would include
Can you please file an issue in
What part in particular? Perhaps you could try the auto migration tool. Is there something we could suggest Vitest to add a method for or improve their migration guide for? |
@benmccann Thanks for the suggestions. However, I thought with the example project I provided in the repro section would make it pretty clear what the issue is we are facing. It really has nothing to do with We have hundreds of |
@bw-alessandro I was able to migrate the sample project you provided to Svelte 4. The steps I provided in the |
There's an issue in |
Describe the bug
My team is attempting to upgrade our company's application to svelte 4. We have been careful to upgrade all necessary dependencies before pulling the trigger. Now the only thing left to upgrade is svelte itself. However, as soon as we do upgrade any unit test we have that involve svelte/stores break.
We are utilizing Svelte with Typescript, and our unit tests are run via Jest.
We get the following output:
Reproduction
https://github.com/bw-alessandro/svelte-sample-app
This is a sample app that can reproduce the issue.
npm i
npm run test
with svelte 3, the unit test executes successfully.npx svelte-migrate@latest svelte-4
and upgrade the project.npm i
npm run test
The tests will fail to run.Logs
System Info
Severity
blocking an upgrade
The text was updated successfully, but these errors were encountered: