-
Notifications
You must be signed in to change notification settings - Fork 159
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
test: switch from jest to vitest #10412
Conversation
Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would create a changelog item based on your changes. |
c20c8f2
to
29c144d
Compare
tests/unit/config/jest.overrides.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'm not sure ... doesn't this code take care we're logging vue warnings to the console? Do we have that in vitest ootb or should we keep/port this?
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.
Good catch, I don't know to be honest. Definitely something we should check.
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.
Why is this file gone?
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.
As you correctly assumed that's because the corresponding test is being skipped and never actually ran once with vitest.
// region: { enabled: false } | ||
// } | ||
// }) | ||
// ).toHaveNoViolations() |
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.
Why is this skipped?
Is this the reason the snapshot is gone? Although this test was skipped before already ...
Can't we fix it or add at least a comment what fails?
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 a comment already, this test has always been flaky and I don't know why and how to fix it 🤷
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.
Oh I thought we don't use axe
anymore... if I remember correctly this was just a quick test / use case for automated accessibility tests. Since we didn't follow up I'd say completely get rid of it for now (here and in OcTable
).
expect(catchFn).toHaveBeenCalledWith(expect.any(mockAxios.Cancel)) | ||
done() | ||
}) | ||
}) |
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.
Added removal of HttpClient to the followup tasks... was easier for now to just remove the test than to port it. The function is unused anyhow...
expect(clientService.owncloudSdk.shares.getShares).toHaveBeenCalledTimes(4) | ||
|
||
// FIXME: pqueue makes issues?! | ||
// expect(clientService.owncloudSdk.shares.getShares).toHaveBeenCalledTimes(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.
uaaaaaaarghs - what do we make out of this?
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.
We didn't find a solution 😅 That's the only place where this causes issues...
packages/web-pkg/tests/unit/composables/actions/useOpenWithDefaultApp.spec.ts
Outdated
Show resolved
Hide resolved
packages/web-pkg/tests/unit/composables/actions/files/useFileActionsCreateLink.spec.ts
Outdated
Show resolved
Hide resolved
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.
Would it be potentially better to use fake timers than sleeping 600ms?
Not that it matters thaaaat much in this single test but in theory...
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 tried it, but it didn't work for some reason. The docs are mentioning only setTimeout
and setInterval
... maybe we can't use it for lodash's debounce
.
Quality Gate passedKudos, no new issues were introduced! 0 New issues |
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.
💪
Description
Removes
jest
in favour ofvitest
for our unit test suite. The API remains nearly unchanged (expect for thatjest
now becamevi
).Unfortunately we lose our nice snapshot formatter. We have to see if there is some äquivalent for vitest.
Possibly/hopefully fixes #10380.
Types of changes
Followup Tasks