-
Notifications
You must be signed in to change notification settings - Fork 455
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
Support for esbuild or swc #2135
Comments
Definitely those 2 have lots of possibilities to solve the performance problem. They are currently the new trend as well. We have thought about that. Probably something like an experimental mode to turn on/off which allows using those 2. |
Any updates 6 months later? Our product team recently switched to I would love to see the same improvement for |
You might want to give esbuild-jest a try: https://github.com/aelbore/esbuild-jest (caveat: it depends on babel-jest) |
@simon04 Will definitely do so! I'd love to contribute as well. 👍 |
I recently stumbled upon https://github.com/alangpierce/sucrase. Perhaps easier to integrate with since it's written in TypeScript? |
BUT THERE IS Still one critical problem, I seem to lose type checking when I add module.exports = {
preset: "ts-jest",
verbose: true,
setupFilesAfterEnv: ["@testing-library/jest-dom/extend-expect"],
// transform: { "\\.[jt]sx?$": "esbuild-jest" },
// transform: { "^.+\\.(t|j)sx?$": "@swc/jest" },
moduleNameMapper: {
"\\.(css|less|scss|sss|styl)$": "<rootDir>/node_modules/identity-obj-proxy",
},
}; |
Okay if I change the regex to only look for js and jsx then it catches type errors. But I'm not sure if there is any performance benefit if any. |
You could check, if you run your tests before and after the change with |
Unfortunately I don't have enough test that I could use to verify with. I think at this point I rather let tsc typecheck only test files and then let esbuild/swc run the transpiling |
That is correct. Esbuild will just throw away your types. |
I think the best solution would be to use tsc to type-check only test files and then lets esbuild/swc transpile and run test. Seems like there is no way to let the ts-jest type-check when a transform is specified |
My dream setup would be this:
When I run the tests, I usually have no type errors, because I see them and fix them in my editor. Then I don’t want to wait for |
I don't know what happened between 27.0.7 and 27.1.0, but now the build on our jenkins server is failing: We check in the yarn dependencies and adding this esbuild is now causing issues. |
See #3129 |
exactly that |
Thanks, #3129 solved the peerDependency problem. Just a note about the types: Line 4 in 0e8f829
That will make typescript fail if No real solution as esbuild does not exports its types. |
@lydell This approach might give you what you're looking for (see 4. What about types?): https://tsh.io/blog/how-to-speed-up-your-typescript-project/ |
Any plans when |
We plan start adopting it for v28 |
@ahnpnl v28 was just released. Is esbuild now supported? The changelog doesn't seem to mention it. |
Not there yet, it will be opted in as experimental feature. |
Esbuild drop all the comments so you cannot make the use of |
@ahnpnl Do you know if esbuild experimental support is available yet? I see a few instances of it in the codebase (https://github.com/kulshekhar/ts-jest/search?q=esbuild) but not sure if it's able to be used yet or still in progress. |
Any updates on this? Is it time to start looking at migrating to Vitest? |
🚀 Feature Proposal
Hi, I started with
ts-jest
on my project, but found startup performance to be unacceptable. I think this is because ts-jest compiles my entire project in order to run tests. There are compilers with significantly better performance, namely esbuild and swc.swc-node/jest is decent but doesn't cache dependency tree, which means large repos have TONS of duplication compilation.
So maybe an opportunity here? I'm not saying it will be easy!
The text was updated successfully, but these errors were encountered: