Skip to content

Commit

Permalink
Replaced console.error() in test utils with warning()
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian Vaughn committed Apr 6, 2017
1 parent 714e5ea commit 4f5aa2e
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/test/ReactTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var ReactShallowRenderer = require('ReactShallowRenderer');

var findDOMNode = require('findDOMNode');
var invariant = require('invariant');
var warning = require('warning');

var topLevelTypes = EventConstants.topLevelTypes;

Expand All @@ -36,13 +37,13 @@ function Event(suffix) {}
// Maintain backwards compat for 15.5.0 release, but warn about using the deprecated method
let hasWarnedAboutCreateRenderer = false;
function createRendererWithWarning() {
if (!hasWarnedAboutCreateRenderer) {
hasWarnedAboutCreateRenderer = true;
console.error(
'Shallow renderer has been moved to react-test-renderer/shallow. ' +
'Update references to remove this warning.'
);
}
warning(
hasWarnedAboutCreateRenderer,
'Shallow renderer has been moved to react-test-renderer/shallow. ' +
'Update references to remove this warning.'
);
hasWarnedAboutCreateRenderer = true;

return new ReactShallowRenderer();
}

Expand Down

0 comments on commit 4f5aa2e

Please sign in to comment.