Skip to content
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

Feature/fix async transformer syntax #60

Conversation

sebastianrothe
Copy link
Collaborator

@sebastianrothe sebastianrothe commented Aug 4, 2021

I've tried with my current project and that is the way it works for me.

Should fix #59

Jest's support for ESM is still experimental and some stuff still doesn't work. (see jestjs/jest#9430 and https://jestjs.io/docs/ecmascript-modules)

@benmccann
Copy link
Collaborator

I have no idea what changed here with all the formatting changes, so lgtm me I guess?

@mihar-22
Copy link
Collaborator

mihar-22 commented Aug 5, 2021

I guess the changes can be seen in the second commit in this PR fix processAsync transformer export. LGTM!

@mihar-22 mihar-22 merged commit 3748f49 into svelteness:master Aug 5, 2021
@bhvngt
Copy link

bhvngt commented Aug 5, 2021

after applying this fix, I am getting following error

 Jest: synchronous transformer /node_modules/.pnpm/svelte-jester@2.0.1/node_modules/svelte-jester/src/transformer.js must export a "process" function.

Here's sandbox where you can see it happening.

Comment on lines -58 to +53
export default createTransformer;
export default {
processAsync
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs to probably change to export default processAsync @sebastianrothe? I haven't read the new transformer docs so I'll touch back on this when I have time unless it's solved earlier.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The thing is, there is no documentation about asyncTransformers :( https://jestjs.io/docs/code-transformation#writing-custom-transformers

@sebastianrothe
Copy link
Collaborator Author

I have no idea what changed here with all the formatting changes, so lgtm me I guess?

Yeah, I don't know why the old code was not formatted?

@sebastianrothe
Copy link
Collaborator Author

sebastianrothe commented Aug 5, 2021

after applying this fix, I am getting following error

 Jest: synchronous transformer /node_modules/.pnpm/svelte-jester@2.0.1/node_modules/svelte-jester/src/transformer.js must export a "process" function.

Here's sandbox where you can see it happening.

For the new code to work, you need to enabled ESM support in Jest. Which means ALL steps described here https://jestjs.io/docs/ecmascript-modules

Maybe we need to split the releases. See #61

@bhvngt
Copy link

bhvngt commented Aug 5, 2021

Yep... After juggling through myriad of configuration I could finally make it work. This was a fun little exercise. Here's the sandbox that can be used as a reference for anyone stuck with planning to port svelte, jest and typescript to ESM.

@sebastianrothe
Copy link
Collaborator Author

sebastianrothe commented Aug 5, 2021

Yep... After juggling through myriad of configuration I could finally make it work. This was a fun little exercise. Here's the sandbox that can be used as a reference for anyone stuck with planning to port svelte, jest and typescript to ESM.

I feel you. And this is supposed to be the future... :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Regression between 1.8.2 and 2.0.0
4 participants