-
Notifications
You must be signed in to change notification settings - Fork 7
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
test(dev-dock/backend): move from jest
to vitest
#5739
Conversation
358fcd0
to
ea2ec34
Compare
...(await importActual<typeof import('@votingworks/utils')>()), | ||
isFeatureFlagEnabled: (flag) => featureFlagMock.isEnabled(flag), | ||
}) | ||
); |
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.
What's this new pattern of passing in importActual
rather than just using vi.importActual
? Also what are all the type annotations for?
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.
This is what @kofi-q's script generated, which seemed a little nicer than having to repeat the string. The type annotation on the importActual
call tells it to treat the return type as the import of that module, and the type annotation at the return position of the call to vi.mock
's callback tells it to expect an object of that type. This should ensure we don't miss anything or typo an export name.
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.
Nice, thanks for explaining!
This way we can replace the `jest` with `vi` at individual callsites as we get to them.
0d00519
to
72265b0
Compare
ea2ec34
to
3de6d01
Compare
* refactor(jest): inline calls to `advanceTimers` This way we can replace the `jest` with `vi` at individual callsites as we get to them. * test(dev-dock/backend): move from `jest` to `vitest` * test(dev-dock/backend): remove outdated jest config
Closes #5735
advanceTimers
#5738