sodatea / vite-jest

First-class Vite integration for Jest
MIT License
401 stars 51 forks source link

Support for SvelteKit projects #15

Open rossyman opened 2 years ago

rossyman commented 2 years ago

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:

The two key points I'd like to address, are the following:

benmccann commented 2 years ago

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

benmccann commented 2 years ago

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)