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

[core] Batch small changes #23422

Merged
merged 4 commits into from
Nov 9, 2020

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Nov 7, 2020

@oliviertassinari oliviertassinari added the umbrella For grouping multiple issues to provide a holistic view label Nov 7, 2020
@mui-pr-bot
Copy link

mui-pr-bot commented Nov 7, 2020

No bundle size changes

Generated by 🚫 dangerJS against 663d162

README.md Outdated Show resolved Hide resolved
});
});

// Ensure that uncaught exceptions between tests result in the tests failing.
Copy link
Member

Choose a reason for hiding this comment

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

How can I repro this? It's not clear whether this error should be caught here or if there's some other problematic test behavior that should actually be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

mui/mui-x#543 was meant to be the reproduction (failing CI). It fails on this test https://github.com/mui-org/material-ui-x/blob/453e2f14f6981cda278faf0ce1edb8a7e543078d/packages/grid/x-grid/src/XGrid.test.tsx#L80-L89 (and the others). If you want to reproduce with fewer changes you can do:

diff --git a/packages/grid/_modules_/grid/hooks/utils/useResizeContainer.ts b/packages/grid/_modules_/grid/hooks/utils/useResizeContainer.ts
index e9750e8a..4297f4c1 100644
--- a/packages/grid/_modules_/grid/hooks/utils/useResizeContainer.ts
+++ b/packages/grid/_modules_/grid/hooks/utils/useResizeContainer.ts
@@ -8,6 +8,7 @@ export function useResizeContainer(apiRef): (size: ElementSize) => void {

   const onResize = React.useCallback(
     (size: ElementSize) => {
+      throw new Error('ooop')
       if (size.height === 0) {
         gridLogger.warn(
           [
diff --git a/test/karma.conf.js b/test/karma.conf.js
  • Run the tests with yarn test:karma
  • the first test passes, all the other are skipped 💥

Copy link
Member

Choose a reason for hiding this comment

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

So just to be clear:

  1. This does not cover all cases.
  2. What we should catch is components that don't clean up.
    The problem isn't that an error was thrown between tests but that the component/test leaks.

I'm not that happy with the new listener since it might trick people into thinking errors between tests are caught and you're safe. Let's see if that produces problematic component code/tests. In the end we shouldn't actually add code we don't need.

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you recommend we do here? No strong preferences. If we can get test/utils/setupKarma.js to be shared with X, but with the need to keep the patch for karma-runner/karma-mocha#227 on X only, it will already be a good step forward in sharing code.

Copy link
Member

Choose a reason for hiding this comment

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

Nah, all good to merge. Just want to caution that we don't get a false sense of security.

@oliviertassinari oliviertassinari merged commit 87b4852 into mui:next Nov 9, 2020
@oliviertassinari oliviertassinari deleted the batch-small-changes-v35 branch November 9, 2020 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
umbrella For grouping multiple issues to provide a holistic view
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants