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

jest to vitest #10420

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft

jest to vitest #10420

wants to merge 1 commit into from

Conversation

Smrtnyk
Copy link

@Smrtnyk Smrtnyk commented Jan 29, 2025

proposed here #10417 (comment)

Copy link

codesandbox bot commented Jan 29, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@Smrtnyk Smrtnyk marked this pull request as draft January 29, 2025 21:07
Copy link
Author

Choose a reason for hiding this comment

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

I feel like this ceremony with jest-snapshot package could be circumvented with https://vitest.dev/guide/snapshot#custom-serializer
but I didn't dig deep what exactly this is all about
i assume for more simple snapshots or something

I will leave it for some other time

Copy link
Member

Choose a reason for hiding this comment

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

I think is to add 'toMatchRoundedMatrix' maybe we can avoid to use that custom matcher or just have a function in that case that does what it has to do

@asturur
Copy link
Member

asturur commented Jan 30, 2025

My first impression is that the api changes are minimal ( just mock checks a little bit ).
I ll have a read of how vitest runs in a browser and see if is worth to have some of those running in a browser too.

@asturur
Copy link
Member

asturur commented Jan 30, 2025

image

those needs to stay in a separate PR, could also be the reason why your build is failing

@Smrtnyk
Copy link
Author

Smrtnyk commented Jan 30, 2025

image those needs to stay in a separate PR, could also be the reason why your build is failing

build failed most probably because I removed @types/jsdom
https://github.com/fabricjs/fabric.js/pull/10420/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519L87
because I thought those were only used for tests, but they are actually needed for building the prod code
I will bring those types back
Regarding dropping the jsdom update here I am not sure about that, I reverted the old jsdom version and vitest tests didn't work
seems like it relies on newer jsdom
That being said, vitest and this PR rely on node at least being 18 and newer jsdom, so maybe this PR should land after your PR
#10417
And then we just rebase this PR when it is merged

After we land this (if we land this) I can help you migrate some of those QUnit tests to vitest
I am not that good with maths so can't really help you with fabric src code, but I have a bit of experience with testing and tooling so I can help you with that

@Smrtnyk
Copy link
Author

Smrtnyk commented Jan 30, 2025

My first impression is that the api changes are minimal ( just mock checks a little bit ). I ll have a read of how vitest runs in a browser and see if is worth to have some of those running in a browser too.

I am using browser mode heavily in my vue project, because I can test my components in real environment with real rendering and screenshots.
The only downside is that you can't use breakpoints and debugger from node, you have to start the ui and headed browser then in the ui put a breakpoint in the browser instance which is a bit cumbersome

@Smrtnyk
Copy link
Author

Smrtnyk commented Jan 31, 2025

@asturur could you please rerun the build? to see if it is fixed now

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