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',