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

Explore using ts-jest presets to power our own Jest preset #290

Open
IlCallo opened this issue Oct 31, 2022 · 3 comments
Open

Explore using ts-jest presets to power our own Jest preset #290

IlCallo opened this issue Oct 31, 2022 · 3 comments
Labels
enhancement New feature or request
Projects

Comments

@IlCallo
Copy link
Member

IlCallo commented Oct 31, 2022

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' or ts-jest/presets/js-with-babel?
  • when using ts-jest/presets/js-with-babel, would it help us get rid of babel-jest dependency?

Resources:

@IlCallo IlCallo added the enhancement New feature or request label Oct 31, 2022
@IlCallo IlCallo added this to Needs triage in Jest via automation Oct 31, 2022
@IlCallo IlCallo moved this from Needs triage to Low priority in Jest Oct 31, 2022
@Blfrg
Copy link
Contributor

Blfrg commented Nov 11, 2022

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.

@IlCallo
Copy link
Member Author

IlCallo commented Nov 14, 2022

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

@Blfrg
Copy link
Contributor

Blfrg commented Nov 20, 2022

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Jest
Low priority
Development

No branches or pull requests

2 participants