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

🚀 Feature: Migration should call out needing to migrate non-Vitest tests to Vitest #1375

Open
2 tasks done
JoshuaKGoldberg opened this issue Mar 7, 2024 · 0 comments
Open
2 tasks done
Labels
status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request

Comments

@JoshuaKGoldberg
Copy link
Owner

JoshuaKGoldberg commented Mar 7, 2024

Bug Report Checklist

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

@JoshuaKGoldberg JoshuaKGoldberg added type: feature New enhancement or request status: accepting prs Please, send a pull request to resolve this! labels Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepting prs Please, send a pull request to resolve this! type: feature New enhancement or request
Projects
None yet
Development

No branches or pull requests

1 participant