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

Issue #2196 - Set console.warn and console.error to throw in tests #2297

Merged
merged 3 commits into from
Nov 21, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions scripts/jest.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,15 @@ import Adapter from 'enzyme-adapter-react-16';
global.console.info = jest.fn().mockImplementation(() => {})

configure({ adapter: new Adapter() });

/* Fail tests on PropType warnings
This allows us to throw an error in tests environments when there are prop-type warnings. This should keep the tests
free of warnings going forward.
*/

const throwError = message => {
throw new Error(message);
};

global.console.error = throwError;
global.console.warn = throwError;