vite-jest
vite-jest copied to clipboard
Support for SvelteKit projects
As it stands, Vite-Jest has baked in support for React and Vue. See here:
https://github.com/sodatea/vite-jest/blob/6cb71219d13dfced3dbb0a2a6df3e437d80d9849/packages/vite-jest/jest-preset.js#L7
Myself and @FractalHQ are working on an "adder" that enables developers to introduce Jest tests to their SvelteKit project. We've recently encountered a similar issue to that faced by Vue and React developers, relating to Jest/Vite nuances. See here:
We've got a similar discussion going on in our repo, relating to us utilising vite-jest
in our adder:
- https://github.com/rossyman/svelte-add-jest/issues/14
The two key points I'd like to address, are the following:
- What changes would be needed to add svelte support to
vite-jest
(Relating to transformers, etc) - Are there any limitations that prevent us from applying
vite-jest
to svelte, due to the nature of how.svelte
components are created? - Would we need to do these changes in co-ordination with another transformer such as
svelte-jester
to ensure that the.svelte
extension is correctly transformed.
Perhaps this list should match the list that's in Vite itself? https://github.com/vitejs/vite/pull/3128/files#diff-071a32aedd2ea59472ebb69fb456e818b103d1a332da632e12c2d54395938ad1L109
@dominikg has a PR open to make the list more configurable in Vite core https://github.com/vitejs/vite/pull/3828
The import.meta
issue is also mentioned in https://github.com/sodatea/vite-jest/issues/14
https://github.com/sodatea/vite-jest/issues/17 is a bit different, but also related to ESM vs non-ESM code (the error message in that one is Cannot use import statement outside a module
)