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

Move from Jest to a more suitable alternative #813

Closed
arboleya opened this issue Mar 5, 2023 · 11 comments · Fixed by #1310
Closed

Move from Jest to a more suitable alternative #813

arboleya opened this issue Mar 5, 2023 · 11 comments · Fixed by #1310
Assignees
Labels

Comments

@arboleya
Copy link
Member

arboleya commented Mar 5, 2023

Although Jest does the job and has done it so far (although slower than I'd like) we should consider seeking a better alternative, possibly more modern and performant. Speed is paramount in tests, and Jest seems to fall short.

Vitest seems a strong candidate:

@Dhaiwat10
Copy link
Member

@arboleya I agree. I will add something:

I feel like we should re-evaluate #728 since it has been blocked/stuck for a long time, and maybe just rename the issue to 'Switch to a new testing setup' and include switching to a new test runner in that issue. All of this feels like a part of one big problem that we are trying to solve.

We can first switch to a new test runner, and then look into how we can run those tests in a browser. Putting in more work into figuring out how to run the tests in a browser with Jest, only to switch to a different test runner soon doesn't sound ideal.

@camsjams
Copy link
Contributor

camsjams commented Mar 13, 2023

We need to first make sure vitest is compatible with Browser based testing and execution, IE Jasmine or Karma, or purely within the vistest ecosystem. see @vitest/browser (https://www.npmjs.com/package/@vitest/browser):

⚠️ This package is not yet ready and it's for preview only. While this package will be released along with other packages, it will not follow semver for breaking changes until we mark it as ready. Do not use it in production.

According to this GH issue it is NOT compatible, so that would be a hard blocker:
vitest-dev/vitest#586

But then later on I see this merge as it seems someone kept pushing, but not marked ready for production:
vitest-dev/vitest#1302

@camsjams
Copy link
Contributor

camsjams commented Mar 13, 2023

Also I am not sure where we got the idea that vitest is faster, Jest is proven to be faster on multiple projects, so I'd like to see the benchmarks here.

See https://bradgarropy.com/blog/jest-over-vitest

I'd suggest we stay on Jest and just finish this PR #728 as is, and move on to the next thing

@Dhaiwat10
Copy link
Member

@camsjams I went through that thread that you linked, someone suggested having a look at karma-vite

@Dhaiwat10
Copy link
Member

This comment also seems interesting, seems like this person is trying to achieve more or less what we want to: vitest-dev/vitest#586 (comment)

@arboleya
Copy link
Member Author

@camsjams @Dhaiwat10 Yes, I agree that testing is delicate and that we should move on with #728 for now, which I'm working to unblock. That doesn't mean we can't talk about options here — btw, great set of links, guys. Thanks.

@danielbate
Copy link
Contributor

Currently looking at implementing Vitest in #1310 and it is very quick compared to jest.

Duration 16.38s (transform 4.31s, setup 2.02s, collect 96.78s, tests 31.68s, environment 25ms, prepare 15.15s)

Still facing various issues with the browser implementation however that shouldn't stop us from using it for node environment tests if we wanted to.

@danielbate
Copy link
Contributor

Given the performance updates and minimal interruption to our current workflows and tooling, we will implement Vitest completely for our node environment tests, and also add support for a browser test however this will not yet run in CI.

@arboleya
Copy link
Member Author

@danielbate Am I tripping, or we're about to become 7.5x times faster (>10mins in CI) by moving to Vitest? ⚡🔥🤘

@camsjams I believe the above settles the matter. 😆

@camsjams
Copy link
Contributor

camsjams commented Oct 20, 2023

@camsjams I believe the above settles the

@arboleya Benchmarks never lie *

But in this case, I agree. For the TS-SDK, the performance improvements are indeed valuable and clear gains 🎉

@Torres-ssf Torres-ssf added chore and removed refactor labels Dec 8, 2023
@danielbate danielbate added this to the Salamander milestone Dec 13, 2023
@arboleya arboleya modified the milestones: 1 - Salamander, 2 - Beetle Dec 14, 2023
@arboleya
Copy link
Member Author

Completed via #1310

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

Successfully merging a pull request may close this issue.

5 participants