From 944ed1aaa591b4a5655e7cab8b1317fad9ecfe78 Mon Sep 17 00:00:00 2001 From: Rick Hanlon Date: Mon, 19 Jan 2026 12:55:23 -0500 Subject: [PATCH 1/4] [tests] remove withoutStack --- .../src/__tests__/ReactFlight-test.js | 146 ++++----- .../__tests__/ReactComponentLifeCycle-test.js | 16 - .../src/__tests__/ReactDOMFizzServer-test.js | 33 +-- .../src/__tests__/ReactDOMFloat-test.js | 25 +- .../src/__tests__/ReactDOMForm-test.js | 24 +- .../__tests__/ReactDOMFragmentRefs-test.js | 22 +- .../src/__tests__/ReactDOMRoot-test.js | 119 +++----- .../src/__tests__/ReactIdentity-test.js | 11 +- .../__tests__/ReactServerRendering-test.js | 34 +-- .../ReactServerRenderingHydration-test.js | 3 - .../src/__tests__/ReactUpdates-test.js | 44 +-- .../__tests__/ReactFabric-test.internal.js | 8 +- .../src/__tests__/ReactActWarnings-test.js | 136 ++++----- .../src/__tests__/ReactAsyncActions-test.js | 13 +- .../src/__tests__/ReactHooks-test.internal.js | 30 +- .../ReactHooksWithNoopRenderer-test.js | 19 +- .../src/__tests__/ReactMemo-test.js | 22 +- .../src/__tests__/ReactNewContext-test.js | 11 +- .../src/__tests__/ReactFlightDOMEdge-test.js | 18 +- .../src/__tests__/ReactTestRenderer-test.js | 17 +- .../ReactCoffeeScriptClass-test.coffee | 8 +- .../src/__tests__/ReactCreateElement-test.js | 45 +-- .../react/src/__tests__/ReactES6Class-test.js | 24 +- .../src/__tests__/ReactElementClone-test.js | 15 +- .../src/__tests__/ReactJSXRuntime-test.js | 47 ++- .../ReactJSXTransformIntegration-test.js | 13 +- .../ReactProfilerComponent-test.internal.js | 11 +- .../__tests__/ReactStartTransition-test.js | 26 +- .../src/__tests__/ReactStrictMode-test.js | 92 +++--- .../__tests__/ReactTypeScriptClass-test.ts | 24 +- .../createReactClassIntegration-test.js | 280 ++++++++---------- .../react/src/__tests__/forwardRef-test.js | 76 ++--- 32 files changed, 545 insertions(+), 867 deletions(-) diff --git a/packages/react-client/src/__tests__/ReactFlight-test.js b/packages/react-client/src/__tests__/ReactFlight-test.js index ab9bc654073..6b0bca21110 100644 --- a/packages/react-client/src/__tests__/ReactFlight-test.js +++ b/packages/react-client/src/__tests__/ReactFlight-test.js @@ -1515,16 +1515,13 @@ describe('ReactFlight', () => { }, }; const transport = ReactNoopFlightServer.render(); - assertConsoleErrorDev( - [ - 'Only plain objects can be passed to Client Components from Server Components. ' + - 'Objects with toJSON methods are not supported. ' + - 'Convert it manually to a simple value before passing it to props.\n' + - ' \n' + - ' ^^^^^^^^^^^^^^^', - ], - {withoutStack: true}, - ); + assertConsoleErrorDev([ + 'Only plain objects can be passed to Client Components from Server Components. ' + + 'Objects with toJSON methods are not supported. ' + + 'Convert it manually to a simple value before passing it to props.\n' + + ' \n' + + ' ^^^^^^^^^^^^^^^', + ]); ReactNoopFlightClient.read(transport); assertConsoleErrorDev([ @@ -1546,14 +1543,11 @@ describe('ReactFlight', () => { const transport = ReactNoopFlightServer.render(
Womp womp: {new MyError('spaghetti')}
, ); - assertConsoleErrorDev( - [ - 'Error objects cannot be rendered as text children. Try formatting it using toString().\n' + - '
Womp womp: {Error}
\n' + - ' ^^^^^^^', - ], - {withoutStack: true}, - ); + assertConsoleErrorDev([ + 'Error objects cannot be rendered as text children. Try formatting it using toString().\n' + + '
Womp womp: {Error}
\n' + + ' ^^^^^^^', + ]); ReactNoopFlightClient.read(transport); assertConsoleErrorDev([ @@ -1566,15 +1560,12 @@ describe('ReactFlight', () => { it('should warn in DEV if a special object is passed to a host component', () => { const transport = ReactNoopFlightServer.render(); - assertConsoleErrorDev( - [ - 'Only plain objects can be passed to Client Components from Server Components. ' + - 'Math objects are not supported.\n' + - ' \n' + - ' ^^^^^^', - ], - {withoutStack: true}, - ); + assertConsoleErrorDev([ + 'Only plain objects can be passed to Client Components from Server Components. ' + + 'Math objects are not supported.\n' + + ' \n' + + ' ^^^^^^', + ]); ReactNoopFlightClient.read(transport); assertConsoleErrorDev([ @@ -1590,15 +1581,12 @@ describe('ReactFlight', () => { const transport = ReactNoopFlightServer.render( , ); - assertConsoleErrorDev( - [ - 'Only plain objects can be passed to Client Components from Server Components. ' + - 'Objects with symbol properties like Symbol.iterator are not supported.\n' + - ' \n' + - ' ^^^^', - ], - {withoutStack: true}, - ); + assertConsoleErrorDev([ + 'Only plain objects can be passed to Client Components from Server Components. ' + + 'Objects with symbol properties like Symbol.iterator are not supported.\n' + + ' \n' + + ' ^^^^', + ]); ReactNoopFlightClient.read(transport); assertConsoleErrorDev([ @@ -1621,16 +1609,13 @@ describe('ReactFlight', () => { } const Client = clientReference(ClientImpl); const transport = ReactNoopFlightServer.render(); - assertConsoleErrorDev( - [ - 'Only plain objects can be passed to Client Components from Server Components. ' + - 'Objects with toJSON methods are not supported. ' + - 'Convert it manually to a simple value before passing it to props.\n' + - ' <... value={{toJSON: ...}}>\n' + - ' ^^^^^^^^^^^^^^^', - ], - {withoutStack: true}, - ); + assertConsoleErrorDev([ + 'Only plain objects can be passed to Client Components from Server Components. ' + + 'Objects with toJSON methods are not supported. ' + + 'Convert it manually to a simple value before passing it to props.\n' + + ' <... value={{toJSON: ...}}>\n' + + ' ^^^^^^^^^^^^^^^', + ]); ReactNoopFlightClient.read(transport); assertConsoleErrorDev([ @@ -1656,16 +1641,13 @@ describe('ReactFlight', () => { const transport = ReactNoopFlightServer.render( Current date: {obj}, ); - assertConsoleErrorDev( - [ - 'Only plain objects can be passed to Client Components from Server Components. ' + - 'Objects with toJSON methods are not supported. ' + - 'Convert it manually to a simple value before passing it to props.\n' + - ' <>Current date: {{toJSON: ...}}\n' + - ' ^^^^^^^^^^^^^^^', - ], - {withoutStack: true}, - ); + assertConsoleErrorDev([ + 'Only plain objects can be passed to Client Components from Server Components. ' + + 'Objects with toJSON methods are not supported. ' + + 'Convert it manually to a simple value before passing it to props.\n' + + ' <>Current date: {{toJSON: ...}}\n' + + ' ^^^^^^^^^^^^^^^', + ]); ReactNoopFlightClient.read(transport); assertConsoleErrorDev([ @@ -1684,15 +1666,12 @@ describe('ReactFlight', () => { } const Client = clientReference(ClientImpl); const transport = ReactNoopFlightServer.render(); - assertConsoleErrorDev( - [ - 'Only plain objects can be passed to Client Components from Server Components. ' + - 'Math objects are not supported.\n' + - ' <... value={Math}>\n' + - ' ^^^^^^', - ], - {withoutStack: true}, - ); + assertConsoleErrorDev([ + 'Only plain objects can be passed to Client Components from Server Components. ' + + 'Math objects are not supported.\n' + + ' <... value={Math}>\n' + + ' ^^^^^^', + ]); ReactNoopFlightClient.read(transport); assertConsoleErrorDev([ @@ -1713,15 +1692,12 @@ describe('ReactFlight', () => { const transport = ReactNoopFlightServer.render( , ); - assertConsoleErrorDev( - [ - 'Only plain objects can be passed to Client Components from Server Components. ' + - 'Objects with symbol properties like Symbol.iterator are not supported.\n' + - ' <... value={{}}>\n' + - ' ^^^^', - ], - {withoutStack: true}, - ); + assertConsoleErrorDev([ + 'Only plain objects can be passed to Client Components from Server Components. ' + + 'Objects with symbol properties like Symbol.iterator are not supported.\n' + + ' <... value={{}}>\n' + + ' ^^^^', + ]); ReactNoopFlightClient.read(transport); @@ -1745,13 +1721,10 @@ describe('ReactFlight', () => { ReactNoopFlightClient.read(transport); assertConsoleErrorDev([ - [ - 'Only plain objects can be passed to Client Components from Server Components. ' + - 'Objects with symbol properties like Symbol.iterator are not supported.\n' + - ' <... value={{}}>\n' + - ' ^^^^', - {withoutStack: true}, - ], + 'Only plain objects can be passed to Client Components from Server Components. ' + + 'Objects with symbol properties like Symbol.iterator are not supported.\n' + + ' <... value={{}}>\n' + + ' ^^^^', 'Only plain objects can be passed to Client Components from Server Components. ' + 'Objects with symbol properties like Symbol.iterator are not supported.\n' + ' <... value={{}}>\n' + @@ -1770,13 +1743,10 @@ describe('ReactFlight', () => { ); ReactNoopFlightClient.read(transport); assertConsoleErrorDev([ - [ - 'Only plain objects can be passed to Client Components from Server Components. ' + - 'Math objects are not supported.\n' + - ' [..., Math,

]\n' + - ' ^^^^', - {withoutStack: true}, - ], + 'Only plain objects can be passed to Client Components from Server Components. ' + + 'Math objects are not supported.\n' + + ' [..., Math,

]\n' + + ' ^^^^', 'Only plain objects can be passed to Client Components from Server Components. ' + 'Math objects are not supported.\n' + ' [..., Math,

]\n' + diff --git a/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js b/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js index f985d065976..a80f6d78038 100644 --- a/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js +++ b/packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js @@ -669,7 +669,6 @@ describe('ReactComponentLifeCycle', () => { 'you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\n' + 'Please update the following components: Component', ], - {withoutStack: true}, ); }); @@ -735,7 +734,6 @@ describe('ReactComponentLifeCycle', () => { 'you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\n' + 'Please update the following components: Component', ], - {withoutStack: true}, ); await act(() => { @@ -827,7 +825,6 @@ describe('ReactComponentLifeCycle', () => { 'you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\n' + 'Please update the following components: AllLegacyLifecycles', ], - {withoutStack: true}, ); class WillMount extends React.Component { @@ -887,7 +884,6 @@ describe('ReactComponentLifeCycle', () => { 'you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\n' + 'Please update the following components: WillMountAndUpdate', ], - {withoutStack: true}, ); class WillReceiveProps extends React.Component { @@ -925,9 +921,6 @@ describe('ReactComponentLifeCycle', () => { 'you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\n' + 'Please update the following components: WillReceiveProps', ], - { - withoutStack: true, - }, ); }); @@ -975,7 +968,6 @@ describe('ReactComponentLifeCycle', () => { 'you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\n' + 'Please update the following components: AllLegacyLifecycles', ], - {withoutStack: true}, ); class WillMount extends React.Component { @@ -1033,9 +1025,6 @@ describe('ReactComponentLifeCycle', () => { 'you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\n' + 'Please update the following components: WillMountAndUpdate', ], - { - withoutStack: true, - }, ); class WillReceiveProps extends React.Component { @@ -1072,9 +1061,6 @@ describe('ReactComponentLifeCycle', () => { 'you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\n' + 'Please update the following components: WillReceiveProps', ], - { - withoutStack: true, - }, ); }); @@ -1189,7 +1175,6 @@ describe('ReactComponentLifeCycle', () => { 'you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.\n\n' + 'Please update the following components: MyComponent', ], - {withoutStack: true}, ); expect(log).toEqual(['componentWillMount', 'UNSAFE_componentWillMount']); @@ -1510,7 +1495,6 @@ Please update the following components: MyComponent`, Please update the following components: MyComponent`, ], - {withoutStack: true}, ); // Dedupe check (update and instantiate new) diff --git a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js index bd0c6107f37..fd13b9cb505 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js @@ -3590,14 +3590,11 @@ describe('ReactDOMFizzServer', () => { onRecoverableError(error, errorInfo) { expect(error.digest).toBe('a digest'); expect(errorInfo.digest).toBe(undefined); - assertConsoleErrorDev( - [ - 'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' + - ' This property is no longer provided as part of errorInfo but can be accessed as a property' + - ' of the Error instance itself.', - ], - {withoutStack: true}, - ); + assertConsoleErrorDev([ + 'You are accessing "digest" from the errorInfo object passed to onRecoverableError.' + + ' This property is no longer provided as part of errorInfo but can be accessed as a property' + + ' of the Error instance itself.', + ]); }, }, ); @@ -7770,10 +7767,7 @@ describe('ReactDOMFizzServer', () => { , ); assertConsoleErrorDev([ - [ - 'Cannot render a outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this remove the `itemProp` prop. Otherwise, try moving this tag into the or of the Document.', - {withoutStack: true}, - ], + 'Cannot render a outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this remove the `itemProp` prop. Otherwise, try moving this tag into the or of the Document.', 'In HTML, cannot be a child of .\nThis will cause a hydration error.' + '\n' + '\n ' + @@ -7788,10 +7782,7 @@ describe('ReactDOMFizzServer', () => { ' cannot contain a nested .\nSee this log for the ancestor stack trace.' + '\n in html (at **)' + '\n in App (at **)', - [ - 'Cannot render a outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this remove the `itemProp` prop. Otherwise, try moving this tag into the or of the Document.', - {withoutStack: true}, - ], + 'Cannot render a outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this remove the `itemProp` prop. Otherwise, try moving this tag into the or of the Document.', ]); await root.unmount(); @@ -7886,10 +7877,7 @@ describe('ReactDOMFizzServer', () => { , ); assertConsoleErrorDev([ - [ - 'Cannot render a outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this remove the `itemProp` prop. Otherwise, try moving this tag into the or of the Document.', - {withoutStack: true}, - ], + 'Cannot render a outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this remove the `itemProp` prop. Otherwise, try moving this tag into the or of the Document.', 'In HTML, cannot be a child of .\nThis will cause a hydration error.' + '\n' + '\n ' + @@ -7904,10 +7892,7 @@ describe('ReactDOMFizzServer', () => { ' cannot contain a nested .\nSee this log for the ancestor stack trace.' + '\n in html (at **)' + '\n in App (at **)', - [ - 'Cannot render a outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this remove the `itemProp` prop. Otherwise, try moving this tag into the or of the Document.', - {withoutStack: true}, - ], + 'Cannot render a outside the main document if it has an `itemProp` prop. `itemProp` suggests the tag belongs to an `itemScope` which can appear anywhere in the DOM. If you were intending for React to hoist this remove the `itemProp` prop. Otherwise, try moving this tag into the or of the Document.', ]); await root.unmount(); diff --git a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js index ed3d3e08805..1766db2de8b 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js @@ -520,10 +520,7 @@ describe('ReactDOMFloat', () => { ); await waitForAll([]); assertConsoleErrorDev([ - [ - 'Cannot render