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

Switch from Jest to Node.js's Native Test Runner #6123

Open
ovflowd opened this issue Nov 16, 2023 · 15 comments
Open

Switch from Jest to Node.js's Native Test Runner #6123

ovflowd opened this issue Nov 16, 2023 · 15 comments
Labels
feature-request Requesting a new Technological Feature to be added to the Website infrastructure Issues/PRs related to the Repository Infra

Comments

@ovflowd
Copy link
Member

ovflowd commented Nov 16, 2023

This issue about moving away from Jest to Node.js's Native Test Runner

Why

It would be great if we adopted Node.js's Test Runner (and moved away from Jest) because:

  • Way less dependencies
  • It's way faster and native to Node.js
  • It's natively ESM compatible which Jest isn't
  • We don't need snapshots nor any fancy Jest functionality

Migration

@ovflowd ovflowd added feature-request Requesting a new Technological Feature to be added to the Website infrastructure Issues/PRs related to the Repository Infra labels Nov 16, 2023
@ovflowd
Copy link
Member Author

ovflowd commented Nov 16, 2023

This issue is open to grabs by anyone interested :)

@AugustinMauroy
Copy link
Contributor

Hey ! I'm trying to work on this but I got a problem. It's because node doesn't found ts file. So should we build ts before test ?

@ovflowd
Copy link
Member Author

ovflowd commented Nov 17, 2023

Hey ! I'm trying to work on this but I got a problem. It's because node doesn't found ts file. So should we build ts before test ?

No. You want to use node --loader=ts-node/esm

Node.js supports custom loaders. (You need to add ts-node as a dev dependency btw)

@ovflowd
Copy link
Member Author

ovflowd commented Nov 17, 2023

Or if you also need react compatibility. You might want to use the tsx loader (also a package)

@AugustinMauroy
Copy link
Contributor

hummm interessing

@MrHBS
Copy link

MrHBS commented Nov 18, 2023

Have you considered ditching JSDOM + RTL in favor of Cypress/Playwright Component Testing?

@ovflowd
Copy link
Member Author

ovflowd commented Nov 18, 2023

Have you considered ditching JSDOM + RTL in favor of Cypress/Playwright Component Testing?

We already have Visual Regression Testing. The only tests we have for Components at the moment are for specific states.

And no, we dont want yet another tool and library and platform. Thank you.

@ovflowd
Copy link
Member Author

ovflowd commented Nov 18, 2023

To clarify, our testing of components here is really bare bones, just to certify that for example, a select actually renders said items.

Adding browser testing (even if headless) is overkill for our needs.

So pretty much Node.js itself provides everything we need here with its native test runner; + we only want to unit test utilities, helpers, hooks and certain components that are stateful.

Everything else is already covered by Chromatic + Storybook

@araujogui
Copy link
Member

araujogui commented Dec 1, 2023

@AugustinMauroy are you still working on this?

@AugustinMauroy
Copy link
Contributor

@araujogui I'm stuck in my pr with the dom. If you want you can commit on my pr it is in "allow edit by maintainer" so in theory you could commit. It's up to you to finish it 😁

@etroynov
Copy link

@AugustinMauroy can you share the link on PR?

@bmuenzenmeyer
Copy link
Collaborator

its linked above #6129

@AugustinMauroy
Copy link
Contributor

NEWS:

  • I've created a new, cleaner branch.
  • Nodejs Loaders to loading css-module; ts; jsx

@akdsco
Copy link

akdsco commented Apr 4, 2024

I would like to contribute (first time to this repo, Hello 👋🏻), but I can't see the PR @AugustinMauroy. Can you share the link so maybe I can run it locally and potentially review it to start familiarising myself with the code?

@AugustinMauroy
Copy link
Contributor

I didn't make any pr for moment. But you can try on this branch
any feedback is welcome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Requesting a new Technological Feature to be added to the Website infrastructure Issues/PRs related to the Repository Infra
Projects
Status: 🔖 Ready
Development

No branches or pull requests

7 participants