-
Notifications
You must be signed in to change notification settings - Fork 1
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
Use vite and vitest #150
Use vite and vitest #150
Conversation
Pull Request Test Coverage Report for Build 7561408940
💛 - Coveralls |
I assume that the coverage in vitest is calculated slightly differently from how it's done in jest. I'll look into this drop in coverage, see how to fix it. Edit: Fixed. I just forgot to copy over the files excluded from the coverage and re-write one ignore statement. |
@@ -230,7 +231,7 @@ describe('DemoForm', () => { | |||
it('renders a form that can not be submitted while values are missing', () => { | |||
const submitButton = screen.getByText('Submit Form'); | |||
|
|||
fireEvent.click(submitButton); | |||
fireEvent.submit(submitButton); |
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.
Now this is a weird issue.
Apparently fireEvent.click does not fire the onSubmit
function of forms when running in vitest but does so in jest. I found a couple of stray StackOverflow questions that seem to run into the same issue and there hasn't been any solution besides switching from click
to submit
. I don't particularly like that this change is necessary, but I think I don't see a lot of value in trying to debug this further - if you disagree and would prefer staying with click
, I can spend some more time trying to find a better solution though!
Switch to using vite and vitest instead of (plain) rollup, babel and jest. This will allow us to easily write type tests in the future thanks to vitests
expectTypeOf
andassertType
.