Skip to content

test: change test runner to vitest #525

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

Merged
merged 3 commits into from
Jun 19, 2025

Conversation

michaelfaith
Copy link
Contributor

This change moves the test runner from mocha + nyc to vitest.

In order to import vitest the tests had to be in esm, so I checked out everything under the tests folder from #516 (leaving the source as it was).

I also moved the eslint-rule-tester out of the tests/lib folder and into its own utils folder. That way vitest didn't treat it as a test.

Note: rather than using vitest's preferred v8 coverage reporter, I used the istanbul one, to ensure the coverages between old and new were the same. I did notice that when I tried the v8 coverage reporter, the coverage numbers were much less. Something to consider as a follow-up change. The v8 reporter should be more accurate, so the coverage may not be as high as it seems. I'd recommend moving up to the v8 reporter after the esm branch lands.

This change moves the test runner from `mocha` + `nyc` to `vitest`.

In order to import `vitest` the tests had to be in esm, so I checked out everything under the `tests` folder from eslint-community#516 (leaving the source as it was).

I also moved the `eslint-rule-tester` out of the `tests/lib` folder and into its own `utils` folder.  That way vitest didn't treat it as a test.

Note: rather than using `vitest`'s preferred `v8` coverage reporter, I used the `istanbul` one, to ensure the coverages between old and new were the same.  I did notice that when I tried the `v8` coverage reporter, the coverage numbers were much less.  Something to consider as a follow-up change.  The v8 reporter *should* be more accurate, so the coverage may not be as high as it seems.  I'd recommend moving up to the `v8` reporter after the esm branch lands.
@michaelfaith michaelfaith marked this pull request as ready for review June 19, 2025 22:26
Copy link
Member

@bmish bmish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thanks!

@bmish bmish merged commit c316040 into eslint-community:main Jun 19, 2025
9 checks passed
@michaelfaith michaelfaith deleted the build/vitest branch June 20, 2025 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants