-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
refactor(tests): move StaticCanvas tests from qunit to vitest #10521
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
refactor(tests): move StaticCanvas tests from qunit to vitest #10521
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
@@ -20,16 +20,6 @@ import { | |||
version, | |||
} from '../../fabric'; | |||
|
|||
vi.mock('../util/misc/objectEnlive', async (importOriginal) => ({ |
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.
removed because images load just fine now
It seems that you opened a PR but you didn't add a line to the changelog file
|
@@ -18,6 +25,12 @@ export default defineConfig({ | |||
'extensions/**/*.spec.{ts,tsx}', | |||
'extensions/**/*.test.{ts,tsx}', | |||
], | |||
environmentOptions: { | |||
jsdom: { | |||
resources: 'usable', |
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 was the key change to tell jsdom to load images
and onload handlers for image element work fine now
@@ -32,6 +33,30 @@ export const roundSnapshotOptions = { | |||
}; | |||
|
|||
expect.extend({ | |||
toSameImageObject(actual: FabricImage, expected: FabricImage) { |
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 matcher is a port from qunit
8c2d543
to
f3e64b1
Compare
…rom-qunit-to-vitest
Let me merge this so we avoid conflicts with the other one |
Build Stats
|
hm, why is it failing in CI |
ah maybe because of this i am using node 22 locally |
i would factor out jsdom usable and restore the image mock, and reiterate later on these |
I am currently at work |
I don't think current PR is a big deal to solve conflicts #10519 should be mergeable |
There is no rush. |
…rom-qunit-to-vitest
On my local it works fine both normally and when collecting coverage. node20 arm64 |
Hm is it working now in CI? |
|
now it passes in CI too, consistently |
This moves StaticCanvas unit tests from qunit to vitest
I managed to figure out why jsdom wasn't loading images and now all tests pass in vitest as they were in qunit
There are no skipped tests
Also I removed mocking for image loading from other tests now that we can properly load images in jsdom
StaticCanvas took most time so far to migrate
other ones seem smaller and easier to do
I am glad I got this one out of the way