@samitouri / QOS-React / commits / 27d7592cf6

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.

Dan Abramov committed Jul 14, 2016 at 12:02 UTC 27d7592cf63253b318c9feac564c8ea2fe9d8383
1 file changed +5 -3
src/test/ReactTestUtils.js
+5 -3
@@ -410,9 +410,11 @@ NoopInternalComponent.prototype = {
410
411 var ShallowComponentWrapper = function(element) {
412 // TODO: Consolidate with instantiateReactComponent
413 - this._debugID = nextDebugID++;
414 - var displayName = element.type.displayName || element.type.name || 'Unknown';
415 - ReactInstrumentation.debugTool.onSetDisplayName(this._debugID, displayName);
413 + if (__DEV__) {
414 + this._debugID = nextDebugID++;
415 + var displayName = element.type.displayName || element.type.name || 'Unknown';
416 + ReactInstrumentation.debugTool.onSetDisplayName(this._debugID, displayName);
417 + }
418
419 this.construct(element);
420 };