From 95cd88d07adfff0611f941e5f35d7afc65caaf5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Paul=20O=E2=80=99Shannessy?= Date: Wed, 6 Apr 2016 17:39:47 -0700 Subject: [PATCH] Ensure default injection is injected for test utils --- src/test/ReactTestUtils.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/test/ReactTestUtils.js b/src/test/ReactTestUtils.js index 8cc08615eea85..d1365b50c541a 100644 --- a/src/test/ReactTestUtils.js +++ b/src/test/ReactTestUtils.js @@ -16,6 +16,7 @@ var EventPluginHub = require('EventPluginHub'); var EventPluginRegistry = require('EventPluginRegistry'); var EventPropagators = require('EventPropagators'); var React = require('React'); +var ReactDefaultInjection = require('ReactDefaultInjection'); var ReactDOM = require('ReactDOM'); var ReactDOMComponentTree = require('ReactDOMComponentTree'); var ReactElement = require('ReactElement'); @@ -409,6 +410,11 @@ Object.assign( ); ReactShallowRenderer.prototype.render = function(element, context) { + // Ensure we've done the default injections. This might not be true in the + // case of a simple test that only requires React and the TestUtils in + // conjunction with an inline-requires transform. + ReactDefaultInjection.inject(); + invariant( ReactElement.isValidElement(element), 'ReactShallowRenderer render(): Invalid component element.%s',