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.
This commit is contained in:
Dan Abramov
2016-07-14 12:02:39 +01:00
committed by GitHub
parent f6d4293003
commit 27d7592cf6
+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);
};