-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
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
[code-infra] Changes for test util to work in vitest
#43625
base: master
Are you sure you want to change the base?
Conversation
Netlify deploy previewhttps://deploy-preview-43625--material-ui.netlify.app/ Bundle size reportDetails of bundle changes (Toolpad) |
This reverts commit 76edd75.
vitest
vitest
@@ -28,13 +28,15 @@ import { EventHandlers } from '../utils/types'; | |||
const EMPTY_OBJECT = {}; | |||
const NOOP = () => {}; | |||
|
|||
const defaultItemComparer = <ItemValue>(optionA: ItemValue, optionB: ItemValue) => | |||
optionA === optionB; | |||
function defaultItemComparer<ItemValue>(optionA: ItemValue, optionB: ItemValue) { |
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.
Is this related to vitest changes?
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.
Yes, vitest can't execute jsx in js files. There's a workaround, but you have to have every file interpreted as jsx. That unfortunately breaks this code.
@@ -932,7 +932,7 @@ describe('Joy <Autocomplete />', () => { | |||
it('should ignore keydown event until the IME is confirmed', function test() { | |||
// TODO: Often times out in Firefox 78. | |||
// Is this slow because of testing-library or because of the implementation? | |||
this.timeout(4000); | |||
this?.timeout?.(4000); |
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.
Is vitest fast enough that we don't need an increased timeout?
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.
Haven't seen it timeout yet. Will add it back for vitest if it's a problem. Otherwise we'll remove this altogether
@@ -0,0 +1,9 @@ | |||
// Shim for vitest describe.skipIf to be able to run mocha and vitest side-by-side | |||
// TODO: Remove after migration to vitest is complete | |||
const describeSkipIf: (condition: boolean) => Mocha.PendingSuiteFunction = |
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 hope it's just temporary, as the name is terrible :)
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.
Yes, we'll turn this into describe.skipIf
once we're away from mocha. There is no way to monkey patch in mocha, they don't expose these in the setup files
Related to mui/mui-x#14508
Help toward mui/mui-public#170