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

[Test] Move from Karma to Jest #7329

Open
LeoDog896 opened this issue Dec 28, 2023 · 2 comments
Open

[Test] Move from Karma to Jest #7329

LeoDog896 opened this issue Dec 28, 2023 · 2 comments
Labels
type:maintenance tests, chores, or project maintenance

Comments

@LeoDog896
Copy link
Contributor

LeoDog896 commented Dec 28, 2023

Summary

Karma is deprecated and heavily recommends either Vitest or Jest. However, as mentioned before, Vitest isn't quite popular compared to Jest, and Jest does have better ESM support (which can help with implementing #6591 later on).

Plus, if Vitest (somehow) becomes the preferred testing framework, Vitest is primarily compatible with Jest anyway.

@LeoDog896 LeoDog896 added the type:maintenance tests, chores, or project maintenance label Dec 28, 2023
@unlikelyzero
Copy link
Collaborator

@LeoDog896 I didn't realize that Karma had been formally deprecated. Looks like the EOL will be some time in 2024.

  • I would have said that https://github.com/skovhus/jest-codemods would make the most sense as a migration guide, but in the era of chatgpt, I'm not sure if that's the case.
  • We've talked internally about moving to e2e or component tests for our plugins and keep unit tests explicitly for our APIs. This seems like the best time to make that distinction and we could remove a significant number of tests.
  • We already combine our unit test and e2e test coverage with codecov https://app.codecov.io/gh/nasa/openmct/flags and likely could identify the plugin coverage that could be removed in the migration.
  • Code coverage would need to be part of the final implementation but not the first.
  • I don't mind running jest tests in parallel with karma during the migration.

@LeoDog896
Copy link
Contributor Author

LeoDog896 commented Dec 31, 2023

I would have said that https://github.com/skovhus/jest-codemods would make the most sense as a migration guide, but in the era of chatgpt, I'm not sure if that's the case.

Yep! Used jest-codemods as my first attempt in migrating it (it did well, and I was left with I think only 50 ish manual transformations). However, Jest doesn't like webpack's css/html imports (this is fixable), and Jest especially doesn't like usage of import in a non type: module package. That's the secondary reason as to why I made #7330 and #7331

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:maintenance tests, chores, or project maintenance
Projects
None yet
Development

No branches or pull requests

2 participants