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.
  • Loading branch information
gaearon authored Jul 14, 2016
1 parent f6d4293 commit 27d7592
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 27d7592

Please sign in to comment.