Open
Description
Hi there,
I was wondering if a testing scenario with SvelteKit with TypeScript is supported. I've tried it, I have such a project and I've followed your readme by installing svelte-mock
and updated my jest.config.cjs
, but this error appears when I then run Jest:
Test suite failed to run
Jest encountered an unexpected token
Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.
...
Details:
C:\myproj\src\__tests__\MyTest.test.ts:4
import '@testing-library/jest-dom';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
SvelteKit came with this Jest configuration out-of-the-box:
transform: {
"^.+\\.svelte$": [
"svelte-jester",
{ preprocess: "./svelte.config.test.cjs" },
],
"^.+\\.ts$": "ts-jest",
"^.+\\.js$": "ts-jest",
},
I've tried mixing, matching and merging these configurations for a bit, but I'm making no progress whatsoever. So I thought I'd just ask, is a SvelteKit and TypeScript scenario supported?
Metadata
Assignees
Labels
No labels