diff --git a/packages/react-dom-bindings/src/client/validateDOMNesting.js b/packages/react-dom-bindings/src/client/validateDOMNesting.js index 85e6b69bfa4ce..f910455f008be 100644 --- a/packages/react-dom-bindings/src/client/validateDOMNesting.js +++ b/packages/react-dom-bindings/src/client/validateDOMNesting.js @@ -477,15 +477,14 @@ function validateDOMNesting( 'the browser.'; } console.error( - 'validateDOMNesting(...): %s cannot appear as a child of <%s>.%s', + '%s cannot appear as a child of <%s>.%s', tagDisplayName, ancestorTag, info, ); } else { console.error( - 'validateDOMNesting(...): %s cannot appear as a descendant of ' + - '<%s>.', + '%s cannot appear as a descendant of ' + '<%s>.', tagDisplayName, ancestorTag, ); @@ -507,13 +506,10 @@ function validateTextNesting(childText: string, parentTag: string): void { didWarn[warnKey] = true; if (/\S/.test(childText)) { - console.error( - 'validateDOMNesting(...): Text nodes cannot appear as a child of <%s>.', - parentTag, - ); + console.error('Text nodes cannot appear as a child of <%s>.', parentTag); } else { console.error( - 'validateDOMNesting(...): Whitespace text nodes cannot appear as a child of <%s>. ' + + 'Whitespace text nodes cannot appear as a child of <%s>. ' + "Make sure you don't have any extra whitespace between tags on " + 'each line of your source code.', parentTag, diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js index b3ec748d92ffb..42d7b3133d36e 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js @@ -879,7 +879,7 @@ describe('ReactCompositeComponent', () => { root.render(); }); }).toErrorDev( - 'Foo(...): When calling super() in `Foo`, make sure to pass ' + + 'When calling super() in `Foo`, make sure to pass ' + "up the same props that your component's constructor was passed.", ); }); @@ -1233,14 +1233,14 @@ describe('ReactCompositeComponent', () => { }).toErrorDev([ // Expect two errors because invokeGuardedCallback will dispatch an error event, // Causing the warning to be logged again. - 'Warning: RenderTextInvalidConstructor(...): No `render` method found on the returned component instance: ' + + 'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' + 'did you accidentally return an object from the constructor?', - 'Warning: RenderTextInvalidConstructor(...): No `render` method found on the returned component instance: ' + + 'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' + 'did you accidentally return an object from the constructor?', // And then two more because we retry errors. - 'Warning: RenderTextInvalidConstructor(...): No `render` method found on the returned component instance: ' + + 'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' + 'did you accidentally return an object from the constructor?', - 'Warning: RenderTextInvalidConstructor(...): No `render` method found on the returned component instance: ' + + 'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' + 'did you accidentally return an object from the constructor?', ]); }); @@ -1280,16 +1280,16 @@ describe('ReactCompositeComponent', () => { }).toErrorDev([ // Expect two errors because invokeGuardedCallback will dispatch an error event, // Causing the warning to be logged again. - 'Warning: RenderTestUndefinedRender(...): No `render` method found on the returned ' + - 'component instance: you may have forgotten to define `render`.', - 'Warning: RenderTestUndefinedRender(...): No `render` method found on the returned ' + - 'component instance: you may have forgotten to define `render`.', + 'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' + + 'you may have forgotten to define `render`.', + 'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' + + 'you may have forgotten to define `render`.', // And then two more because we retry errors. - 'Warning: RenderTestUndefinedRender(...): No `render` method found on the returned ' + - 'component instance: you may have forgotten to define `render`.', - 'Warning: RenderTestUndefinedRender(...): No `render` method found on the returned ' + - 'component instance: you may have forgotten to define `render`.', + 'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' + + 'you may have forgotten to define `render`.', + 'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' + + 'you may have forgotten to define `render`.', ]); }); diff --git a/packages/react-dom/src/__tests__/ReactDOM-test.js b/packages/react-dom/src/__tests__/ReactDOM-test.js index 169e82a2cf5ae..a6bd2b80f3f7b 100644 --- a/packages/react-dom/src/__tests__/ReactDOM-test.js +++ b/packages/react-dom/src/__tests__/ReactDOM-test.js @@ -183,7 +183,7 @@ describe('ReactDOM', () => { expect(() => { ReactDOM.render(, myDiv, 'no'); }).toErrorDev( - 'render(...): Expected the last optional `callback` argument to be ' + + 'Expected the last optional `callback` argument to be ' + 'a function. Instead received: no.', ); }).toThrowError( @@ -195,7 +195,7 @@ describe('ReactDOM', () => { expect(() => { ReactDOM.render(, myDiv, {foo: 'bar'}); }).toErrorDev( - 'render(...): Expected the last optional `callback` argument to be ' + + 'Expected the last optional `callback` argument to be ' + 'a function. Instead received: [object Object].', ); }).toThrowError( @@ -207,7 +207,7 @@ describe('ReactDOM', () => { expect(() => { ReactDOM.render(, myDiv, new Foo()); }).toErrorDev( - 'render(...): Expected the last optional `callback` argument to be ' + + 'Expected the last optional `callback` argument to be ' + 'a function. Instead received: [object Object].', ); }).toThrowError( @@ -236,7 +236,7 @@ describe('ReactDOM', () => { expect(() => { ReactDOM.render(, myDiv, 'no'); }).toErrorDev( - 'render(...): Expected the last optional `callback` argument to be ' + + 'Expected the last optional `callback` argument to be ' + 'a function. Instead received: no.', ); }).toThrowError( @@ -249,7 +249,7 @@ describe('ReactDOM', () => { expect(() => { ReactDOM.render(, myDiv, {foo: 'bar'}); }).toErrorDev( - 'render(...): Expected the last optional `callback` argument to be ' + + 'Expected the last optional `callback` argument to be ' + 'a function. Instead received: [object Object].', ); }).toThrowError( @@ -262,7 +262,7 @@ describe('ReactDOM', () => { expect(() => { ReactDOM.render(, myDiv, new Foo()); }).toErrorDev( - 'render(...): Expected the last optional `callback` argument to be ' + + 'Expected the last optional `callback` argument to be ' + 'a function. Instead received: [object Object].', ); }).toThrowError( diff --git a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js index 65c6dfa182a3a..53ad186761b74 100644 --- a/packages/react-dom/src/__tests__/ReactDOMComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMComponent-test.js @@ -2188,7 +2188,7 @@ describe('ReactDOMComponent', () => { ); }); }).toErrorDev([ - 'Warning: validateDOMNesting(...): cannot appear as a child of ' + + 'Warning: cannot appear as a child of ' + '
.' + '\n in tr (at **)' + '\n in div (at **)', @@ -2208,7 +2208,7 @@ describe('ReactDOMComponent', () => { ); }); }).toErrorDev( - 'Warning: validateDOMNesting(...):

cannot appear as a descendant ' + + 'Warning:

cannot appear as a descendant ' + 'of

.' + // There is no outer `p` here because root container is not part of the stack. '\n in p (at **)' + @@ -2241,20 +2241,20 @@ describe('ReactDOMComponent', () => { root.render(); }); }).toErrorDev([ - 'Warning: validateDOMNesting(...): cannot appear as a child of ' + + 'Warning: cannot appear as a child of ' + '. Add a , or to your code to match the DOM tree generated ' + 'by the browser.' + '\n in tr (at **)' + '\n in Row (at **)' + '\n in table (at **)' + '\n in Foo (at **)', - 'Warning: validateDOMNesting(...): Text nodes cannot appear as a ' + + 'Warning: Text nodes cannot appear as a ' + 'child of .' + '\n in tr (at **)' + '\n in Row (at **)' + '\n in table (at **)' + '\n in Foo (at **)', - 'Warning: validateDOMNesting(...): Whitespace text nodes cannot ' + + 'Warning: Whitespace text nodes cannot ' + "appear as a child of
. Make sure you don't have any extra " + 'whitespace between tags on each line of your source code.' + '\n in table (at **)' + @@ -2283,7 +2283,7 @@ describe('ReactDOMComponent', () => { root.render( ); }); }).toErrorDev([ - 'Warning: validateDOMNesting(...): Whitespace text nodes cannot ' + + 'Warning: Whitespace text nodes cannot ' + "appear as a child of
. Make sure you don't have any extra " + 'whitespace between tags on each line of your source code.' + '\n in table (at **)' + @@ -2311,7 +2311,7 @@ describe('ReactDOMComponent', () => { ); }); }).toErrorDev([ - 'Warning: validateDOMNesting(...): Text nodes cannot appear as a ' + + 'Warning: Text nodes cannot appear as a ' + 'child of .' + '\n in tr (at **)' + '\n in Row (at **)' + diff --git a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js index eaad571ad9759..64f79140917c8 100644 --- a/packages/react-dom/src/__tests__/ReactDOMFloat-test.js +++ b/packages/react-dom/src/__tests__/ReactDOMFloat-test.js @@ -523,7 +523,7 @@ describe('ReactDOMFloat', () => { }).toErrorDev( [ 'Cannot render