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 7e24728
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 6 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
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
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
9 changes: 9 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,14 @@ describe('<RootRef />', () => {
// StrictModeViolation: uses findDOMNode
const mount = createMount({ strict: false });

beforeEach(() => {
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 7e24728

Please sign in to comment.