Skip to content
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] Remove clock=fake from describeValidation #17150

Merged
merged 6 commits into from
Mar 30, 2025

Conversation

JCQuintas
Copy link
Member

@JCQuintas JCQuintas commented Mar 26, 2025

These are improvements made during the vitest PR

I'm moving the changes out so that PR is leaner.

The main change here is removing the fake date usage from most of the describeValidation logic.
I've left it only where necessary, in the should apply disablePast tests

An alternative would be to always fake the date, which would probably work, but I preferred a more precise approach.

@JCQuintas JCQuintas added test scope: code-infra Specific to the core-infra product maintenance labels Mar 26, 2025
@JCQuintas JCQuintas self-assigned this Mar 26, 2025
@JCQuintas JCQuintas changed the title [code-infra] [code-infra] Remove clock=fake from describeValidation Mar 26, 2025
@mui-bot
Copy link

mui-bot commented Mar 26, 2025

Deploy preview: https://deploy-preview-17150--material-ui-x.netlify.app/

Generated by 🚫 dangerJS against c14f310

@@ -154,7 +154,7 @@ const createSection = ({
} else {
if (sectionConfig.maxLength == null) {
throw new Error(
`MUI X: The token ${token} should have a 'maxDigitNumber' property on it's adapter`,
`MUI X: The token ${token} should have a 'maxLength' property on it's adapter`,
Copy link
Member Author

Choose a reason for hiding this comment

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

This text seemed wrong, as I couldn't find a maxDigitNumber prop

setValue(past);
describe('with fake timers', () => {
// TODO: temporary for vitest. Can move to `vi.useFakeTimers`
let timer: SinonFakeTimers | null = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

fake timer here

value: [past, now],
describe('with fake timers', () => {
// TODO: temporary for vitest. Can move to `vi.useFakeTimers`
let timer: SinonFakeTimers | null = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

fake timer here

}
describeSkipIf(!withDate)('with fake timers', () => {
// TODO: temporary for vitest. Can move to `vi.useFakeTimers`
let timer: SinonFakeTimers | null = null;
Copy link
Member Author

Choose a reason for hiding this comment

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

fake timer here

@JCQuintas JCQuintas requested review from a team March 26, 2025 23:20
@JCQuintas JCQuintas marked this pull request as ready for review March 26, 2025 23:20
Copy link
Member

@LukasTy LukasTy left a comment

Choose a reason for hiding this comment

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

Nice optimization. 👍
Thanks for shrinking the vite mega PR. 🙏 💯

@JCQuintas JCQuintas merged commit e003614 into mui:master Mar 30, 2025
21 checks passed
@JCQuintas JCQuintas deleted the date-pickers branch March 30, 2025 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance scope: code-infra Specific to the core-infra product test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants