Fix TestUtils crash with NODE_ENV=production (#7246)

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 27d7592cf6)
This commit is contained in:
Dan Abramov
2016-07-21 14:34:15 -07:00
committed by Paul O’Shannessy
parent 42d7d0adad
commit 8f8e215df1
+5 -3
View File
@@ -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);
};