From 7efd2e58d0dad05e6637eea9fd83bb0e75dc11e9 Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Thu, 15 Jun 2017 01:24:04 +0100 Subject: [PATCH] Fix tests on CI to account for prop-types change --- .../types/__tests__/ReactPropTypes-test.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js b/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js index 092d2b6f855c3..c12cc1c29fa7b 100644 --- a/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js +++ b/src/isomorphic/classic/types/__tests__/ReactPropTypes-test.js @@ -89,7 +89,17 @@ function typeCheckPass(declaration, value) { expect(error).toBe(null); } +function resetWarningCache() { + jest.resetModules(); + PropTypes = require('ReactPropTypes'); + React = require('React'); + ReactFragment = require('ReactFragment'); + ReactTestUtils = require('ReactTestUtils'); + ReactPropTypesSecret = require('ReactPropTypesSecret'); +} + function expectWarningInDevelopment(declaration, value) { + resetWarningCache(); var props = {testProp: value}; var propName = 'testProp' + Math.random().toString(); var componentName = 'testComponent' + Math.random().toString(); @@ -105,11 +115,7 @@ function expectWarningInDevelopment(declaration, value) { describe('ReactPropTypes', () => { beforeEach(() => { - PropTypes = require('ReactPropTypes'); - React = require('React'); - ReactFragment = require('ReactFragment'); - ReactTestUtils = require('ReactTestUtils'); - ReactPropTypesSecret = require('ReactPropTypesSecret'); + resetWarningCache(); }); describe('Primitive Types', () => {