Skip to content

Commit

Permalink
swallow errors instead
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Dec 21, 2020
1 parent 2a76768 commit 53dfc38
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
13 changes: 7 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "4.11.0",
"version": "4.11.1",
"private": true,
"scripts": {
"proptypes": "ts-node --skip-project ./scripts/generateProptypes.ts",
Expand Down Expand Up @@ -33,13 +33,13 @@
"size:why": "size-limit --why packages/material-ui/build/index.js",
"start": "yarn docs:dev",
"test": "yarn lint && yarn typescript && yarn test:coverage",
"test:coverage": "cross-env INTERNAL=true NODE_ENV=test BABEL_ENV=coverage nyc mocha 'packages/**/*.test.js' 'docs/**/*.test.js' --exclude '**/node_modules/**' && nyc report -r lcovonly",
"test:coverage:html": "cross-env INTERNAL=true NODE_ENV=test BABEL_ENV=coverage nyc mocha 'packages/**/**/*.test.js' --exclude '**/node_modules/**' && nyc report --reporter=html",
"test:karma": "cross-env INTERNAL=true NODE_ENV=test karma start test/karma.conf.js",
"test:coverage": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc mocha 'packages/**/*.test.js' 'docs/**/*.test.js' --exclude '**/node_modules/**' && nyc report -r lcovonly",
"test:coverage:html": "cross-env NODE_ENV=test BABEL_ENV=coverage nyc mocha 'packages/**/**/*.test.js' --exclude '**/node_modules/**' && nyc report --reporter=html",
"test:karma": "cross-env NODE_ENV=test karma start test/karma.conf.js",
"test:regressions": "yarn test:regressions:build && rimraf test/regressions/screenshots/chrome/* && vrtest run --config test/vrtest.config.js --record",
"test:regressions:build": "webpack --config test/regressions/webpack.config.js",
"test:umd": "node packages/material-ui/test/umd/run.js",
"test:unit": "cross-env INTERNAL=true NODE_ENV=test mocha 'packages/**/*.test.js' 'docs/**/*.test.js' 'scripts/**/*.test.js' --exclude '**/node_modules/**'",
"test:unit": "cross-env NODE_ENV=test mocha 'packages/**/*.test.js' 'docs/**/*.test.js' 'scripts/**/*.test.js' --exclude '**/node_modules/**'",
"test:watch": "yarn test:unit --watch",
"typescript": "lerna run --no-bail --parallel typescript"
},
Expand Down Expand Up @@ -165,7 +165,8 @@
"**/@babel/runtime": "^7.10.2",
"**/@babel/types": "^7.10.2",
"**/hoist-non-react-statics": "^3.3.2",
"**/next/terser": "^4.1.2"
"**/next/terser": "^4.1.2",
"**/react-is": "^16.13.1"
},
"nyc": {
"include": [
Expand Down
2 changes: 1 addition & 1 deletion packages/material-ui/src/RootRef/RootRef.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class RootRef extends React.Component {

render() {
if (process.env.NODE_ENV !== 'production') {
if (!warnedOnce && process.env.INTERNAL !== 'true') {
if (!warnedOnce) {
warnedOnce = true;
console.warn(
[
Expand Down
10 changes: 10 additions & 0 deletions packages/material-ui/src/RootRef/RootRef.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as React from 'react';
import PropTypes from 'prop-types';
import { expect } from 'chai';
import { spy } from 'sinon';
import { consoleWarnMock } from 'test/utils/consoleErrorMock';
import createMount from 'test/utils/createMount';
import RootRef from './RootRef';

Expand All @@ -11,6 +12,15 @@ describe('<RootRef />', () => {
// StrictModeViolation: uses findDOMNode
const mount = createMount({ strict: false });

beforeEach(() => {
PropTypes.resetWarningCache();
consoleWarnMock.spy();
});

afterEach(() => {
consoleWarnMock.reset();
});

it('call rootRef function on mount and unmount', () => {
const rootRef = spy();
const wrapper = mount(
Expand Down
1 change: 0 additions & 1 deletion test/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ module.exports = function setKarmaConfig(config) {
'process.env': {
NODE_ENV: JSON.stringify('test'),
CI: JSON.stringify(process.env.CI),
INTERNAL: JSON.stringify(process.env.INTERNAL),
},
}),
],
Expand Down

0 comments on commit 53dfc38

Please sign in to comment.