Skip to content

Commit

Permalink
Fix TestUtils crash with NODE_ENV=production (#7246)
Browse files Browse the repository at this point in the history
I caused it with #7189.
We generally don’t recommend running TestUtils in production environment but this is technically a regression.

Fixes #7231.
(cherry picked from commit 27d7592)
  • Loading branch information
gaearon authored and zpao committed Jul 21, 2016
1 parent 42d7d0a commit 8f8e215
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/test/ReactTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -410,9 +410,11 @@ NoopInternalComponent.prototype = {

var ShallowComponentWrapper = function(element) {
// TODO: Consolidate with instantiateReactComponent
this._debugID = nextDebugID++;
var displayName = element.type.displayName || element.type.name || 'Unknown';
ReactInstrumentation.debugTool.onSetDisplayName(this._debugID, displayName);
if (__DEV__) {
this._debugID = nextDebugID++;
var displayName = element.type.displayName || element.type.name || 'Unknown';
ReactInstrumentation.debugTool.onSetDisplayName(this._debugID, displayName);
}

this.construct(element);
};
Expand Down

0 comments on commit 8f8e215

Please sign in to comment.