-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
ci(): Migrate jest to vitest #10420
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
ci(): Migrate jest to vitest #10420
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
vitest.extend.ts
Outdated
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.
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
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.
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
My first impression is that the api changes are minimal ( just mock checks a little bit ). |
build failed most probably because I removed After we land this (if we land this) I can help you migrate some of those QUnit tests to vitest |
I am using browser mode heavily in my vue project, because I can test my components in real environment with real rendering and screenshots. |
94c7a51
to
aed5a2d
Compare
@asturur could you please rerun the build? to see if it is fixed now |
Sorry i have been out, just to be clear i m insterested in this PR |
on my local, mac m1 arm64: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Failed Tests 21 ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
FAIL src/brushes/CircleBrush.test.ts > CircleBrush > can be initialized
FAIL src/canvas/SelectableCanvas.spec.ts > Selectable Canvas > _pointIsInObjectSelectionArea > points and selection area
FAIL src/controls/Control.spec.ts > Controls > method binding
FAIL src/controls/pathControl.spec.ts > pathControls > should fire events
FAIL src/controls/polyControl.spec.ts > polyControl > should fire events
FAIL src/controls/scale.test.ts > Scale > adjusts a 0 width rect for polyActionhandler without it returning Infinity/NaN side scale
FAIL src/shapes/ActiveSelection.spec.ts > ActiveSelection > `setActiveObject` should update the active selection ref on canvas if it changed
FAIL src/shapes/Group.spec.ts > Group > adding and removing an object
FAIL src/util/typeAssertions.spec.ts > typeAssertions > isTextObject > can detect FabricText
FAIL src/canvas/__tests__/SelectableCanvas.spec.ts > Canvas > invalidating `_objectsToRender` > initial state
FAIL src/shapes/Text/StyledText.spec.ts > setSelectionStyles > will set properties at the correct position
FAIL src/shapes/Text/TextSVGExportMixin.spec.ts > TextSvgExport > exports text background color correctly
Error: Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/21]⎯
FAIL src/canvas/StaticCanvas.spec.ts > StaticCanvas > toBlob
Error: Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[2/21]⎯
FAIL src/controls/changeWidth.test.ts > changeWidth > changeWidth changes the width
Error: Hook timed out in 10000ms.
If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[3/21]⎯
FAIL src/shapes/Textbox.spec.ts > Textbox > fromObject
FAIL src/shapes/IText/IText.test.ts > IText > cursor drawing width > group scaled by 1 and rotated by +0 , text scaled by 1 and rotated by +0, and canvas zoomed by 1
FAIL src/shapes/IText/ITextBehavior.test.ts > text imperative changes > removeChars
FAIL src/shapes/Object/InteractiveObject.spec.ts > InteractiveObject > setCoords for objects inside group with rotation > all corners are rotated as much as the object total angle
FAIL src/shapes/Text/Text.spec.ts > FabricText > toObject
Error: Test timed out in 5000ms.
If this is a long-running test, pass a timeout value as the last argument or configure it globally with "testTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[4/21]⎯
FAIL src/canvas/__tests__/eventData.test.ts > Canvas event data > HTML event "mousedown" should fire a corresponding canvas event
Error: Hook timed out in 10000ms.
If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[5/21]⎯
FAIL src/shapes/IText/ITextKeyBehavior.test.ts > IText move cursor > selection changes > enterEditing does not use delayedCursor
Error: Hook timed out in 10000ms.
If this is a long-running hook, pass a timeout value as the last argument or configure it globally with "hookTimeout".
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[6/21]⎯
Test Files 21 failed | 30 passed (51)
Tests 21 failed | 435 passed | 2 skipped (458)
Start at 21:42:47
Duration 53.51s (transform 962ms, setup 10.03s, collect 27.19s, tests 340.16s, environment 13.88s, prepare 2.08s)
|
Hm weird, works perfectly fine for me on linux |
I think on the mac i have to move the pool from forks to thread. |
Interesting I believe some tests need snapshot updates now |
ok so for some reason |
I m really undecided it to use vitest globals or add the imports each test file. |
Also somehow we have a speed penality running vitest from 22s to 32s |
I usually avoid involving global types if I can because it can pull in some unwanted types in files that don't need it |
I think that is some regression from vitest v2 to vitest v3 |
regarding spy.on they are doing some changes to it |
Yes i think globals are not a good idea, is ok to import vitest when you want to test. I'll try to fix a couple of outstanding issues i want to put in, then i ll merge the jsdom/canvas3 pr and remove node 16. That will be a very simple 7.0 upgrade, so i don't have to rush building versioned docs on the website |
package.json
Outdated
@@ -115,10 +115,11 @@ | |||
"testem": "^3.8.0", | |||
"tslib": "^2.6.3", | |||
"typescript": "^5.5.4", | |||
"v8-to-istanbul": "^9.3.0" | |||
"v8-to-istanbul": "^9.3.0", | |||
"vitest": "^3.0.4" |
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.
there is 3.1.1 released with lots of fixes
maybe we should jump on that train as well
kinda unrelated but would you be open to add something like https://github.com/stackblitz-labs/pkg.pr.new |
I think we are good. |
we declared jsdom as environment in vitest config |
btw, after this is done and merged, I will try to help with migration of some unit tests from qunit to vitest |
That would be great. I want to migrate the visuals test to playwright |
proposed here #10417 (comment)