1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201diff --git a/babel.config.js b/babel.config.js
index 658f4724f9..338d8c46a9 100644
--- a/babel.config.js
+++ b/babel.config.js
@@ -42,7 +42,13 @@ module.exports = function getBabelConfig(api) {
shippedProposals: api.env('modern'),
},
],
- '@babel/preset-react',
+ [
+ '@babel/preset-react',
+ {
+ // default in Babel 8
+ runtime: 'automatic',
+ },
+ ],
'@babel/preset-typescript',
];
diff --git a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
index cab486d9db..3107739555 100644
--- a/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
+++ b/packages/material-ui-styles/src/ThemeProvider/ThemeProvider.test.js
@@ -122,11 +122,7 @@ describe('ThemeProvider', () => {
<div />
</ThemeProvider>,
);
- }).toErrorDev([
- 'However, no outer theme is present.',
- // strict mode renders twice
- 'However, no outer theme is present.',
- ]);
+ }).toErrorDev(['However, no outer theme is present.']);
});
it('should warn about wrong theme function', () => {
@@ -139,11 +135,7 @@ describe('ThemeProvider', () => {
,
</ThemeProvider>,
);
- }).toErrorDev([
- 'Material-UI: You should return an object from your theme function',
- // strict mode renders twice
- 'Material-UI: You should return an object from your theme function',
- ]);
+ }).toErrorDev(['Material-UI: You should return an object from your theme function']);
});
});
});
diff --git a/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js b/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js
index 2ab151c6c8..6db6326d77 100644
--- a/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js
+++ b/packages/material-ui-styles/src/useThemeVariants/useThemeVariants.test.js
@@ -135,11 +135,6 @@ describe('useThemeVariants', () => {
</ThemeProvider>,
),
).toErrorDev([
- // strict mode renders twice
- [
- `Material-UI: You are using a variant value \`test\` for which you didn't define styles.`,
- `Please create a new variant matcher in your theme for this variant. To learn more about matchers visit https://next.material-ui.com/r/custom-component-variants.`,
- ].join('\n'),
[
`Material-UI: You are using a variant value \`test\` for which you didn't define styles.`,
`Please create a new variant matcher in your theme for this variant. To learn more about matchers visit https://next.material-ui.com/r/custom-component-variants.`,
diff --git a/packages/material-ui/src/Autocomplete/Autocomplete.test.js b/packages/material-ui/src/Autocomplete/Autocomplete.test.js
index cd02208b63..f3beebd4bc 100644
--- a/packages/material-ui/src/Autocomplete/Autocomplete.test.js
+++ b/packages/material-ui/src/Autocomplete/Autocomplete.test.js
@@ -1181,10 +1181,6 @@ describe('<Autocomplete />', () => {
fireEvent.change(textbox, { target: { value: 'a' } });
fireEvent.keyDown(textbox, { key: 'Enter' });
}).toErrorDev([
- 'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
- // strict mode renders twice
- 'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
- // strict mode renders twice
'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
'Material-UI: The `getOptionLabel` method of Autocomplete returned undefined instead of a string',
@@ -1238,9 +1234,6 @@ describe('<Autocomplete />', () => {
/>,
);
}).toWarnDev([
- 'None of the options match with `"not a good value"`',
- // strict mode renders twice
- 'None of the options match with `"not a good value"`',
'None of the options match with `"not a good value"`',
'None of the options match with `"not a good value"`',
]);
@@ -1266,11 +1259,7 @@ describe('<Autocomplete />', () => {
groupBy={(option) => option.group}
/>,
);
- }).toWarnDev([
- // strict mode renders twice
- 'returns duplicated headers',
- 'returns duplicated headers',
- ]);
+ }).toWarnDev(['returns duplicated headers']);
const options = screen.getAllByRole('option').map((el) => el.textContent);
expect(options).to.have.length(7);
expect(options).to.deep.equal(['A', 'D', 'E', 'B', 'G', 'F', 'C']);
diff --git a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js
index d5c5735ecf..86a4ebdece 100644
--- a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js
+++ b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.test.js
@@ -100,7 +100,6 @@ describe('<Breadcrumbs />', () => {
);
}).toErrorDev([
'Material-UI: You have provided an invalid combination of props to the Breadcrumbs.\nitemsAfterCollapse={2} + itemsBeforeCollapse={2} >= maxItems={3}',
- 'Material-UI: You have provided an invalid combination of props to the Breadcrumbs.\nitemsAfterCollapse={2} + itemsBeforeCollapse={2} >= maxItems={3}',
]);
expect(screen.getAllByRole('listitem', { hidden: false })).to.have.length(4);
expect(screen.getByRole('list')).to.have.text('first/second/third/fourth');
diff --git a/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js b/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js
index fe9020d480..52d53b4bea 100644
--- a/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js
+++ b/packages/material-ui/src/ClickAwayListener/ClickAwayListener.test.js
@@ -160,8 +160,7 @@ describe('<ClickAwayListener />', () => {
expect(handleClickAway.callCount).to.equal(0);
fireEvent.click(getByText('Stop inside a portal'));
- // True-negative, we don't have enough information to do otherwise.
- expect(handleClickAway.callCount).to.equal(1);
+ expect(handleClickAway.callCount).to.equal(0);
});
it('should not be called during the same event that mounted the ClickAwayListener', () => {
diff --git a/packages/material-ui/src/Tabs/Tabs.test.js b/packages/material-ui/src/Tabs/Tabs.test.js
index 50e4f67d73..70e07d3da7 100644
--- a/packages/material-ui/src/Tabs/Tabs.test.js
+++ b/packages/material-ui/src/Tabs/Tabs.test.js
@@ -91,9 +91,6 @@ describe('<Tabs />', () => {
expect(() => {
render(<Tabs value={0} centered variant="scrollable" />);
}).toErrorDev([
- 'Material-UI: You can not use the `centered={true}` and `variant="scrollable"`',
- // StrictMode renders twice
- 'Material-UI: You can not use the `centered={true}` and `variant="scrollable"`',
'Material-UI: You can not use the `centered={true}` and `variant="scrollable"`',
'Material-UI: You can not use the `centered={true}` and `variant="scrollable"`',
]);
diff --git a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
index cca7f0ee6c..5a878b6462 100644
--- a/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
+++ b/packages/material-ui/src/TextareaAutosize/TextareaAutosize.test.js
@@ -286,12 +286,7 @@ describe('<TextareaAutosize />', () => {
expect(() => {
forceUpdate();
- }).toErrorDev([
- 'Material-UI: Too many re-renders.',
- // strict mode renders twice
- 'Material-UI: Too many re-renders.',
- 'Material-UI: Too many re-renders.',
- ]);
+ }).toErrorDev(['Material-UI: Too many re-renders.']);
});
});
});
diff --git a/packages/material-ui/src/internal/SwitchBase.test.js b/packages/material-ui/src/internal/SwitchBase.test.js
index 3f26a11e1b..3732eb2e9a 100644
--- a/packages/material-ui/src/internal/SwitchBase.test.js
+++ b/packages/material-ui/src/internal/SwitchBase.test.js
@@ -393,7 +393,7 @@ describe('<SwitchBase />', () => {
setProps({ checked: true });
global['didWarnControlledToUncontrolled'] = true;
}).toErrorDev([
- 'Warning: A component is changing an uncontrolled input of type checkbox to be controlled.',
+ 'Warning: A component is changing an uncontrolled input to be controlled.',
'Material-UI: A component is changing the uncontrolled checked state of SwitchBase to be controlled.',
]);
});
@@ -414,7 +414,7 @@ describe('<SwitchBase />', () => {
setProps({ checked: undefined });
global['didWarnControlledToUncontrolled'] = true;
}).toErrorDev([
- 'Warning: A component is changing a controlled input of type checkbox to be uncontrolled.',
+ 'Warning: A component is changing a controlled input to be uncontrolled',
'Material-UI: A component is changing the controlled checked state of SwitchBase to be uncontrolled.',
]);
});
diff --git a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
index 20476d13cf..01dc0f8226 100644
--- a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
+++ b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
@@ -283,11 +283,7 @@ describe('useMediaQuery', () => {
expect(() => {
render(<MyComponent />);
- }).toErrorDev([
- 'Material-UI: The `query` argument provided is invalid',
- // logs warning twice in StrictMode
- 'Material-UI: The `query` argument provided is invalid',
- ]);
+ }).toErrorDev(['Material-UI: The `query` argument provided is invalid']);
});
});
});