diff --git a/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js b/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js index 4111321990000..26e1c7217905d 100644 --- a/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js +++ b/src/isomorphic/classic/element/__tests__/ReactElementValidator-test.js @@ -526,7 +526,7 @@ describe('ReactElementValidator', () => { ); }); - it('provides stack via non-standard console.stack for invalid types', () => { + it('provides stack via non-standard console.reactStack for invalid types', () => { spyOn(console, 'error'); function Foo() { @@ -539,8 +539,8 @@ describe('ReactElementValidator', () => { } try { - console.stack = jest.fn(); - console.stackEnd = jest.fn(); + console.reactStack = jest.fn(); + console.reactStackEnd = jest.fn(); expect(() => { ReactTestUtils.renderIntoDocument(React.createElement(App)); @@ -551,10 +551,10 @@ describe('ReactElementValidator', () => { 'defined in. Check the render method of `Foo`.', ); - expect(console.stack.mock.calls.length).toBe(1); - expect(console.stackEnd.mock.calls.length).toBe(1); + expect(console.reactStack.mock.calls.length).toBe(1); + expect(console.reactStackEnd.mock.calls.length).toBe(1); - var stack = console.stack.mock.calls[0][0]; + var stack = console.reactStack.mock.calls[0][0]; expect(Array.isArray(stack)).toBe(true); expect(stack.map(frame => frame.name)).toEqual([ 'Foo', // is inside Foo @@ -572,8 +572,8 @@ describe('ReactElementValidator', () => { null, ]); } finally { - delete console.stack; - delete console.stackEnd; + delete console.reactStack; + delete console.reactStackEnd; } }); }); diff --git a/src/isomorphic/hooks/ReactComponentTreeHook.js b/src/isomorphic/hooks/ReactComponentTreeHook.js index d772c51197a5f..6ff41657ab090 100644 --- a/src/isomorphic/hooks/ReactComponentTreeHook.js +++ b/src/isomorphic/hooks/ReactComponentTreeHook.js @@ -407,7 +407,7 @@ var ReactComponentTreeHook = { isCreatingElement: boolean, currentSource: ?Source, ) { - if (typeof console.stack !== 'function') { + if (typeof console.reactStack !== 'function') { return; } @@ -444,14 +444,14 @@ var ReactComponentTreeHook = { // Stop building the stack (it's just a nice to have). } - console.stack(stack); + console.reactStack(stack); }, popNonStandardWarningStack() { - if (typeof console.stackEnd !== 'function') { + if (typeof console.reactStackEnd !== 'function') { return; } - console.stackEnd(); + console.reactStackEnd(); }, }; diff --git a/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js b/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js index f6a97b5f1ea68..0502161aad8e6 100644 --- a/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js +++ b/src/isomorphic/modern/element/__tests__/ReactJSXElementValidator-test.js @@ -401,7 +401,7 @@ describe('ReactJSXElementValidator', () => { ); }); - it('provides stack via non-standard console.stack for invalid types', () => { + it('provides stack via non-standard console.reactStack for invalid types', () => { spyOn(console, 'error'); function Foo() { @@ -414,8 +414,8 @@ describe('ReactJSXElementValidator', () => { } try { - console.stack = jest.fn(); - console.stackEnd = jest.fn(); + console.reactStack = jest.fn(); + console.reactStackEnd = jest.fn(); expect(() => { ReactTestUtils.renderIntoDocument(); @@ -426,10 +426,10 @@ describe('ReactJSXElementValidator', () => { 'defined in. Check the render method of `Foo`.', ); - expect(console.stack.mock.calls.length).toBe(1); - expect(console.stackEnd.mock.calls.length).toBe(1); + expect(console.reactStack.mock.calls.length).toBe(1); + expect(console.reactStackEnd.mock.calls.length).toBe(1); - var stack = console.stack.mock.calls[0][0]; + var stack = console.reactStack.mock.calls[0][0]; expect(Array.isArray(stack)).toBe(true); expect(stack.map(frame => frame.name)).toEqual([ 'Foo', // is inside Foo @@ -447,8 +447,8 @@ describe('ReactJSXElementValidator', () => { 'number', ]); } finally { - delete console.stack; - delete console.stackEnd; + delete console.reactStack; + delete console.reactStackEnd; } }); });