-
Notifications
You must be signed in to change notification settings - Fork 90
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
Switch test runner from Jest to Vitest #1694
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1694 +/- ##
==========================================
+ Coverage 97.11% 97.55% +0.44%
==========================================
Files 21 20 -1
Lines 831 1513 +682
Branches 84 319 +235
==========================================
+ Hits 807 1476 +669
- Misses 23 37 +14
+ Partials 1 0 -1 ☔ View full report in Codecov by Sentry. |
Coverage is being calculated differently it seems. Vitest uses v8 coverage by default as opposed to Jest which uses Babel with Istanbul. Since the v8 one is part of the engine that parses JS code, it might make some shortcuts, optimize some code away, thus less perceived hits with no real impact otherwise, or so I assume. Here are some more details: jestjs/jest#11188 |
Related #1626 |
@@ -12,8 +13,6 @@ const index = { | |||
uid: 'movies_test', | |||
}; | |||
|
|||
jest.setTimeout(100 * 1000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPLAINER: This is replaced by a global setting in vitest.config.js
testTimeout: 100_000, // 100 seconds
.
tests/client.test.ts
Outdated
@@ -1,3 +1,4 @@ | |||
import { afterAll, expect, test, describe, beforeEach } from 'vitest'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EXPLAINER: Vitest default and recommended way is to have explicit imports for these methods.
The biggest drop in coverage is because |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Thanks for doing this, very appreciated!
bors merge
bors cancel |
bors merge |
dfc8688
to
ebe4cb9
Compare
8c6d851
to
ad9ced0
Compare
ad9ced0
to
97bf454
Compare
@flevi29 can you fix git conflicts? |
4a3a69c
to
47096c4
Compare
@curquiza fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors merge
.github/workflows/tests.yml
Outdated
@@ -45,6 +45,7 @@ jobs: | |||
cache: 'yarn' | |||
- name: Install dependencies | |||
run: yarn --dev | |||
# @TODO: Need to clean up test scripts, they're confusing, and base test is expected to run coverage |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove this and open an issue instead?
@flevi29 sorry, git conflicts again 🙈 |
47096c4
to
0500f2c
Compare
@curquiza fixed again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
bors merge
Pull Request
Why?
I am also getting rid of
jsdom
tests, we were already skipping Node.js tests when usingjsdom
and everything else is based on web standards so there isn't really much of a benefit tojsdom
. This halves the time tests are running for. I am also planning to parallelize some tests by using multiple indexes on Meilisearch to further speed up tests.PR checklist
Please check if your PR fulfills the following requirements:
Thank you so much for contributing to Meilisearch!