Skip to content

Change from jest to vitest on packages/cli #368

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

Closed
wesleymatosdev opened this issue Aug 18, 2023 · 13 comments
Closed

Change from jest to vitest on packages/cli #368

wesleymatosdev opened this issue Aug 18, 2023 · 13 comments
Labels
area/tests documentation Improvements or additions to documentation

Comments

@wesleymatosdev
Copy link
Contributor

We recently set it up jest on packages/cli, and I think that we should do the same for other sub-packages to have an easier way to create tests to new code.

I see that this would benefit the project, but I want your input on how to prioritize each packages we need to set it up first.

@maige-app maige-app bot added documentation Improvements or additions to documentation area/tests labels Aug 18, 2023
@wesleymatosdev
Copy link
Contributor Author

Another thing that we discussed on Discord, is to have mutation tests on the project, but make jest available all over the project probably have a higher priority than mutation tests.

Let me know what you folks think, and we can start to work on it

@ericallam
Copy link
Member

@ologbonowiwi I think this is a great idea, although I think we should use vitest instead of jest, mainly because of this:

https://twitter.com/kettanaito/status/1692615582430978411

@wesleymatosdev
Copy link
Contributor Author

What if we use the Node native test runner?

@wesleymatosdev
Copy link
Contributor Author

Before run any package, I see I'll need to change /cli first, because this one is using jest

@ericallam
Copy link
Member

ericallam commented Aug 23, 2023

For the node native test runner, we just need to make sure that the Node version required would be supported in CI (which I'd imagine it would be, but let's check that before we move ahead). We use GitHub actions 👍

The other thing to check would be TypeScript support. If both those are good, then yea let's definitely use the Node test runner.

We should probably also include the Node requirement in the CONTRIBUTING doc

@wesleymatosdev
Copy link
Contributor Author

According to this comment, it's working well using the tsx loader.

We can use another loader or even build to JavaScript and then run the tests over the .js files if needed.

I'll do a POC moving the current tests to the node test runner and open a PR soon.

@wesleymatosdev
Copy link
Contributor Author

Hey @ericallam, I was on PTO, but I'm back now.

I've been thinking about the Node native test runner, and although it would be nice to know more about the new native test runner, I see that maybe this wouldn't be a good mid-term solution for us.

I'll go with Vitest as you recommended; when creating tests, we can use native assertions or think of a plan to make it easier to migrate to the native in the future.

Would you happen to have any thoughts on this?

@ericallam
Copy link
Member

Vitest sounds good to me 👍

@wesleymatosdev
Copy link
Contributor Author

@ericallam I created the PR moving from jest to Vitest. Can you review it?

@matt-aitken
Copy link
Member

@ologbonowiwi nice one!

@wesleymatosdev
Copy link
Contributor Author

wesleymatosdev commented Sep 15, 2023

Well, in this case I'll change the title to match what was done

@wesleymatosdev wesleymatosdev changed the title Make possible to write automated tests all over the mono-repo Change from jest to vitest on packages/cli Sep 15, 2023
@wesleymatosdev
Copy link
Contributor Author

@matt-aitken @ericallam, which other packages do we need to prioritize to have tests?

Everything under /packages?

@ericallam
Copy link
Member

Probably just these two for now:

  • packages/core currently has tests, but uses jest. Would be great to get that switched to vitest
  • packages/trigger-sdk 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/tests documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants