Skip to content

Commit 27d7592

Browse files
authored
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.
1 parent f6d4293 commit 27d7592

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/test/ReactTestUtils.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -410,9 +410,11 @@ NoopInternalComponent.prototype = {
410410

411411
var ShallowComponentWrapper = function(element) {
412412
// 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+
}
416418

417419
this.construct(element);
418420
};

0 commit comments

Comments
 (0)