diff --git a/packages/material-ui-styles/src/styled/styled.test.js b/packages/material-ui-styles/src/styled/styled.test.js
index d4ed180c264e87..8bb780ca86143f 100644
--- a/packages/material-ui-styles/src/styled/styled.test.js
+++ b/packages/material-ui-styles/src/styled/styled.test.js
@@ -93,11 +93,11 @@ describe('styled', () => {
describe('warnings', () => {
beforeEach(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('warns if it cant detect the secondary action properly', () => {
diff --git a/packages/material-ui-styles/src/withStyles/withStyles.test.js b/packages/material-ui-styles/src/withStyles/withStyles.test.js
index e4661679c010ab..5b184c69289840 100644
--- a/packages/material-ui-styles/src/withStyles/withStyles.test.js
+++ b/packages/material-ui-styles/src/withStyles/withStyles.test.js
@@ -73,11 +73,11 @@ describe('withStyles', () => {
// describe('innerRef', () => {
// beforeEach(() => {
// consoleErrorMock.spy();
+ // PropTypes.resetWarningCache();
// });
// afterEach(() => {
// consoleErrorMock.reset();
- // PropTypes.resetWarningCache();
// });
// it('is deprecated', () => {
diff --git a/packages/material-ui-styles/src/withTheme/withTheme.test.js b/packages/material-ui-styles/src/withTheme/withTheme.test.js
index ac2b6ca80d1b23..3db049a30ebd79 100644
--- a/packages/material-ui-styles/src/withTheme/withTheme.test.js
+++ b/packages/material-ui-styles/src/withTheme/withTheme.test.js
@@ -85,11 +85,11 @@ describe('withTheme', () => {
describe('innerRef', () => {
beforeEach(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('is deprecated', () => {
diff --git a/packages/material-ui-utils/src/elementAcceptingRef.test.js b/packages/material-ui-utils/src/elementAcceptingRef.test.js
index eda11c8766d874..99e799ab47672d 100644
--- a/packages/material-ui-utils/src/elementAcceptingRef.test.js
+++ b/packages/material-ui-utils/src/elementAcceptingRef.test.js
@@ -29,11 +29,11 @@ describe('elementAcceptingRef', () => {
beforeEach(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
describe('acceptance when not required', () => {
diff --git a/packages/material-ui-utils/src/elementTypeAcceptingRef.test.js b/packages/material-ui-utils/src/elementTypeAcceptingRef.test.js
index 7364243687aa9f..632fb43d3b2aca 100644
--- a/packages/material-ui-utils/src/elementTypeAcceptingRef.test.js
+++ b/packages/material-ui-utils/src/elementTypeAcceptingRef.test.js
@@ -29,11 +29,11 @@ describe('elementTypeAcceptingRef', () => {
beforeEach(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
describe('acceptance', () => {
diff --git a/packages/material-ui/src/ButtonBase/ButtonBase.test.js b/packages/material-ui/src/ButtonBase/ButtonBase.test.js
index 54f17da9c2d874..268a5ebbf45cc1 100644
--- a/packages/material-ui/src/ButtonBase/ButtonBase.test.js
+++ b/packages/material-ui/src/ButtonBase/ButtonBase.test.js
@@ -908,11 +908,11 @@ describe('', () => {
describe('warnings', () => {
beforeEach(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('warns on invalid `component` prop: ref forward', () => {
diff --git a/packages/material-ui/src/CardMedia/CardMedia.test.js b/packages/material-ui/src/CardMedia/CardMedia.test.js
index faeee4ee192012..910653f5ae06d6 100644
--- a/packages/material-ui/src/CardMedia/CardMedia.test.js
+++ b/packages/material-ui/src/CardMedia/CardMedia.test.js
@@ -84,11 +84,11 @@ describe('', () => {
describe('warnings', () => {
before(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
after(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('warns when neither `children`, nor `image`, nor `src`, nor `component` are provided', () => {
diff --git a/packages/material-ui/src/ExpansionPanel/ExpansionPanel.test.js b/packages/material-ui/src/ExpansionPanel/ExpansionPanel.test.js
index 39f46a608dfb0a..9e48b9eec0530b 100644
--- a/packages/material-ui/src/ExpansionPanel/ExpansionPanel.test.js
+++ b/packages/material-ui/src/ExpansionPanel/ExpansionPanel.test.js
@@ -137,11 +137,11 @@ describe('', () => {
describe('first child', () => {
beforeEach(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('requires at least one child', () => {
diff --git a/packages/material-ui/src/GridList/GridList.test.js b/packages/material-ui/src/GridList/GridList.test.js
index 077a31fc602fe5..751610999f55db 100644
--- a/packages/material-ui/src/GridList/GridList.test.js
+++ b/packages/material-ui/src/GridList/GridList.test.js
@@ -4,7 +4,6 @@ import { createMount, createShallow, getClasses } from '@material-ui/core/test-u
import describeConformance from '../test-utils/describeConformance';
import GridList from './GridList';
import consoleErrorMock from 'test/utils/consoleErrorMock';
-import PropTypes from 'prop-types';
const tilesData = [
{
@@ -181,7 +180,6 @@ describe('', () => {
after(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('warns a Fragment is passed as a child', () => {
diff --git a/packages/material-ui/src/IconButton/IconButton.test.js b/packages/material-ui/src/IconButton/IconButton.test.js
index 678b88536adab7..abc8fe411c2758 100644
--- a/packages/material-ui/src/IconButton/IconButton.test.js
+++ b/packages/material-ui/src/IconButton/IconButton.test.js
@@ -128,11 +128,11 @@ describe('', () => {
describe('Firefox onClick', () => {
beforeEach(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('should raise a warning', () => {
diff --git a/packages/material-ui/src/ListItem/ListItem.test.js b/packages/material-ui/src/ListItem/ListItem.test.js
index 2a538f8365bdcf..56a7629c0f9cac 100644
--- a/packages/material-ui/src/ListItem/ListItem.test.js
+++ b/packages/material-ui/src/ListItem/ListItem.test.js
@@ -142,11 +142,11 @@ describe('', () => {
describe('warnings', () => {
beforeEach(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('warns if it cant detect the secondary action properly', () => {
diff --git a/packages/material-ui/src/Menu/Menu.test.js b/packages/material-ui/src/Menu/Menu.test.js
index 8770b2739d06a9..b9417ae305c3f1 100644
--- a/packages/material-ui/src/Menu/Menu.test.js
+++ b/packages/material-ui/src/Menu/Menu.test.js
@@ -7,7 +7,6 @@ import Popover from '../Popover';
import Menu from './Menu';
import MenuList from '../MenuList';
import consoleErrorMock from 'test/utils/consoleErrorMock';
-import PropTypes from 'prop-types';
const MENU_LIST_HEIGHT = 100;
@@ -233,7 +232,6 @@ describe('
', () => {
after(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('warns a Fragment is passed as a child', () => {
diff --git a/packages/material-ui/src/Popover/Popover.test.js b/packages/material-ui/src/Popover/Popover.test.js
index d1ce49410df7de..644c8476333312 100644
--- a/packages/material-ui/src/Popover/Popover.test.js
+++ b/packages/material-ui/src/Popover/Popover.test.js
@@ -1,7 +1,6 @@
import * as React from 'react';
import { assert, expect } from 'chai';
import { spy, stub, useFakeTimers } from 'sinon';
-import PropTypes from 'prop-types';
import { createMount, findOutermostIntrinsic, getClasses } from '@material-ui/core/test-utils';
import describeConformance from '../test-utils/describeConformance';
import consoleErrorMock from 'test/utils/consoleErrorMock';
@@ -461,7 +460,6 @@ describe('', () => {
describe('warnings', () => {
beforeEach(() => {
consoleErrorMock.spy();
- PropTypes.resetWarningCache();
});
afterEach(() => {
diff --git a/packages/material-ui/src/Slider/Slider.test.js b/packages/material-ui/src/Slider/Slider.test.js
index 689af184aa12be..166932bcce3305 100644
--- a/packages/material-ui/src/Slider/Slider.test.js
+++ b/packages/material-ui/src/Slider/Slider.test.js
@@ -489,11 +489,11 @@ describe('', () => {
describe('warnings', () => {
beforeEach(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('should warn if aria-valuetext is provided', () => {
diff --git a/packages/material-ui/src/TablePagination/TablePagination.test.js b/packages/material-ui/src/TablePagination/TablePagination.test.js
index 7dc3580765b5b6..53aea58e1cf07e 100644
--- a/packages/material-ui/src/TablePagination/TablePagination.test.js
+++ b/packages/material-ui/src/TablePagination/TablePagination.test.js
@@ -280,15 +280,14 @@ describe('', () => {
describe('warnings', () => {
before(() => {
consoleErrorMock.spy();
+ PropTypes.resetWarningCache();
});
after(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('should raise a warning if the page prop is out of range', () => {
- assert.strictEqual(consoleErrorMock.callCount(), 0);
mount(
@@ -304,6 +303,7 @@ describe('', () => {
,
);
+
assert.strictEqual(consoleErrorMock.callCount(), 1);
assert.include(
consoleErrorMock.messages()[0],
diff --git a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
index 8242bc58ffdbd3..8593fd3bc2ce56 100644
--- a/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
+++ b/packages/material-ui/src/useMediaQuery/useMediaQuery.test.js
@@ -275,7 +275,6 @@ describe('useMediaQuery', () => {
afterEach(() => {
consoleErrorMock.reset();
- PropTypes.resetWarningCache();
});
it('warns on invalid `query` argument', () => {
@@ -285,7 +284,10 @@ describe('useMediaQuery', () => {
}
render();
+ // logs warning twice in StrictMode
+ expect(consoleErrorMock.callCount()).to.equal(2);
expect(consoleErrorMock.messages()[0]).to.include('the `query` argument provided is invalid');
+ expect(consoleErrorMock.messages()[1]).to.include('the `query` argument provided is invalid');
});
});
});