-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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] Fix adapters code coverage #13969
Conversation
Deploy preview: https://deploy-preview-13969--material-ui-x.netlify.app/ |
@alexfauquette Thank you for taking care of it. 🙏 |
Yeah it is 😬 /* istanbul ignore next */
I would personally use |
Thanks for reminding about this. 👍 |
- also wrap the checks in `process.env.NODE_ENV !== 'production'` to avoid bundling it
].join('\n'), | ||
); | ||
/* istanbul ignore next */ | ||
if (process.env.NODE_ENV !== 'production') { |
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 have reverted the previous changes and added this check to avoid bundling these warning in production
.
Do you think it is worth 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.
Good for me
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.
For the warnOnce
, it's definitely worth it
Well, given that I've done part of the work, I'm leaving the approval step for @flaviendelangle. 🙈 |
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 can't approve since I'm the author, but this PR looks good to me 👍
For the remaining line not tested, probably skipping it is the good way
packages/x-date-pickers/src/AdapterMomentJalaali/AdapterMomentJalaali.ts
Show resolved
Hide resolved
Co-authored-by: Lukas <[email protected]>
The #13608 PR revealed the codecov.yml was not valid. So the 100% requirement was not applied.
This PR fix the config file by moving
ignore
parameter, and add missing testsThere are still some remaining untested lines
The remaining lines
✅ Luxon
I don't see in which case the localised week day could not be defined
Warning
This is probably untestable.
The
localeWeekNumber
is defined only with latestluxon
release, where the support for it was added.Added an
istanbul ignore next
to omit it from coverage.mui-x/packages/x-date-pickers/src/AdapterLuxon/AdapterLuxon.ts
Line 488 in 9ba6b5f
✅ Dayjs
Technically we could add a test "it should not display the error message in production"
Tip
Not sure it is worth it.
Added an
istanbul ignore next
to omit it from coverage.mui-x/packages/x-date-pickers/src/AdapterDayjs/AdapterDayjs.ts
Line 251 in b795564
✅ DateFns (v2,v3, v2 jalaali, v3 jalaali)
✅ Major version assertions
Tip
Added an
istanbul ignore next
to omit it from coverage.mui-x/packages/x-date-pickers/src/AdapterDateFnsV3/AdapterDateFnsV3.ts
Lines 90 to 97 in b795564
mui-x/packages/x-date-pickers/src/AdapterDateFnsV3/AdapterDateFnsV3.ts
Lines 98 to 102 in b795564
mui-x/packages/x-date-pickers/src/AdapterDateFnsJalaliV3/AdapterDateFnsJalaliV3.ts
Line 163 in b795564
✅ Locale code fallback
Warning
I have removed the fallback, because locale and it's code is always defined: cd2412f.
As listed below: if an invalid locale is passed without a
code
: that's a problem that I'm not sure we should be safeguarding against. 🤷With the adapter having the following defaultize, the only way I found to have no
locale.code
is to pass an invalid locale string. But that make no sens because other methods will faillProposal
We could set the config file with
threshold: 0%
to just be sure we do not deteriorate this