π Feature: Migration should call out needing to migrate non-Vitest tests to Vitest
Bug Report Checklist
- [X] I have pulled the latest
mainbranch of the repository. - [X] I have searched for related issues and found none that matched my issue.
Overview
Splitting out of #1355: migration markets itself to be a one-stop-shop solution for aligning an existing repo to this template. But when run on an existing repository with tests written in a non-Vitest testing library (e.g. Jest), the actual test files aren't migrated over to Vitest. This leads to broken expectations with users.
The migration script should let the user know they need to migrate their tests manually.
Proposal: if Mocha or Jest was previously in the repository, add another π‘ note similar to the existing ones?
β π‘ Running `pnpm lint --fix` failed. You should run it and fix its complaints.
β π‘ Running `pnpm format --write` failed. You should run it and fix its complaints.
Note that there's no automatic migrator command/project that can be referenced. Building one would be quite complex, and likely impossible to get fully right. Vitest's Migrating from Jest docsΒ is probably the best place we can send Vitest users.
Maybe good phrasing would look something like the following?
- Jest:
π‘ You'll need to manually migrate your Jest tests to Vitest. See https://vitest.dev/guide/migration.html#migrating-from-jest for more information. - Mocha:
π‘ You'll need to manually migrate your Mocha tests to Vitest.
...where if detection for other test frameworks is added, it'd use the same template as Mocha?
Additional Info
It's tempting to suggest running pnpm test to know whether to generate the π‘... but unit tests might take a very long time and/or have unintended side effects. That's not something we should do for the user.
Co-authored-by: @danvk
It's probably really out-of-date now, but I've used vitest-codemod in the past with mixed success.