@samitouri / QOS-React / commits / 73ca89408b

Updated PropTypes test to work with newer prop-types version (#9471)

The prop-types lib got an anti-spamming change in 15.5.8 that broke some of our tests (see reactjs/prop-types/commit/e1d51dd0efbd0eee5e4a8d24759f2a4d518721d3). This PR resolves that by resetting the prop-types import between tests.

Brian Vaughn committed Apr 20, 2017 at 12:48 UTC 73ca89408b8b2fc14977bb49ece24a679ab50222
1 file changed +2 -1
src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js
+2 -1
@@ -22,6 +22,7 @@ var MyComponent;
22 function resetWarningCache() {
23 jest.resetModules();
24 checkPropTypes = require('prop-types/checkPropTypes');
25 + PropTypes = require('ReactPropTypes');
26 }
27
28 function getPropTypeWarningMessage(propTypes, object, componentName) {
@@ -99,6 +100,7 @@ function expectWarningInDevelopment(declaration, value) {
100 var props = {testProp: value};
101 var propName = 'testProp' + Math.random().toString();
102 var componentName = 'testComponent' + Math.random().toString();
103 + resetWarningCache();
104 for (var i = 0; i < 3; i++) {
105 declaration(props, propName, componentName, 'prop');
106 }
@@ -111,7 +113,6 @@ function expectWarningInDevelopment(declaration, value) {
113
114 describe('ReactPropTypes', () => {
115 beforeEach(() => {
114 - PropTypes = require('ReactPropTypes');
116 React = require('react');
117 ReactDOM = require('react-dom');
118 resetWarningCache();