-
Notifications
You must be signed in to change notification settings - Fork 144
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
change(integrations/jest-plugin): Support passing transform options t… #749
change(integrations/jest-plugin): Support passing transform options t… #749
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Apologies for not having configuration in place already. One small request on changing it to make transforms
configurable.
Were you able to test this (using yarn link
or similar)?
Codecov Report
@@ Coverage Diff @@
## main #749 +/- ##
=======================================
Coverage 87.51% 87.51%
=======================================
Files 55 55
Lines 5887 5887
Branches 1394 1394
=======================================
Hits 5152 5152
Misses 466 466
Partials 269 269 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Benchmark resultsBefore this PR: 311.5 thousand lines per second Measured change: 1.72% faster (0.45% faster to 3.21% faster) |
I added a peer dependency on jest 27, since |
Yep, lint succeed and this change also works in our jest setup at Lenus |
Thanks! That does make this change semver-major, but that should be fine. I'll also add a Sucrase peer dependency, should have had those in place from the start, really. |
Thanks for accepting this PR, and reviewing it quickly! With this PR + some changes to our graphql typegen to work around #748 our tests are now green when running with sucrase 🎉 (previously we were running ts-jest) That means I can now run the tests locally without running out of memory, and they are about 25-50% faster as well 🕺 |
Glad to hear it's helpful! I'm still planning to release this to npm pretty soon, but since it's semver-major I want to fit a few other small things in (setting Also, if you're digging into making Jest tests faster, you might want to try out https://github.com/nicolo-ribaudo/jest-light-runner . Sucrase still uses Mocha for the test suite because every time I've tried to switch to Jest I've run into slowdowns (~250ms -> ~5s for all the tests), I think mainly because of the VM isolation overhead. |
Just released a new version of the plugin as 3.0.0 |
🎉 |
I did test Now that we are using sucrase, we can upgrade to the latest version of jest, and might test out As I see it, we would have to use |
I think you're right: Jest normally has a custom implementation of module loading, and The ESM improvements in |
…o the plugin
Make the @sucrase/jest-plugin more configurable, by allowing to specify additional options that are passed to
sucrase.transform
. In our case, we needed to set thejsxRuntime
to automatic.I added
@jest/transform
as a dependency to get the correct type fortransformOptions
. It is quite a large package, so let me know if you would rather just hand-type it.