diff --git a/packages/react-dom/src/__tests__/ReactServerRendering-test.js b/packages/react-dom/src/__tests__/ReactServerRendering-test.js index d2590e21f7d28..ab200d10517f7 100644 --- a/packages/react-dom/src/__tests__/ReactServerRendering-test.js +++ b/packages/react-dom/src/__tests__/ReactServerRendering-test.js @@ -580,16 +580,28 @@ describe('ReactDOMServer', () => { describe('renderToStaticNodeStream', () => { it('should generate simple markup', () => { const SuccessfulElement = React.createElement(() => ); - const response = - ReactDOMServer.renderToStaticNodeStream(SuccessfulElement); - expect(response.read().toString()).toMatch(new RegExp('')); + expect(() => { + const response = + ReactDOMServer.renderToStaticNodeStream(SuccessfulElement); + expect(response.read().toString()).toMatch(new RegExp('')); + }).toErrorDev( + 'ReactDOMServer.renderToStaticNodeStream() is deprecated and will be removed in an upcomingrelease of React', + {withoutStack: true}, + ); }); it('should handle errors correctly', () => { const FailingElement = React.createElement(() => { throw new Error('An Error'); }); - const response = ReactDOMServer.renderToStaticNodeStream(FailingElement); + + let response; + expect(() => { + response = ReactDOMServer.renderToStaticNodeStream(FailingElement); + }).toErrorDev( + 'ReactDOMServer.renderToStaticNodeStream() is deprecated and will be removed in an upcomingrelease of React', + {withoutStack: true}, + ); return new Promise(resolve => { response.once('error', () => { resolve(); @@ -614,12 +626,18 @@ describe('ReactDOMServer', () => { throw promise; } - const response = ReactDOMServer.renderToStaticNodeStream( -