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

[test] Throw if date adapter is not found #5289

Merged

Conversation

cherniavskii
Copy link
Member

Follow up on #5055

Before:

$ yarn test:unit --date-adapter moments
yarn run v1.22.17
$ cross-env NODE_ENV=test node --expose_gc ./node_modules/.bin/mocha 'packages/**/*.test.{js,ts,tsx}' --exclude '**/node_modules/**' --timeout 3000 --date-adapter moments
including inaccessible elements by default

  1335 passing (1m)
  195 pending

moments adapter was not found, so date-fns was used by default. There's no indication of adapter used in tests and if you didn't notice the typo ("moments") it looks like tests passed with moment adapter

After:

$ yarn test:unit --date-adapter moments
yarn run v1.22.17
$ cross-env NODE_ENV=test node --expose_gc ./node_modules/.bin/mocha 'packages/**/*.test.{js,ts,tsx}' --exclude '**/node_modules/**' --timeout 3000 --date-adapter moments
including inaccessible elements by default
Error: Invalid --date-adapter value "moments". Supported date adapters: "date-fns", "dayjs", "luxon", "moment"
error Command failed with exit code 1.

If adapter is not found - it will just throw.

let adapter = 'date-fns';
const availableAdapters = {
'date-fns': AdapterDateFns,
dayjs: AdapterDayjs,
Copy link
Member Author

Choose a reason for hiding this comment

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

I've renamed it from day-js to dayjs to match package name https://www.npmjs.com/package/dayjs

@mui-bot
Copy link

mui-bot commented Jun 22, 2022

These are the results for the performance tests:

Test case Unit Min Max Median Mean σ
Filter 100k rows ms 252 538.1 332.8 352.34 105.429
Sort 100k rows ms 462.4 870.8 767.4 715.34 155.564
Select 100k rows ms 115.7 257.3 209.9 194.26 46.779
Deselect 100k rows ms 102.9 223 180.6 181.3 43.833

Generated by 🚫 dangerJS against 1663ac2

Copy link
Member

@alexfauquette alexfauquette left a comment

Choose a reason for hiding this comment

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

That's a nice refinement

test/utils/pickers-utils.tsx Outdated Show resolved Hide resolved
@cherniavskii cherniavskii force-pushed the unit-tests-date-adapter-selection branch from 8bd6aac to 1663ac2 Compare June 22, 2022 13:02
@cherniavskii cherniavskii merged commit 92fd042 into mui:master Jun 22, 2022
@cherniavskii cherniavskii deleted the unit-tests-date-adapter-selection branch June 22, 2022 14:12
joserodolfofreitas pushed a commit to joserodolfofreitas/mui-x that referenced this pull request Jul 15, 2022
* Throw if date adapter is not found

* add comment
alexfauquette pushed a commit to alexfauquette/mui-x that referenced this pull request Aug 26, 2022
* Throw if date adapter is not found

* add comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants