-
Notifications
You must be signed in to change notification settings - Fork 18
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
jest 27 + svelte-jester 2 #63
Comments
in CI I get different errors, which is odd, here's a public repo with github actions: https://github.com/CloudNativeEntrepreneur/sveltekit-eventsourced-funnel/pull/10/checks?check_run_id=3256813646 |
This is an issue with node v16.6.0 jestjs/jest#11708 Please upgrade your node version. |
The error is related to Jest thinking you don't use ESM. Have a look over here #59 (comment) |
I looked at that comment, which links to a PR. Tbh, I'm not really sure what I'm supposed to change still. |
@benmccann I'm getting the following error with 2.1.0
Is there any extra configuration required? {
"testEnvironment": "jsdom",
"transform": {
"^.+\\.svelte$": [
"svelte-jester",
{
"preprocess": true
}
],
"^.+\\.ts$": "ts-jest"
},
"moduleNameMapper": {
"^\\$lib(.*)$": "<rootDir>/src/lib$1",
"^\\$app(.*)$": [
"<rootDir>/.svelte-kit/dev/runtime/app$1",
"<rootDir>/.svelte-kit/build/runtime/app$1"
]
},
"moduleFileExtensions": [
"js",
"ts",
"svelte"
],
"setupFilesAfterEnv": [
"./src/setupTests.ts"
],
"globals": {
"ts-jest": {
"tsconfig": "tsconfig.spec.json"
}
}
} |
2.1.1 is out now which fixes an issue with the file paths in |
The error still occurs here with 2.1.1 https://github.com/CloudNativeEntrepreneur/sveltekit-eventsourced-funnel/pull/10/checks?check_run_id=3473288531 That repo is public and that PR is a reproduction. |
Here's another branch configured differently - experimental-vm-modules, removed esbuild-jest (which makes CloudNativeEntrepreneur/sveltekit-eventsourced-funnel#26 This way fails because of the Maybe the logic they have in there could be put into svelte-jester? |
Took it a bit further here: CloudNativeEntrepreneur/sveltekit-eventsourced-funnel#30 by using a babel plugin to handle the import.meta.env stuff, but now getting |
This should be resolved with #69 |
this is working, imo - the only thing that is not working well with jest is mocking ESM, but that's a jest issue, not this lib. Example set up here: https://github.com/CloudNativeEntrepreneur/sveltekit-eventsourced-funnel |
@patrickleet not sure if you saw, but basic experimental mocking support has been checked in for ESM now and will be released hopefully tomorrow, so perhaps that issue is solved now as well. jestjs/jest@90d6908 |
I did not - nice! I got creative without it for now haha. That will for sure come in handy for some more useful tests though. |
@benmccann not sure if you saw, but the babel config I ended up with is pretty minimal - it ONLY handle import.meta.env stuff - could be useful for svelte-add jest config |
just tried upgrading jest + svelte-jest with the new release
getting various errors with different configurations.
See linked github actions builds for specifics
The text was updated successfully, but these errors were encountered: