diff --git a/packages/react-dom/src/__tests__/ReactServerRendering-test.js b/packages/react-dom/src/__tests__/ReactServerRendering-test.js index a07a842b33..6524b06671 100644 --- a/packages/react-dom/src/__tests__/ReactServerRendering-test.js +++ b/packages/react-dom/src/__tests__/ReactServerRendering-test.js @@ -664,4 +664,60 @@ describe('ReactDOMServer', () => { require('react-dom'); }).not.toThrow(); }); + + it('includes a useful stack in warnings', () => { + function A() { + return null; + } + + function B() { + return ( + + + + + + ); + } + + class C extends React.Component { + render() { + return {this.props.children}; + } + } + + function Child() { + return [, , ]; + } + + function App() { + return ( +
+
+ + + +
+ ); + } + + expect(() => ReactDOMServer.renderToString()).toWarnDev([ + 'Invalid ARIA attribute `ariaTypo`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + + ' in span (at **)\n' + + ' in b (at **)\n' + + ' in C (at **)\n' + + ' in font (at **)\n' + + ' in B (at **)\n' + + ' in Child (at **)\n' + + ' in span (at **)\n' + + ' in div (at **)\n' + + ' in App (at **)', + 'Invalid ARIA attribute `ariaTypo2`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' + + ' in span (at **)\n' + + ' in Child (at **)\n' + + ' in span (at **)\n' + + ' in div (at **)\n' + + ' in App (at **)', + ]); + }); });