Skip to content

Commit

Permalink
Issue #2196 - Set console.warn and console.error to throw in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dangreenisrael committed Nov 12, 2017
1 parent 3f8bb8d commit 7c7773c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/jest.init.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,15 @@ import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

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;

0 comments on commit 7c7773c

Please sign in to comment.