chore: migrate tests from Jest to Vitest #436
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Switches from the old Jest config, which extended
kcd-scripts/jest, to Vitest.This was a little more involved than I'd first thought (hence this PR coming a week later than I expected). At first I tried a manual switch-over but got into a confusing state where imports weren't being properly mocked out with
vi.mock. I then restarted with Copilot and used Research-Plan-Implement. Copilot nailed it in one go, with just a little docs & scripts cleanup needed on my end (I manually reviewed every file).The only major behavioral difference in tests is that
nockis now used insrc/repo/__tests__/index.jsinstead of internal mocking of modules. The new tests keep the functions as asynchronous, whereas the old ones switched them to synchronous for testing (weird!). I actually like this as more of an end-to-end / comprehensive test, rather than specifically looking at implementation details of what that file imports.I think we can ignore the failing coverage indirect changes check. If you look at the indirect changes in Codecov they're mostly on comment lines.