Replace Jest with Vitest as test runner
While working on #3766 I was struck again by the clunkiness of Jest, and the difficulties of getting it to work with ES modules.
We would probably be better off switching instead to Vitest as our frontend test runner, esp. as our use of Jest isn't very complex.
I'm marking this as a "good first issue", given that this transition ought to be relatively straightforward.
@eemeli Can i take up this issue ? If yes , then assign me
@eemeli and @mathjazz Day 1 : Change a lot of test to vitest , but some test which contain sinon and enzyme usecases failed as Vitest is not suitable with sinon and enzyme, so can i move to RTL + Vitest .
hey @eemeli, @mathjazz , i was working on this issue and found that vitest has compatibility issues with sinon, mainly the places where we directly mock imported module and use sinon to stub it, i guess this might be because the esm modules imports are readonly (transformed by Default by vite), so sinon modification are not applied. i want to confirm that should we remove sinon entirely as their might future compatibility issues in future too, or just patch broken pieces with vitest equivalent.
i will be creating Mr for the changes i have made in 1-2 days, following 3 MR plan you mentioned in #3769 And, can you please assign this task to me?
Feel free to replace our Sinon usage with Vitest equivalents as necessary. As far as possible, changes here should be small steps, so it might turn out to be valid to e.g. only replace some Sinon mocking initially, and follow that up with a separate cleanup PR.
Ohk, thank you
Hey @eemeli, i was porting the sinon stub which were failing and saw that some of them fails because they aren't in a body of a function component. we either Wrap the hook in a small test component, Mount that component with Enzyme and Assert on what it renders or passes out Or add React testing Library which would in theory make this less tedious. Would love to here your thoughts
Moving tests from Enzyme to testing-library would be the preferred way forward.