Skip to content

Commit

Permalink
Merge pull request facebook#6432 from zpao/testutilsinlinerequiresinject
Browse files Browse the repository at this point in the history
Ensure default injection is injected for test utils
  • Loading branch information
zpao committed Apr 7, 2016
2 parents e19353c + 95cd88d commit 411951d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/test/ReactTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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',
Expand Down

0 comments on commit 411951d

Please sign in to comment.