quasar-testing
quasar-testing copied to clipboard
Explore using `ts-jest` presets to power our own Jest preset
Not sure if it can bring any advantage, but we could explore using ts-jest presets to simplify our
Some random notes:
- which presets would be better for us?
'ts-jest'orts-jest/presets/js-with-babel? - when using
ts-jest/presets/js-with-babel, would it help us get rid ofbabel-jestdependency?
Resources:
- https://kulshekhar.github.io/ts-jest/docs/getting-started/presets
- https://kulshekhar.github.io/ts-jest/docs/guides/using-with-monorepo
I recently started using SWC on a small [non-ui] project, and I swapped out ts-jest for @swc/jest. My [very minimal] tests were 5x faster with barely any effort!
I haven't had time to test a more complex project, but I would expect to see significant improvements.
IIRC SWC problem is its download size, but right now I see that it's much smaller than ts-jest
Do we need to add anything else except @swc/jest? Do you know which are the downsides of its usage when compared with ts-jest + esbuild which should be much faster than ts-jest alone?
I found this article which compare esbuild to SWC and results are similar
Only the two steps in the docs are needed.
The only other dependency is @swc/core, which is understandable, and I would consider it internal to the project.
I believe the performance compared to esbuild is just about equal,
but maybe specific projects would prove one negligibly beneficial over the other.
Regarding downsides, just the chaining of the two projects, ts-jest and esbuild,
maybe there will be compatibility or performance conflicts one day, and maybe not at all.
I went with SWC because it was self-contained, and I needed ES5 support for a back-end project (non-Vue, non-UI);
that was my only drawback with esbuild.
I would have preferred esbuild otherwise; since the whole Vue community is rallying around Vite and Vitest, the dependency would have matched.
Maybe in that sense, esbuild would be a better match (or Vitest?), with similar dependencies across the Quasar ecosystem.