File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -13,8 +13,21 @@ if (process.env.REACT_CLASS_EQUIVALENCE_TEST) {
1313 // https://github.com/facebook/jest/blob/v20.0.4/packages/jest-matchers/src/spyMatchers.js#L160
1414 const isSpy = spy => spy . calls && typeof spy . calls . count === 'function' ;
1515
16- const spyOn = global . spyOn ;
16+ // This is the Jasmine spyOn() method.
17+ // Unlike jest.spyOn(), it does not pass through to the method it spies on by default.
18+ const jasmineSpyOn = global . spyOn ;
19+
1720 const noop = function ( ) { } ;
21+ const spyOn = function ( object , methodName ) {
22+ if ( object === console ) {
23+ throw new Error (
24+ 'Do not spy on the console directly. ' +
25+ 'Use toWarnDev() or toLowPriorityWarnDev() instead.'
26+ ) ;
27+ }
28+
29+ jasmineSpyOn ( object , methodName ) ;
30+ } ;
1831
1932 // Spying on console methods in production builds can mask errors.
2033 // This is why we added an explicit spyOnDev() helper.
You can’t perform that action at this time.
0 commit comments