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

Use vite and vitest #150

Merged
merged 6 commits into from
Jan 23, 2024
Merged

Use vite and vitest #150

merged 6 commits into from
Jan 23, 2024

Conversation

Gotos
Copy link
Member

@Gotos Gotos commented Jan 17, 2024

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 and assertType.

@Gotos Gotos marked this pull request as draft January 17, 2024 19:50
Copy link

Pull Request Test Coverage Report for Build 7561408940

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-3.3%) to 96.719%

Totals Coverage Status
Change from base Build 7478871871: -3.3%
Covered Lines: 3699
Relevant Lines: 3840

💛 - Coveralls

@Gotos Gotos marked this pull request as ready for review January 17, 2024 20:31
@Gotos
Copy link
Member Author

Gotos commented Jan 18, 2024

Pull Request Test Coverage Report for Build 7561408940

* **0** of **0**   changed or added relevant lines in **0** files are covered.

* No unchanged relevant lines lost coverage.

* Overall coverage decreased (**-3.3%**) to **96.719%**

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);
Copy link
Member Author

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!

@DysphoricUnicorn DysphoricUnicorn merged commit 4bb1b4e into main Jan 23, 2024
1 check passed
@DysphoricUnicorn DysphoricUnicorn deleted the use-vite-and-vitest branch January 23, 2024 17:15
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