Skip to content

Conversation

Smrtnyk
Copy link
Contributor

@Smrtnyk Smrtnyk commented Apr 7, 2025

moves canvas tests from qunit to vitest
this one is pretty big one, and I think most complicated one
other ones will be much or should be much easier, at least according to my cursory look over it

Copy link

codesandbox bot commented Apr 7, 2025

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@Smrtnyk Smrtnyk force-pushed the refactor(tests)-move-canvas-tests-from-qunit-to-vitest branch from 3aa37df to fbb4289 Compare April 7, 2025 15:56

vi.mock('../util/misc/objectEnlive', async (importOriginal) => ({
...(await importOriginal()),
loadImage: vi.fn().mockImplementation(() => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

one test was loading the image in qunit, and it wasn't working in vitest like this since this is running in jsdom
so I did it like this
we can restore real image load if we eventually move to browser tests in vitest, but for now I think this is good enough

}),
}));

const EMPTY_JSON = '{"version":"' + version + '","objects":[]}';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

there are lots of tests here now
it got a lot
maybe it will be worth splitting these tests up
but for now I think this is ok, and we should focus first on finishing migration before thinking to refine this further

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I noticed that previous tests here were using test instead of it but on other places it is used so there is a bit of mixup
I think we should unify this to only use one approach
most of tests are using it so I guess it would make sense to use it in all files then

Copy link
Member

Choose a reason for hiding this comment

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

i have no preferences.
I always used 'it' at work, recently they told me that 'test' should be preferred.
I do not even know if they are aliases or have slight differences

Copy link
Contributor

Build Stats

file / KB (diff) bundled minified
fabric 917.131 (0) 307.398 (0)

Copy link
Contributor


> fabric@6.6.2 coverage:report:ci
> nyc report --reporter=text-summary


=============================== Coverage summary ===============================
Statements   : 43.8% ( 16174/36923 )
Branches     : 46.21% ( 2918/6314 )
Functions    : 61.99% ( 1171/1889 )
Lines        : 48.7% ( 14074/28896 )
================================================================================

@asturur asturur merged commit d9123d6 into fabricjs:master Apr 12, 2025
21 checks passed
@Smrtnyk Smrtnyk deleted the refactor(tests)-move-canvas-tests-from-qunit-to-vitest branch April 13, 2025 06:12
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