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

Re-evaluate usage of Jest as test-runner #502

Open
2 of 4 tasks
Tracked by #83
akphi opened this issue Sep 15, 2021 · 4 comments
Open
2 of 4 tasks
Tracked by #83

Re-evaluate usage of Jest as test-runner #502

akphi opened this issue Sep 15, 2021 · 4 comments
Labels
Studio Core Team Opened by a member of the Studio core team Type: Maintenance DevOps, maintenance, admin works to do with the repository
Milestone

Comments

@akphi
Copy link
Contributor

akphi commented Sep 15, 2021

jest does not fully support ESM - See jestjs/jest#9430. When we upgrade and use ESM support, we can:


This is extracted from the umbrella tracker for dependencies #83
We will close this once we can fully adopt ESM in our usage with Jest and make necessary adjustments in the codebase


UPDATED:

We have adopted ESM exports style, but we haven't fully immerse in ESM mode yet as it seems from Node side there are quite a number of stabilization to be done. And holes to patch, such as problems with uuid, lodash-es as mentioned above, so I will keep this PR open for now.

@akphi akphi mentioned this issue Sep 15, 2021
17 tasks
@akphi akphi added Type: Enhancement Type: Maintenance DevOps, maintenance, admin works to do with the repository Studio Core Team Opened by a member of the Studio core team and removed Type: Discussion Type: Enhancement labels Oct 28, 2021
@akphi akphi added this to the Marathon milestone Nov 16, 2021
@akphi
Copy link
Contributor Author

akphi commented Apr 27, 2022

I also tried to use @jest/global - https://jestjs.io/blog/2020/05/05/jest-26#a-new-way-to-consume-jest---jestglobals - I have tried to make it work with the following patch

0001-use-jest-globals.patch.txt

but there are a few problems:

@akphi
Copy link
Contributor Author

akphi commented Jun 2, 2022

I have updated the codebase to use @jest/globals but still stuck with injectGlobals. Seems like that flag has more implications than just removing the globals, I start seeing errors in testing-library and jsdom as well.

See #1190

@akphi
Copy link
Contributor Author

akphi commented Sep 5, 2022

Workaround regarding issue with uuid has been resolved by #1453

@akphi akphi changed the title Fully adopt ESM migration in Jest usage Re-evaluate Jest Sep 13, 2022
@akphi akphi changed the title Re-evaluate Jest Re-evaluate usage of Jest as test-runner Sep 13, 2022
@akphi
Copy link
Contributor Author

akphi commented Sep 13, 2022

Jest has this weird problem around Promise, sometimes, .mockResolvedValue() does not work as intended
See jestjs/jest#2549
See jestjs/jest#6645
See jestjs/jest#2549

Maybe it's not a bad idea to switch to another test framework, we could consider https://github.com/vitest-dev/vitest
Looks like it has a killer VSCode plugin for running tests https://marketplace.visualstudio.com/items?itemName=ZixuanChen.vitest-explorer
Read more about Vite vs Jest here - https://blog.bitsrc.io/vite-is-better-than-webpack-d5dd59610d56

There seems to be a small problem with its performance
vitest-dev/vitest#579
https://vitest.dev/guide/features.html#threads
https://blog.logrocket.com/testing-vite-minimal-config-using-vitest/


on this note, we could also look at Vite instead of webpack to simplify toolchain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Studio Core Team Opened by a member of the Studio core team Type: Maintenance DevOps, maintenance, admin works to do with the repository
Projects
None yet
Development

No branches or pull requests

1 participant