-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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] Add Charts
test
#11551
[test] Add Charts
test
#11551
Conversation
Deploy preview: https://deploy-preview-11551--material-ui-x.netlify.app/ |
The first issue doesn't look ESM related to me, it seems like it's trying to run untranspiled typescript under node.js. Will take a look this week |
import { FormatterParams } from '@mui/x-charts/models/seriesType/config'; | ||
import lineFormatter from '@mui/x-charts/LineChart/formatter'; |
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.
These are private paths, so private APIs. I think importing with a relative path could make more sense:
import { FormatterParams } from '@mui/x-charts/models/seriesType/config'; | |
import lineFormatter from '@mui/x-charts/LineChart/formatter'; | |
import { FormatterParams } from '../seriesType/config'; | |
import lineFormatter from './formatter'; |
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.
Agree, I tried both to be sure the import wand not the cause of the issue
Looks like I can get it to run with |
d40a77f
to
e0e8435
Compare
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.
Minor typo in a comment. Otherwise looks good 👍
Co-authored-by: Jan Potoms <[email protected]> Signed-off-by: Alexandre Fauquette <[email protected]>
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.
What's the rational to not apply the same fix to the data, grid and other components? (I mean why have two different mocha configurations?)
.circleci/config.yml
Outdated
@@ -129,6 +129,9 @@ jobs: | |||
steps: | |||
- checkout | |||
- install_js | |||
- run: | |||
name: Tests charts | |||
command: yarn test:charts:unit |
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.
Can we add a TODO to signal that we want to remove this once ESM issues are solved? It's weird to have different ways to run the tests.
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.
Another option could be to have a test:unit
on every package and then call workspace run test:unit
in the root package test:unit
, that way having a custom config for charts would be a bit less "hacky". 🙈
WDYT?
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 prefer to keep the hacky feeling, just such that when reading this code it's obvious that something is wrong and need to be fixed (once ESM is done)
Because with this mocha config the hack that swich between date-fns v2 and v3 is not applied, leading to errors in date picker tests |
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.
Because with this mocha config the hack that swich between date-fns v2 and v3 is not applied, leading to errors in date picker tests
That's what I feared the most when introducing that "hack". 🤔
I couldn't think of a better approach while still keeping the date-fns
testing hack... 🤷
If we ever think of it - this hacky approach could be dropped. 🤞
P.S. I'm changing the PR title to "[test] Add Charts
test" as it doesn't impact the package itself. 🤔
.circleci/config.yml
Outdated
@@ -129,6 +129,9 @@ jobs: | |||
steps: | |||
- checkout | |||
- install_js | |||
- run: | |||
name: Tests charts | |||
command: yarn test:charts:unit |
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.
Another option could be to have a test:unit
on every package and then call workspace run test:unit
in the root package test:unit
, that way having a custom config for charts would be a bit less "hacky". 🙈
WDYT?
Signed-off-by: Alexandre Fauquette <[email protected]> Co-authored-by: Jan Potoms <[email protected]>
I was trying to add test to x-charts, but the ESM issue seems to be blocking.
The
yarn test:unit
returnsThe
yarn t formatter
returnsDoes someone of the @mui/code-infra has an opinion on this topic. For now, the only solution I see is to write test with JS