@samitouri / QOS-React-2 / commits / 2774208039

Remove Warning: prefix and toString on console Arguments (#29839)

Basically make `console.error` and `console.warn` behave like normal - when a component stack isn't appended. I need this because I need to be able to print rich logs with the component stack option and to be able to disable instrumentation completely in `console.createTask` environments that don't need it. Currently we can't print logs with richer objects because they're toString:ed first. In practice, pretty much all arguments we log are already toString:ed so it's not necessary anyway. Some might be like a number. So it would only be a problem if some environment can't handle proper consoles but then it's up to that environment to toString it before logging. The `Warning: ` prefix is historic and is both noisy and confusing. It's mostly unnecessary since the UI surrounding `console.error` and `console.warn` tend to have visual treatment around it anyway. However, it's actively misleading when `console.error` gets prefixed with a Warning that we consider an error level. There's an argument to be made that some of our `console.error` don't make the bar for an error but then the argument is to downgrade each of those to `console.warn` - not to brand all our actual error logging with `Warning: `. Apparently something needs to change in React Native before landing this because it depends on the prefix somehow which probably doesn't make sense already.

Sebastian Markbåge committed Jun 10, 2024 at 18:41 UTC 277420803947724b43c47bbc47d3a353553868f1
77 files changed +397 -418
packages/internal-test-utils/shouldIgnoreConsoleError.js
+3
@@ -7,6 +7,9 @@ module.exports = function shouldIgnoreConsoleError(format, args) {
7 args[0] != null &&
8 ((typeof args[0] === 'object' &&
9 typeof args[0].message === 'string' &&
10 + // This specific log has the same signature as error logging.
11 + // The trick is to get rid of this whole file.
12 + !format.includes('Failed to serialize an action') &&
13 typeof args[0].stack === 'string') ||
14 (typeof args[0] === 'string' &&
15 args[0].indexOf('An error occurred in ') === 0))
packages/react-cache/src/__tests__/ReactCacheOld-test.internal.js
+1 -1
@@ -182,7 +182,7 @@ describe('ReactCache', () => {
182 await waitForAll(['App', 'Loading...']);
183 }).toErrorDev([
184 'Invalid key type. Expected a string, number, symbol, or ' +
185 - 'boolean, but instead received: Hi,100\n\n' +
185 + "boolean, but instead received: [ 'Hi', 100 ]\n\n" +
186 'To use non-primitive values as keys, you must pass a hash ' +
187 'function as the second argument to createResource().',
188 ]);
packages/react-devtools-shared/src/__tests__/inspectedElement-test.js
+1 -1
@@ -2556,7 +2556,7 @@ describe('InspectedElement', () => {
2556 };
2557
2558 await withErrorsOrWarningsIgnored(
2559 - ['Warning: Each child in a list should have a unique "key" prop.'],
2559 + ['Each child in a list should have a unique "key" prop.'],
2560 async () => {
2561 await utils.actAsync(() =>
2562 render(<Example repeatWarningCount={1} />),
packages/react-devtools-shared/src/__tests__/setupTests.js
+10 -11
@@ -154,23 +154,22 @@ beforeEach(() => {
154
155 const originalConsoleError = console.error;
156 console.error = (...args) => {
157 - const firstArg = args[0];
158 - if (
159 - firstArg === 'Warning: React instrumentation encountered an error: %s'
160 - ) {
157 + let firstArg = args[0];
158 + if (typeof firstArg === 'string' && firstArg.startsWith('Warning: ')) {
159 + // Older React versions might use the Warning: prefix. I'm not sure
160 + // if they use this code path.
161 + firstArg = firstArg.slice(9);
162 + }
163 + if (firstArg === 'React instrumentation encountered an error: %s') {
164 // Rethrow errors from React.
165 throw args[1];
166 } else if (
167 typeof firstArg === 'string' &&
165 - (firstArg.startsWith(
166 - "Warning: It looks like you're using the wrong act()",
167 - ) ||
168 + (firstArg.startsWith("It looks like you're using the wrong act()") ||
169 firstArg.startsWith(
169 - 'Warning: The current testing environment is not configured to support act',
170 + 'The current testing environment is not configured to support act',
171 ) ||
171 - firstArg.startsWith(
172 - 'Warning: You seem to have overlapping act() calls',
173 - ))
172 + firstArg.startsWith('You seem to have overlapping act() calls'))
173 ) {
174 // DevTools intentionally wraps updates with acts from both DOM and test-renderer,
175 // since test updates are expected to impact both renderers.
packages/react-devtools-shared/src/__tests__/store-test.js
+2 -2
@@ -1927,7 +1927,7 @@ describe('Store', () => {
1927 }
1928
1929 withErrorsOrWarningsIgnored(
1930 - ['Warning: Each child in a list should have a unique "key" prop'],
1930 + ['Each child in a list should have a unique "key" prop'],
1931 () => {
1932 act(() => render(<Example />));
1933 },
@@ -1952,7 +1952,7 @@ describe('Store', () => {
1952 }
1953
1954 withErrorsOrWarningsIgnored(
1955 - ['Warning: Each child in a list should have a unique "key" prop'],
1955 + ['Each child in a list should have a unique "key" prop'],
1956 () => {
1957 act(() => render(<Example />));
1958 },
packages/react-devtools-shell/src/app/index.js
+11 -1
@@ -32,8 +32,18 @@ ignoreErrors([
32 'Warning: %s is deprecated in StrictMode.', // findDOMNode
33 'Warning: ReactDOM.render was removed in React 19',
34 'Warning: react-test-renderer is deprecated',
35 + // Ignore prefixed and not prefixed since I don't know which
36 + // React versions are being tested by this code.
37 + 'Legacy context API',
38 + 'Unsafe lifecycle methods',
39 + '%s is deprecated in StrictMode.', // findDOMNode
40 + 'ReactDOM.render was removed in React 19',
41 + 'react-test-renderer is deprecated',
42 +]);
43 +ignoreWarnings([
44 + 'Warning: componentWillReceiveProps has been renamed',
45 + 'componentWillReceiveProps has been renamed',
46 ]);
36 -ignoreWarnings(['Warning: componentWillReceiveProps has been renamed']);
47 ignoreLogs([]);
48
49 const unmountFunctions: Array<() => void | boolean> = [];
packages/react-dom-bindings/src/client/validateDOMNesting.js
+4 -4
@@ -484,7 +484,7 @@ function validateDOMNesting(
484 // TODO: Format this as a linkified "diff view" with props instead of
485 // a stack trace since the stack trace format is now for owner stacks.
486 console['error'](
487 - 'Warning: In HTML, %s cannot be a child of <%s>.%s\n' +
487 + 'In HTML, %s cannot be a child of <%s>.%s\n' +
488 'This will cause a hydration error.%s',
489 tagDisplayName,
490 ancestorTag,
@@ -498,7 +498,7 @@ function validateDOMNesting(
498 // TODO: Format this as a linkified "diff view" with props instead of
499 // a stack trace since the stack trace format is now for owner stacks.
500 console['error'](
501 - 'Warning: In HTML, %s cannot be a descendant of <%s>.\n' +
501 + 'In HTML, %s cannot be a descendant of <%s>.\n' +
502 'This will cause a hydration error.%s',
503 tagDisplayName,
504 ancestorTag,
@@ -530,7 +530,7 @@ function validateTextNesting(childText: string, parentTag: string): boolean {
530 // TODO: Format this as a linkified "diff view" with props instead of
531 // a stack trace since the stack trace format is now for owner stacks.
532 console['error'](
533 - 'Warning: In HTML, text nodes cannot be a child of <%s>.\n' +
533 + 'In HTML, text nodes cannot be a child of <%s>.\n' +
534 'This will cause a hydration error.%s',
535 parentTag,
536 getCurrentParentStackInDev(),
@@ -542,7 +542,7 @@ function validateTextNesting(childText: string, parentTag: string): boolean {
542 // TODO: Format this as a linkified "diff view" with props instead of
543 // a stack trace since the stack trace format is now for owner stacks.
544 console['error'](
545 - 'Warning: In HTML, whitespace text nodes cannot be a child of <%s>. ' +
545 + 'In HTML, whitespace text nodes cannot be a child of <%s>. ' +
546 "Make sure you don't have any extra whitespace between tags on " +
547 'each line of your source code.\n' +
548 'This will cause a hydration error.%s',
packages/react-dom/src/__tests__/CSSPropertyOperations-test.js
+9 -9
@@ -108,7 +108,7 @@ describe('CSSPropertyOperations', () => {
108 root.render(<Comp />);
109 });
110 }).toErrorDev(
111 - 'Warning: Unsupported style property background-color. Did you mean backgroundColor?' +
111 + 'Unsupported style property background-color. Did you mean backgroundColor?' +
112 '\n in div (at **)' +
113 '\n in Comp (at **)',
114 );
@@ -137,10 +137,10 @@ describe('CSSPropertyOperations', () => {
137 root.render(<Comp style={styles} />);
138 });
139 }).toErrorDev([
140 - 'Warning: Unsupported style property -ms-transform. Did you mean msTransform?' +
140 + 'Unsupported style property -ms-transform. Did you mean msTransform?' +
141 '\n in div (at **)' +
142 '\n in Comp (at **)',
143 - 'Warning: Unsupported style property -webkit-transform. Did you mean WebkitTransform?' +
143 + 'Unsupported style property -webkit-transform. Did you mean WebkitTransform?' +
144 '\n in div (at **)' +
145 '\n in Comp (at **)',
146 ]);
@@ -171,11 +171,11 @@ describe('CSSPropertyOperations', () => {
171 });
172 }).toErrorDev([
173 // msTransform is correct already and shouldn't warn
174 - 'Warning: Unsupported vendor-prefixed style property oTransform. ' +
174 + 'Unsupported vendor-prefixed style property oTransform. ' +
175 'Did you mean OTransform?' +
176 '\n in div (at **)' +
177 '\n in Comp (at **)',
178 - 'Warning: Unsupported vendor-prefixed style property webkitTransform. ' +
178 + 'Unsupported vendor-prefixed style property webkitTransform. ' +
179 'Did you mean WebkitTransform?' +
180 '\n in div (at **)' +
181 '\n in Comp (at **)',
@@ -207,11 +207,11 @@ describe('CSSPropertyOperations', () => {
207 root.render(<Comp />);
208 });
209 }).toErrorDev([
210 - "Warning: Style property values shouldn't contain a semicolon. " +
210 + "Style property values shouldn't contain a semicolon. " +
211 'Try "backgroundColor: blue" instead.' +
212 '\n in div (at **)' +
213 '\n in Comp (at **)',
214 - "Warning: Style property values shouldn't contain a semicolon. " +
214 + "Style property values shouldn't contain a semicolon. " +
215 'Try "color: red" instead.' +
216 '\n in div (at **)' +
217 '\n in Comp (at **)',
@@ -234,7 +234,7 @@ describe('CSSPropertyOperations', () => {
234 root.render(<Comp />);
235 });
236 }).toErrorDev(
237 - 'Warning: `NaN` is an invalid value for the `fontSize` css style property.' +
237 + '`NaN` is an invalid value for the `fontSize` css style property.' +
238 '\n in div (at **)' +
239 '\n in Comp (at **)',
240 );
@@ -270,7 +270,7 @@ describe('CSSPropertyOperations', () => {
270 root.render(<Comp />);
271 });
272 }).toErrorDev(
273 - 'Warning: `Infinity` is an invalid value for the `fontSize` css style property.' +
273 + '`Infinity` is an invalid value for the `fontSize` css style property.' +
274 '\n in div (at **)' +
275 '\n in Comp (at **)',
276 );
packages/react-dom/src/__tests__/DOMPropertyOperations-test.js
+1 -1
@@ -1333,7 +1333,7 @@ describe('DOMPropertyOperations', () => {
1333 });
1334
1335 assertConsoleErrorDev([
1336 - 'The `popoverTarget` prop expects the ID of an Element as a string. Received [object HTMLDivElement] instead.',
1336 + 'The `popoverTarget` prop expects the ID of an Element as a string. Received HTMLDivElement {} instead.',
1337 ]);
1338
1339 // Dedupe warning
packages/react-dom/src/__tests__/ReactComponent-test.js
+6 -6
@@ -217,7 +217,7 @@ describe('ReactComponent', () => {
217 root.render(<Component />);
218 });
219 }).toErrorDev([
220 - 'Warning: Component "Component" contains the string ref "inner". ' +
220 + 'Component "Component" contains the string ref "inner". ' +
221 'Support for string refs will be removed in a future major release. ' +
222 'We recommend using useRef() or createRef() instead. ' +
223 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
@@ -711,7 +711,7 @@ describe('ReactComponent', () => {
711 root.render(<Foo />);
712 });
713 }).toErrorDev(
714 - 'Warning: Functions are not valid as a React child. This may happen if ' +
714 + 'Functions are not valid as a React child. This may happen if ' +
715 'you return Foo instead of <Foo /> from render. ' +
716 'Or maybe you meant to call this function rather than return it.\n' +
717 ' <Foo>{Foo}</Foo>\n' +
@@ -733,7 +733,7 @@ describe('ReactComponent', () => {
733 root.render(<Foo />);
734 });
735 }).toErrorDev(
736 - 'Warning: Functions are not valid as a React child. This may happen if ' +
736 + 'Functions are not valid as a React child. This may happen if ' +
737 'you return Foo instead of <Foo /> from render. ' +
738 'Or maybe you meant to call this function rather than return it.\n' +
739 ' <Foo>{Foo}</Foo>\n' +
@@ -756,7 +756,7 @@ describe('ReactComponent', () => {
756 root.render(<Foo />);
757 });
758 }).toErrorDev(
759 - 'Warning: Functions are not valid as a React child. This may happen if ' +
759 + 'Functions are not valid as a React child. This may happen if ' +
760 'you return Foo instead of <Foo /> from render. ' +
761 'Or maybe you meant to call this function rather than return it.\n' +
762 ' <span>{Foo}</span>\n' +
@@ -811,13 +811,13 @@ describe('ReactComponent', () => {
811 root.render(<Foo ref={current => (component = current)} />);
812 });
813 }).toErrorDev([
814 - 'Warning: Functions are not valid as a React child. This may happen if ' +
814 + 'Functions are not valid as a React child. This may happen if ' +
815 'you return Foo instead of <Foo /> from render. ' +
816 'Or maybe you meant to call this function rather than return it.\n' +
817 ' <div>{Foo}</div>\n' +
818 ' in div (at **)\n' +
819 ' in Foo (at **)',
820 - 'Warning: Functions are not valid as a React child. This may happen if ' +
820 + 'Functions are not valid as a React child. This may happen if ' +
821 'you return Foo instead of <Foo /> from render. ' +
822 'Or maybe you meant to call this function rather than return it.\n' +
823 ' <span>{Foo}</span>\n' +
packages/react-dom/src/__tests__/ReactComponentLifeCycle-test.js
+4 -4
@@ -271,7 +271,7 @@ describe('ReactComponentLifeCycle', () => {
271 root.render(<StatefulComponent />);
272 });
273 }).toErrorDev(
274 - "Warning: Can't call setState on a component that is not yet mounted. " +
274 + "Can't call setState on a component that is not yet mounted. " +
275 'This is a no-op, but it might indicate a bug in your application. ' +
276 'Instead, assign to `this.state` directly or define a `state = {};` ' +
277 'class property with the desired state in the StatefulComponent component.',
@@ -1504,20 +1504,20 @@ describe('ReactComponentLifeCycle', () => {
1504 }).toWarnDev(
1505 [
1506 /* eslint-disable max-len */
1507 - `Warning: componentWillMount has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
1507 + `componentWillMount has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
1508
1509 * Move code with side effects to componentDidMount, and set initial state in the constructor.
1510 * Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
1511
1512 Please update the following components: MyComponent`,
1513 - `Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
1513 + `componentWillReceiveProps has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
1514
1515 * Move data fetching code or side effects to componentDidUpdate.
1516 * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://react.dev/link/derived-state
1517 * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
1518
1519 Please update the following components: MyComponent`,
1520 - `Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
1520 + `componentWillUpdate has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
1521
1522 * Move data fetching code or side effects to componentDidUpdate.
1523 * Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
+11 -11
@@ -313,7 +313,7 @@ describe('ReactCompositeComponent', () => {
313 root.render(<MyComponent />);
314 });
315 }).toErrorDev(
316 - "Warning: Can't call forceUpdate on a component that is not yet mounted. " +
316 + "Can't call forceUpdate on a component that is not yet mounted. " +
317 'This is a no-op, but it might indicate a bug in your application. ' +
318 'Instead, assign to `this.state` directly or define a `state = {};` ' +
319 'class property with the desired state in the MyComponent component.',
@@ -347,7 +347,7 @@ describe('ReactCompositeComponent', () => {
347 root.render(<MyComponent />);
348 });
349 }).toErrorDev(
350 - "Warning: Can't call setState on a component that is not yet mounted. " +
350 + "Can't call setState on a component that is not yet mounted. " +
351 'This is a no-op, but it might indicate a bug in your application. ' +
352 'Instead, assign to `this.state` directly or define a `state = {};` ' +
353 'class property with the desired state in the MyComponent component.',
@@ -484,7 +484,7 @@ describe('ReactCompositeComponent', () => {
484 });
485 }).rejects.toThrow(TypeError);
486 }).toErrorDev(
487 - 'Warning: The <ClassWithRenderNotExtended /> component appears to have a render method, ' +
487 + 'The <ClassWithRenderNotExtended /> component appears to have a render method, ' +
488 "but doesn't extend React.Component. This is likely to cause errors. " +
489 'Change ClassWithRenderNotExtended to extend React.Component instead.',
490 );
@@ -631,7 +631,7 @@ describe('ReactCompositeComponent', () => {
631 instance.setState({bogus: true});
632 });
633 }).toErrorDev(
634 - 'Warning: ClassComponent.shouldComponentUpdate(): Returned undefined instead of a ' +
634 + 'ClassComponent.shouldComponentUpdate(): Returned undefined instead of a ' +
635 'boolean value. Make sure to return true or false.',
636 );
637 });
@@ -651,7 +651,7 @@ describe('ReactCompositeComponent', () => {
651 root.render(<Component />);
652 });
653 }).toErrorDev(
654 - 'Warning: Component has a method called ' +
654 + 'Component has a method called ' +
655 'componentDidUnmount(). But there is no such lifecycle method. ' +
656 'Did you mean componentWillUnmount()?',
657 );
@@ -673,7 +673,7 @@ describe('ReactCompositeComponent', () => {
673 root.render(<Component />);
674 });
675 }).toErrorDev(
676 - 'Warning: Component has a method called ' +
676 + 'Component has a method called ' +
677 'componentDidReceiveProps(). But there is no such lifecycle method. ' +
678 'If you meant to update the state in response to changing props, ' +
679 'use componentWillReceiveProps(). If you meant to fetch data or ' +
@@ -699,7 +699,7 @@ describe('ReactCompositeComponent', () => {
699 root.render(<Component />);
700 });
701 }).toErrorDev(
702 - 'Warning: Setting defaultProps as an instance property on Component is not supported ' +
702 + 'Setting defaultProps as an instance property on Component is not supported ' +
703 'and will be ignored. Instead, define defaultProps as a static property on Component.',
704 );
705 });
@@ -1199,9 +1199,9 @@ describe('ReactCompositeComponent', () => {
1199 });
1200 }).rejects.toThrow();
1201 }).toErrorDev([
1202 - 'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' +
1202 + 'No `render` method found on the RenderTextInvalidConstructor instance: ' +
1203 'did you accidentally return an object from the constructor?',
1204 - 'Warning: No `render` method found on the RenderTextInvalidConstructor instance: ' +
1204 + 'No `render` method found on the RenderTextInvalidConstructor instance: ' +
1205 'did you accidentally return an object from the constructor?',
1206 ]);
1207 });
@@ -1239,9 +1239,9 @@ describe('ReactCompositeComponent', () => {
1239 });
1240 }).rejects.toThrow();
1241 }).toErrorDev([
1242 - 'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' +
1242 + 'No `render` method found on the RenderTestUndefinedRender instance: ' +
1243 'you may have forgotten to define `render`.',
1244 - 'Warning: No `render` method found on the RenderTestUndefinedRender instance: ' +
1244 + 'No `render` method found on the RenderTestUndefinedRender instance: ' +
1245 'you may have forgotten to define `render`.',
1246 ]);
1247 });
packages/react-dom/src/__tests__/ReactCompositeComponentState-test.js
+3 -3
@@ -474,7 +474,7 @@ describe('ReactCompositeComponent-state', () => {
474 root.render(<Test />);
475 });
476 }).toErrorDev(
477 - 'Warning: Test.componentWillReceiveProps(): Assigning directly to ' +
477 + 'Test.componentWillReceiveProps(): Assigning directly to ' +
478 "this.state is deprecated (except inside a component's constructor). " +
479 'Use setState instead.',
480 );
@@ -523,7 +523,7 @@ describe('ReactCompositeComponent-state', () => {
523 root.render(<Test />);
524 });
525 }).toErrorDev(
526 - 'Warning: Test.componentWillMount(): Assigning directly to ' +
526 + 'Test.componentWillMount(): Assigning directly to ' +
527 "this.state is deprecated (except inside a component's constructor). " +
528 'Use setState instead.',
529 );
@@ -571,7 +571,7 @@ describe('ReactCompositeComponent-state', () => {
571 root.render(<B />);
572 });
573 }).toErrorDev(
574 - "Warning: Can't perform a React state update on a component that hasn't mounted yet",
574 + "Can't perform a React state update on a component that hasn't mounted yet",
575 );
576 });
577
packages/react-dom/src/__tests__/ReactDOM-test.js
+10 -10
@@ -198,8 +198,8 @@ describe('ReactDOM', () => {
198 );
199 }).toErrorDev(
200 [
201 - 'Warning: Expected the last optional `callback` argument to be a function. Instead received: no.',
202 - 'Warning: Expected the last optional `callback` argument to be a function. Instead received: no.',
201 + 'Expected the last optional `callback` argument to be a function. Instead received: no.',
202 + 'Expected the last optional `callback` argument to be a function. Instead received: no.',
203 ],
204 {withoutStack: 2},
205 );
@@ -215,8 +215,8 @@ describe('ReactDOM', () => {
215 );
216 }).toErrorDev(
217 [
218 - 'Expected the last optional `callback` argument to be a function. Instead received: [object Object].',
219 - 'Expected the last optional `callback` argument to be a function. Instead received: [object Object].',
218 + "Expected the last optional `callback` argument to be a function. Instead received: { foo: 'bar' }",
219 + "Expected the last optional `callback` argument to be a function. Instead received: { foo: 'bar' }.",
220 ],
221 {withoutStack: 2},
222 );
@@ -232,8 +232,8 @@ describe('ReactDOM', () => {
232 );
233 }).toErrorDev(
234 [
235 - 'Expected the last optional `callback` argument to be a function. Instead received: [object Object].',
236 - 'Expected the last optional `callback` argument to be a function. Instead received: [object Object].',
235 + 'Expected the last optional `callback` argument to be a function. Instead received: Foo { a: 1, b: 2 }.',
236 + 'Expected the last optional `callback` argument to be a function. Instead received: Foo { a: 1, b: 2 }.',
237 ],
238 {withoutStack: 2},
239 );
@@ -285,8 +285,8 @@ describe('ReactDOM', () => {
285 );
286 }).toErrorDev(
287 [
288 - 'Expected the last optional `callback` argument to be a function. Instead received: [object Object].',
289 - 'Expected the last optional `callback` argument to be a function. Instead received: [object Object].',
288 + "Expected the last optional `callback` argument to be a function. Instead received: { foo: 'bar' }.",
289 + "Expected the last optional `callback` argument to be a function. Instead received: { foo: 'bar' }.",
290 ],
291 {withoutStack: 2},
292 );
@@ -303,8 +303,8 @@ describe('ReactDOM', () => {
303 );
304 }).toErrorDev(
305 [
306 - 'Expected the last optional `callback` argument to be a function. Instead received: [object Object].',
307 - 'Expected the last optional `callback` argument to be a function. Instead received: [object Object].',
306 + 'Expected the last optional `callback` argument to be a function. Instead received: Foo { a: 1, b: 2 }.',
307 + 'Expected the last optional `callback` argument to be a function. Instead received: Foo { a: 1, b: 2 }.',
308 ],
309 {withoutStack: 2},
310 );
packages/react-dom/src/__tests__/ReactDOMAttribute-test.js
+5 -5
@@ -110,7 +110,7 @@ describe('ReactDOM unknown attribute', () => {
110 root.render(<div inert="" />);
111 });
112 }).toErrorDev([
113 - 'Warning: Received an empty string for a boolean attribute `inert`. ' +
113 + 'Received an empty string for a boolean attribute `inert`. ' +
114 'This will treat the attribute as if it were false. ' +
115 'Either pass `false` to silence this warning, or ' +
116 'pass `true` if you used an empty string in earlier versions of React to indicate this attribute is true.',
@@ -137,7 +137,7 @@ describe('ReactDOM unknown attribute', () => {
137
138 it('coerces NaN to strings and warns', async () => {
139 await expect(() => testUnknownAttributeAssignment(NaN, 'NaN')).toErrorDev(
140 - 'Warning: Received NaN for the `unknown` attribute. ' +
140 + 'Received NaN for the `unknown` attribute. ' +
141 'If this is expected, cast the value to a string.\n' +
142 ' in div (at **)',
143 );
@@ -170,14 +170,14 @@ describe('ReactDOM unknown attribute', () => {
170 await expect(() =>
171 expect(test).rejects.toThrowError(new TypeError('prod message')),
172 ).toErrorDev(
173 - 'Warning: The provided `unknown` attribute is an unsupported type TemporalLike.' +
173 + 'The provided `unknown` attribute is an unsupported type TemporalLike.' +
174 ' This value must be coerced to a string before using it here.',
175 );
176 });
177
178 it('removes symbols and warns', async () => {
179 await expect(() => testUnknownAttributeRemoval(Symbol('foo'))).toErrorDev(
180 - 'Warning: Invalid value for prop `unknown` on <div> tag. Either remove it ' +
180 + 'Invalid value for prop `unknown` on <div> tag. Either remove it ' +
181 'from the element, or pass a string or number value to keep it ' +
182 'in the DOM. For details, see https://react.dev/link/attribute-behavior \n' +
183 ' in div (at **)',
@@ -188,7 +188,7 @@ describe('ReactDOM unknown attribute', () => {
188 await expect(() =>
189 testUnknownAttributeRemoval(function someFunction() {}),
190 ).toErrorDev(
191 - 'Warning: Invalid value for prop `unknown` on <div> tag. Either remove ' +
191 + 'Invalid value for prop `unknown` on <div> tag. Either remove ' +
192 'it from the element, or pass a string or number value to ' +
193 'keep it in the DOM. For details, see ' +
194 'https://react.dev/link/attribute-behavior \n' +
packages/react-dom/src/__tests__/ReactDOMComponent-test.js
+50 -58
@@ -194,7 +194,7 @@ describe('ReactDOMComponent', () => {
194 root.render(<div foo={() => {}} />);
195 });
196 }).toErrorDev(
197 - 'Warning: Invalid value for prop `foo` on <div> tag. Either remove it ' +
197 + 'Invalid value for prop `foo` on <div> tag. Either remove it ' +
198 'from the element, or pass a string or number value to keep ' +
199 'it in the DOM. For details, see https://react.dev/link/attribute-behavior ' +
200 '\n in div (at **)',
@@ -209,7 +209,7 @@ describe('ReactDOMComponent', () => {
209 root.render(<div foo={() => {}} baz={() => {}} />);
210 });
211 }).toErrorDev(
212 - 'Warning: Invalid values for props `foo`, `baz` on <div> tag. Either remove ' +
212 + 'Invalid values for props `foo`, `baz` on <div> tag. Either remove ' +
213 'them from the element, or pass a string or number value to keep ' +
214 'them in the DOM. For details, see https://react.dev/link/attribute-behavior ' +
215 '\n in div (at **)',
@@ -224,7 +224,7 @@ describe('ReactDOMComponent', () => {
224 root.render(<div onDblClick={() => {}} />);
225 });
226 }).toErrorDev(
227 - 'Warning: Invalid event handler property `onDblClick`. Did you mean `onDoubleClick`?\n in div (at **)',
227 + 'Invalid event handler property `onDblClick`. Did you mean `onDoubleClick`?\n in div (at **)',
228 );
229 });
230
@@ -236,7 +236,7 @@ describe('ReactDOMComponent', () => {
236 root.render(<div onUnknown='alert("hack")' />);
237 });
238 }).toErrorDev(
239 - 'Warning: Unknown event handler property `onUnknown`. It will be ignored.\n in div (at **)',
239 + 'Unknown event handler property `onUnknown`. It will be ignored.\n in div (at **)',
240 );
241 expect(container.firstChild.hasAttribute('onUnknown')).toBe(false);
242 expect(container.firstChild.onUnknown).toBe(undefined);
@@ -245,7 +245,7 @@ describe('ReactDOMComponent', () => {
245 root.render(<div onunknown='alert("hack")' />);
246 });
247 }).toErrorDev(
248 - 'Warning: Unknown event handler property `onunknown`. It will be ignored.\n in div (at **)',
248 + 'Unknown event handler property `onunknown`. It will be ignored.\n in div (at **)',
249 );
250 expect(container.firstChild.hasAttribute('onunknown')).toBe(false);
251 expect(container.firstChild.onunknown).toBe(undefined);
@@ -254,7 +254,7 @@ describe('ReactDOMComponent', () => {
254 root.render(<div on-unknown='alert("hack")' />);
255 });
256 }).toErrorDev(
257 - 'Warning: Unknown event handler property `on-unknown`. It will be ignored.\n in div (at **)',
257 + 'Unknown event handler property `on-unknown`. It will be ignored.\n in div (at **)',
258 );
259 expect(container.firstChild.hasAttribute('on-unknown')).toBe(false);
260 expect(container.firstChild['on-unknown']).toBe(undefined);
@@ -268,7 +268,7 @@ describe('ReactDOMComponent', () => {
268 root.render(<div onUnknown={function () {}} />);
269 });
270 }).toErrorDev(
271 - 'Warning: Unknown event handler property `onUnknown`. It will be ignored.\n in div (at **)',
271 + 'Unknown event handler property `onUnknown`. It will be ignored.\n in div (at **)',
272 );
273 expect(container.firstChild.hasAttribute('onUnknown')).toBe(false);
274 expect(container.firstChild.onUnknown).toBe(undefined);
@@ -277,7 +277,7 @@ describe('ReactDOMComponent', () => {
277 root.render(<div onunknown={function () {}} />);
278 });
279 }).toErrorDev(
280 - 'Warning: Unknown event handler property `onunknown`. It will be ignored.\n in div (at **)',
280 + 'Unknown event handler property `onunknown`. It will be ignored.\n in div (at **)',
281 );
282 expect(container.firstChild.hasAttribute('onunknown')).toBe(false);
283 expect(container.firstChild.onunknown).toBe(undefined);
@@ -286,7 +286,7 @@ describe('ReactDOMComponent', () => {
286 root.render(<div on-unknown={function () {}} />);
287 });
288 }).toErrorDev(
289 - 'Warning: Unknown event handler property `on-unknown`. It will be ignored.\n in div (at **)',
289 + 'Unknown event handler property `on-unknown`. It will be ignored.\n in div (at **)',
290 );
291 expect(container.firstChild.hasAttribute('on-unknown')).toBe(false);
292 expect(container.firstChild['on-unknown']).toBe(undefined);
@@ -300,7 +300,7 @@ describe('ReactDOMComponent', () => {
300 root.render(<div CHILDREN="5" />);
301 });
302 }).toErrorDev(
303 - 'Warning: Invalid DOM property `CHILDREN`. Did you mean `children`?\n in div (at **)',
303 + 'Invalid DOM property `CHILDREN`. Did you mean `children`?\n in div (at **)',
304 );
305 expect(container.firstChild.getAttribute('CHILDREN')).toBe('5');
306 });
@@ -328,7 +328,7 @@ describe('ReactDOMComponent', () => {
328 root.render(<span style={style} />);
329 });
330 }).toErrorDev(
331 - 'Warning: `NaN` is an invalid value for the `fontSize` css style property.' +
331 + '`NaN` is an invalid value for the `fontSize` css style property.' +
332 '\n in span (at **)',
333 );
334 await act(() => {
@@ -355,7 +355,7 @@ describe('ReactDOMComponent', () => {
355 root.render(<span style={style} />);
356 });
357 }).toErrorDev(
358 - 'Warning: The provided `fontSize` CSS property is an unsupported type TemporalLike.' +
358 + 'The provided `fontSize` CSS property is an unsupported type TemporalLike.' +
359 ' This value must be coerced to a string before using it here.',
360 );
361 }).rejects.toThrowError(new TypeError('prod message'));
@@ -891,8 +891,8 @@ describe('ReactDOMComponent', () => {
891 expect(result2.toLowerCase()).not.toContain('script');
892 }
893 }).toErrorDev([
894 - 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
895 - 'Warning: Invalid attribute name: `></div><script>alert("hi")</script>`',
894 + 'Invalid attribute name: `blah" onclick="beevil" noise="hi`',
895 + 'Invalid attribute name: `></div><script>alert("hi")</script>`',
896 ]);
897 });
898
@@ -915,8 +915,8 @@ describe('ReactDOMComponent', () => {
915 expect(result2.toLowerCase()).not.toContain('script');
916 }
917 }).toErrorDev([
918 - 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
919 - 'Warning: Invalid attribute name: `></x-foo-component><script>alert("hi")</script>`',
918 + 'Invalid attribute name: `blah" onclick="beevil" noise="hi`',
919 + 'Invalid attribute name: `></x-foo-component><script>alert("hi")</script>`',
920 ]);
921 });
922
@@ -953,8 +953,8 @@ describe('ReactDOMComponent', () => {
953 expect(container.firstChild.attributes.length).toBe(0);
954 }
955 }).toErrorDev([
956 - 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
957 - 'Warning: Invalid attribute name: `></div><script>alert("hi")</script>`',
956 + 'Invalid attribute name: `blah" onclick="beevil" noise="hi`',
957 + 'Invalid attribute name: `></div><script>alert("hi")</script>`',
958 ]);
959 });
960
@@ -992,8 +992,8 @@ describe('ReactDOMComponent', () => {
992 expect(container.firstChild.attributes.length).toBe(0);
993 }
994 }).toErrorDev([
995 - 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
996 - 'Warning: Invalid attribute name: `></x-foo-component><script>alert("hi")</script>`',
995 + 'Invalid attribute name: `blah" onclick="beevil" noise="hi`',
996 + 'Invalid attribute name: `></x-foo-component><script>alert("hi")</script>`',
997 ]);
998 });
999
@@ -1030,8 +1030,8 @@ describe('ReactDOMComponent', () => {
1030 expect(container.firstChild.attributes.length).toBe(0);
1031 }
1032 }).toErrorDev([
1033 - 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
1034 - 'Warning: Invalid attribute name: `></div><script>alert("hi")</script>`',
1033 + 'Invalid attribute name: `blah" onclick="beevil" noise="hi`',
1034 + 'Invalid attribute name: `></div><script>alert("hi")</script>`',
1035 ]);
1036 });
1037
@@ -1068,8 +1068,8 @@ describe('ReactDOMComponent', () => {
1068 expect(container.firstChild.attributes.length).toBe(0);
1069 }
1070 }).toErrorDev([
1071 - 'Warning: Invalid attribute name: `blah" onclick="beevil" noise="hi`',
1072 - 'Warning: Invalid attribute name: `></x-foo-component><script>alert("hi")</script>`',
1071 + 'Invalid attribute name: `blah" onclick="beevil" noise="hi`',
1072 + 'Invalid attribute name: `></x-foo-component><script>alert("hi")</script>`',
1073 ]);
1074 });
1075
@@ -1410,7 +1410,7 @@ describe('ReactDOMComponent', () => {
1410 root.render(<input value="" onChange={onChange} />);
1411 });
1412 }).toErrorDev(
1413 - ' A component is changing an uncontrolled input to be controlled. This is likely caused by ' +
1413 + 'A component is changing an uncontrolled input to be controlled. This is likely caused by ' +
1414 'the value changing from undefined to a defined value, which should not happen. Decide between ' +
1415 'using a controlled or uncontrolled input element for the lifetime of the component.',
1416 );
@@ -1866,7 +1866,7 @@ describe('ReactDOMComponent', () => {
1866 await expect(async () => {
1867 await mountComponent({contentEditable: true, children: ''});
1868 }).toErrorDev(
1869 - 'Warning: A component is `contentEditable` and contains `children` ' +
1869 + 'A component is `contentEditable` and contains `children` ' +
1870 'managed by React. It is now your responsibility to guarantee that ' +
1871 'none of those nodes are unexpectedly modified or duplicated. This ' +
1872 'is probably not intentional.\n in div (at **)',
@@ -2194,7 +2194,7 @@ describe('ReactDOMComponent', () => {
2194 );
2195 });
2196 }).toErrorDev([
2197 - 'Warning: In HTML, <tr> cannot be a child of ' +
2197 + 'In HTML, <tr> cannot be a child of ' +
2198 '<div>.\n' +
2199 'This will cause a hydration error.' +
2200 '\n in tr (at **)' +
@@ -2215,7 +2215,7 @@ describe('ReactDOMComponent', () => {
2215 );
2216 });
2217 }).toErrorDev(
2218 - 'Warning: In HTML, <p> cannot be a descendant ' +
2218 + 'In HTML, <p> cannot be a descendant ' +
2219 'of <p>.\n' +
2220 'This will cause a hydration error.' +
2221 // There is no outer `p` here because root container is not part of the stack.
@@ -2249,7 +2249,7 @@ describe('ReactDOMComponent', () => {
2249 root.render(<Foo />);
2250 });
2251 }).toErrorDev([
2252 - 'Warning: In HTML, <tr> cannot be a child of ' +
2252 + 'In HTML, <tr> cannot be a child of ' +
2253 '<table>. Add a <tbody>, <thead> or <tfoot> to your code to match the DOM tree generated ' +
2254 'by the browser.\n' +
2255 'This will cause a hydration error.' +
@@ -2257,14 +2257,14 @@ describe('ReactDOMComponent', () => {
2257 '\n in Row (at **)' +
2258 '\n in table (at **)' +
2259 '\n in Foo (at **)',
2260 - 'Warning: In HTML, text nodes cannot be a ' +
2260 + 'In HTML, text nodes cannot be a ' +
2261 'child of <tr>.\n' +
2262 'This will cause a hydration error.' +
2263 '\n in tr (at **)' +
2264 '\n in Row (at **)' +
2265 '\n in table (at **)' +
2266 '\n in Foo (at **)',
2267 - 'Warning: In HTML, whitespace text nodes cannot ' +
2267 + 'In HTML, whitespace text nodes cannot ' +
2268 "be a child of <table>. Make sure you don't have any extra " +
2269 'whitespace between tags on each line of your source code.\n' +
2270 'This will cause a hydration error.' +
@@ -2294,7 +2294,7 @@ describe('ReactDOMComponent', () => {
2294 root.render(<Foo> </Foo>);
2295 });
2296 }).toErrorDev([
2297 - 'Warning: In HTML, whitespace text nodes cannot ' +
2297 + 'In HTML, whitespace text nodes cannot ' +
2298 "be a child of <table>. Make sure you don't have any extra " +
2299 'whitespace between tags on each line of your source code.\n' +
2300 'This will cause a hydration error.' +
@@ -2323,7 +2323,7 @@ describe('ReactDOMComponent', () => {
2323 );
2324 });
2325 }).toErrorDev([
2326 - 'Warning: In HTML, text nodes cannot be a ' +
2326 + 'In HTML, text nodes cannot be a ' +
2327 'child of <tr>.\n' +
2328 'This will cause a hydration error.' +
2329 '\n in tr (at **)' +
@@ -2713,7 +2713,7 @@ describe('ReactDOMComponent', () => {
2713 root.render(<div class="paladin" />);
2714 });
2715 }).toErrorDev(
2716 - 'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
2716 + 'Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
2717 );
2718 await expect(async () => {
2719 const container = document.createElement('div');
@@ -2722,7 +2722,7 @@ describe('ReactDOMComponent', () => {
2722 root.render(<input type="text" onclick="1" />);
2723 });
2724 }).toErrorDev(
2725 - 'Warning: Invalid event handler property `onclick`. Did you mean ' +
2725 + 'Invalid event handler property `onclick`. Did you mean ' +
2726 '`onClick`?\n in input (at **)',
2727 );
2728 });
@@ -2731,12 +2731,12 @@ describe('ReactDOMComponent', () => {
2731 expect(() =>
2732 ReactDOMServer.renderToString(<div class="paladin" />),
2733 ).toErrorDev(
2734 - 'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
2734 + 'Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
2735 );
2736 expect(() =>
2737 ReactDOMServer.renderToString(<input type="text" oninput="1" />),
2738 ).toErrorDev(
2739 - 'Warning: Invalid event handler property `oninput`. ' +
2739 + 'Invalid event handler property `oninput`. ' +
2740 // Note: we don't know the right event name so we
2741 // use a generic one (onClick) as a suggestion.
2742 // This is because we don't bundle the event system
@@ -2760,7 +2760,7 @@ describe('ReactDOMComponent', () => {
2760 root.render(<div class="paladin" />);
2761 });
2762 }).toErrorDev(
2763 - 'Warning: Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
2763 + 'Invalid DOM property `class`. Did you mean `className`?\n in div (at **)',
2764 );
2765 });
2766
@@ -2912,7 +2912,7 @@ describe('ReactDOMComponent', () => {
2912 root.render(React.createElement('label', {for: 'test'}));
2913 });
2914 }).toErrorDev(
2915 - 'Warning: Invalid DOM property `for`. Did you mean `htmlFor`?\n in label',
2915 + 'Invalid DOM property `for`. Did you mean `htmlFor`?\n in label',
2916 );
2917
2918 await expect(async () => {
@@ -2924,7 +2924,7 @@ describe('ReactDOMComponent', () => {
2924 );
2925 });
2926 }).toErrorDev(
2927 - 'Warning: Invalid DOM property `autofocus`. Did you mean `autoFocus`?\n in input',
2927 + 'Invalid DOM property `autofocus`. Did you mean `autoFocus`?\n in input',
2928 );
2929 });
2930
@@ -2934,14 +2934,14 @@ describe('ReactDOMComponent', () => {
2934 React.createElement('label', {for: 'test'}),
2935 ),
2936 ).toErrorDev(
2937 - 'Warning: Invalid DOM property `for`. Did you mean `htmlFor`?\n in label',
2937 + 'Invalid DOM property `for`. Did you mean `htmlFor`?\n in label',
2938 );
2939 expect(() =>
2940 ReactDOMServer.renderToString(
2941 React.createElement('input', {type: 'text', autofocus: true}),
2942 ),
2943 ).toErrorDev(
2944 - 'Warning: Invalid DOM property `autofocus`. Did you mean `autoFocus`?\n in input',
2944 + 'Invalid DOM property `autofocus`. Did you mean `autoFocus`?\n in input',
2945 );
2946 });
2947 });
@@ -2989,9 +2989,7 @@ describe('ReactDOMComponent', () => {
2989 await act(() => {
2990 root.render(<div class="test" ref={current => (el = current)} />);
2991 });
2992 - }).toErrorDev(
2993 - 'Warning: Invalid DOM property `class`. Did you mean `className`?',
2994 - );
2992 + }).toErrorDev('Invalid DOM property `class`. Did you mean `className`?');
2993
2994 expect(el.className).toBe('test');
2995 });
@@ -3005,9 +3003,7 @@ describe('ReactDOMComponent', () => {
3003 await act(() => {
3004 root.render(<div cLASS="test" ref={current => (el = current)} />);
3005 });
3008 - }).toErrorDev(
3009 - 'Warning: Invalid DOM property `cLASS`. Did you mean `className`?',
3010 - );
3006 + }).toErrorDev('Invalid DOM property `cLASS`. Did you mean `className`?');
3007
3008 expect(el.className).toBe('test');
3009 });
@@ -3026,7 +3022,7 @@ describe('ReactDOMComponent', () => {
3022 );
3023 });
3024 }).toErrorDev(
3029 - 'Warning: Invalid DOM property `arabic-form`. Did you mean `arabicForm`?',
3025 + 'Invalid DOM property `arabic-form`. Did you mean `arabicForm`?',
3026 );
3027 const text = el.querySelector('text');
3028
@@ -3164,7 +3160,7 @@ describe('ReactDOMComponent', () => {
3160 <div whatever={() => {}} ref={current => (el = current)} />,
3161 );
3162 });
3167 - }).toErrorDev('Warning: Invalid value for prop `whatever` on <div> tag');
3163 + }).toErrorDev('Invalid value for prop `whatever` on <div> tag');
3164
3165 expect(el.hasAttribute('whatever')).toBe(false);
3166 });
@@ -3257,7 +3253,7 @@ describe('ReactDOMComponent', () => {
3253 root.render(<div whatever={NaN} ref={current => (el = current)} />);
3254 });
3255 }).toErrorDev(
3260 - 'Warning: Received NaN for the `whatever` attribute. If this is ' +
3256 + 'Received NaN for the `whatever` attribute. If this is ' +
3257 'expected, cast the value to a string.\n in div',
3258 );
3259
@@ -3274,7 +3270,7 @@ describe('ReactDOMComponent', () => {
3270 await act(() => {
3271 root.render(<div whatever={() => {}} />);
3272 });
3277 - }).toErrorDev('Warning: Invalid value for prop `whatever` on <div> tag.');
3273 + }).toErrorDev('Invalid value for prop `whatever` on <div> tag.');
3274 const el = container.firstChild;
3275 expect(el.hasAttribute('whatever')).toBe(false);
3276 });
@@ -3288,9 +3284,7 @@ describe('ReactDOMComponent', () => {
3284 await act(() => {
3285 root.render(<div SiZe="30" ref={current => (el = current)} />);
3286 });
3291 - }).toErrorDev(
3292 - 'Warning: Invalid DOM property `SiZe`. Did you mean `size`?',
3293 - );
3287 + }).toErrorDev('Invalid DOM property `SiZe`. Did you mean `size`?');
3288
3289 expect(el.getAttribute('size')).toBe('30');
3290 });
@@ -3502,9 +3496,7 @@ describe('ReactDOMComponent', () => {
3496 </svg>,
3497 );
3498 });
3505 - }).toErrorDev(
3506 - 'Warning: Invalid DOM property `x-height`. Did you mean `xHeight`',
3507 - );
3499 + }).toErrorDev('Invalid DOM property `x-height`. Did you mean `xHeight`');
3500
3501 expect(el.querySelector('font-face').hasAttribute('x-height')).toBe(
3502 false,
packages/react-dom/src/__tests__/ReactDOMComponentTree-test.js
+1 -1
@@ -196,7 +196,7 @@ describe('ReactDOMComponentTree', () => {
196 simulateInput(inputRef.current, finishValue);
197 }),
198 ).toErrorDev(
199 - 'Warning: A component is changing an uncontrolled input to be controlled. ' +
199 + 'A component is changing an uncontrolled input to be controlled. ' +
200 'This is likely caused by the value changing from undefined to ' +
201 'a defined value, which should not happen. ' +
202 'Decide between using a controlled or uncontrolled input ' +
packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
+5 -5
@@ -1810,7 +1810,7 @@ describe('ReactDOMFizzServer', () => {
1810
1811 if (__DEV__) {
1812 expect(mockError).toHaveBeenCalledWith(
1813 - 'Warning: <%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.%s',
1813 + '<%s /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.%s',
1814 'inCorrectTag',
1815 '\n' +
1816 ' in inCorrectTag (at **)\n' +
@@ -1831,7 +1831,7 @@ describe('ReactDOMFizzServer', () => {
1831
1832 if (__DEV__) {
1833 expect(mockError).toHaveBeenCalledWith(
1834 - 'Warning: Each child in a list should have a unique "key" prop.%s%s' +
1834 + 'Each child in a list should have a unique "key" prop.%s%s' +
1835 ' See https://react.dev/link/warning-keys for more information.%s',
1836 gate(flags => flags.enableOwnerStacks)
1837 ? // We currently don't track owners in Fizz which is responsible for this frame.
@@ -6543,17 +6543,17 @@ describe('ReactDOMFizzServer', () => {
6543 if (__DEV__) {
6544 expect(mockError.mock.calls.length).toBe(3);
6545 expect(mockError.mock.calls[0]).toEqual([
6546 - 'Warning: A script element was rendered with %s. If script element has children it must be a single string. Consider using dangerouslySetInnerHTML or passing a plain string as children.%s',
6546 + 'A script element was rendered with %s. If script element has children it must be a single string. Consider using dangerouslySetInnerHTML or passing a plain string as children.%s',
6547 'a number for children',
6548 componentStack(['script', 'body', 'html']),
6549 ]);
6550 expect(mockError.mock.calls[1]).toEqual([
6551 - 'Warning: A script element was rendered with %s. If script element has children it must be a single string. Consider using dangerouslySetInnerHTML or passing a plain string as children.%s',
6551 + 'A script element was rendered with %s. If script element has children it must be a single string. Consider using dangerouslySetInnerHTML or passing a plain string as children.%s',
6552 'an array for children',
6553 componentStack(['script', 'body', 'html']),
6554 ]);
6555 expect(mockError.mock.calls[2]).toEqual([
6556 - 'Warning: A script element was rendered with %s. If script element has children it must be a single string. Consider using dangerouslySetInnerHTML or passing a plain string as children.%s',
6556 + 'A script element was rendered with %s. If script element has children it must be a single string. Consider using dangerouslySetInnerHTML or passing a plain string as children.%s',
6557 'something unexpected for children',
6558 componentStack(['script', 'body', 'html']),
6559 ]);
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
+5 -5
@@ -524,7 +524,7 @@ describe('ReactDOMFloat', () => {
524 }).toErrorDev(
525 [
526 'Cannot render <noscript> outside the main document. Try moving it into the root <head> tag.',
527 - 'Warning: In HTML, <noscript> cannot be a child of <#document>.',
527 + 'In HTML, <noscript> cannot be a child of <#document>.',
528 ],
529 {withoutStack: 1},
530 );
@@ -539,7 +539,7 @@ describe('ReactDOMFloat', () => {
539 await waitForAll([]);
540 }).toErrorDev([
541 'Cannot render <template> outside the main document. Try moving it into the root <head> tag.',
542 - 'Warning: In HTML, <template> cannot be a child of <html>.',
542 + 'In HTML, <template> cannot be a child of <html>.',
543 ]);
544
545 await expect(async () => {
@@ -552,7 +552,7 @@ describe('ReactDOMFloat', () => {
552 await waitForAll([]);
553 }).toErrorDev([
554 'Cannot render a <style> outside the main document without knowing its precedence and a unique href key. React can hoist and deduplicate <style> tags if you provide a `precedence` prop along with an `href` prop that does not conflic with the `href` values used in any other hoisted <style> or <link rel="stylesheet" ...> tags. Note that hoisting <style> tags is considered an advanced feature that most will not use directly. Consider moving the <style> tag to the <head> or consider adding a `precedence="default"` and `href="some unique resource identifier"`, or move the <style> to the <style> tag.',
555 - 'Warning: In HTML, <style> cannot be a child of <html>.',
555 + 'In HTML, <style> cannot be a child of <html>.',
556 ]);
557
558 await expect(async () => {
@@ -575,7 +575,7 @@ describe('ReactDOMFloat', () => {
575 }).toErrorDev(
576 [
577 'Cannot render a <link rel="stylesheet" /> outside the main document without knowing its precedence. Consider adding precedence="default" or moving it into the root <head> tag.',
578 - 'Warning: In HTML, <link> cannot be a child of <#document>.',
578 + 'In HTML, <link> cannot be a child of <#document>.',
579 ],
580 {withoutStack: 1},
581 );
@@ -592,7 +592,7 @@ describe('ReactDOMFloat', () => {
592 await waitForAll([]);
593 }).toErrorDev([
594 'Cannot render a sync or defer <script> outside the main document without knowing its order. Try adding async="" or moving it into the root <head> tag.',
595 - 'Warning: In HTML, <script> cannot be a child of <html>.',
595 + 'In HTML, <script> cannot be a child of <html>.',
596 ]);
597
598 await expect(async () => {
packages/react-dom/src/__tests__/ReactDOMForm-test.js
+1 -1
@@ -386,7 +386,7 @@ describe('ReactDOMForm', () => {
386 );
387 });
388 }).toErrorDev([
389 - 'Warning: In HTML, <form> cannot be a descendant of <form>.\n' +
389 + 'In HTML, <form> cannot be a descendant of <form>.\n' +
390 'This will cause a hydration error.' +
391 '\n in form (at **)' +
392 '\n in form (at **)',
packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js
+9 -9
@@ -121,7 +121,7 @@ describe('ReactDOMServerHydration', () => {
121 } else {
122 expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
123 [
124 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
124 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
125
126 - A server/client branch \`if (typeof window !== 'undefined')\`.
127 - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
@@ -183,7 +183,7 @@ describe('ReactDOMServerHydration', () => {
183 } else {
184 expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
185 [
186 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
186 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
187
188 - A server/client branch \`if (typeof window !== 'undefined')\`.
189 - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
@@ -224,7 +224,7 @@ describe('ReactDOMServerHydration', () => {
224 }
225 expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
226 [
227 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
227 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
228
229 - A server/client branch \`if (typeof window !== 'undefined')\`.
230 - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
@@ -266,7 +266,7 @@ describe('ReactDOMServerHydration', () => {
266 }
267 expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
268 [
269 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
269 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
270
271 - A server/client branch \`if (typeof window !== 'undefined')\`.
272 - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
@@ -306,7 +306,7 @@ describe('ReactDOMServerHydration', () => {
306 }
307 expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
308 [
309 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
309 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
310
311 - A server/client branch \`if (typeof window !== 'undefined')\`.
312 - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
@@ -347,7 +347,7 @@ describe('ReactDOMServerHydration', () => {
347 }
348 expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
349 [
350 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
350 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
351
352 - A server/client branch \`if (typeof window !== 'undefined')\`.
353 - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
@@ -388,7 +388,7 @@ describe('ReactDOMServerHydration', () => {
388 }
389 expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
390 [
391 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
391 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
392
393 - A server/client branch \`if (typeof window !== 'undefined')\`.
394 - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
@@ -430,7 +430,7 @@ describe('ReactDOMServerHydration', () => {
430 }
431 expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
432 [
433 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
433 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
434
435 - A server/client branch \`if (typeof window !== 'undefined')\`.
436 - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
@@ -626,7 +626,7 @@ describe('ReactDOMServerHydration', () => {
626 } else {
627 expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
628 [
629 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
629 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
630
631 - A server/client branch \`if (typeof window !== 'undefined')\`.
632 - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
packages/react-dom/src/__tests__/ReactDOMInput-test.js
+23 -23
@@ -114,7 +114,7 @@ describe('ReactDOMInput', () => {
114 root.render(<input type="text" value={0} />);
115 });
116 }).toErrorDev(
117 - 'Warning: You provided a `value` prop to a form ' +
117 + 'You provided a `value` prop to a form ' +
118 'field without an `onChange` handler. This will render a read-only ' +
119 'field. If the field should be mutable use `defaultValue`. ' +
120 'Otherwise, set either `onChange` or `readOnly`.',
@@ -127,7 +127,7 @@ describe('ReactDOMInput', () => {
127 root.render(<input type="text" value="" />);
128 });
129 }).toErrorDev(
130 - 'Warning: You provided a `value` prop to a form ' +
130 + 'You provided a `value` prop to a form ' +
131 'field without an `onChange` handler. This will render a read-only ' +
132 'field. If the field should be mutable use `defaultValue`. ' +
133 'Otherwise, set either `onChange` or `readOnly`.',
@@ -140,7 +140,7 @@ describe('ReactDOMInput', () => {
140 root.render(<input type="text" value="0" />);
141 });
142 }).toErrorDev(
143 - 'Warning: You provided a `value` prop to a form ' +
143 + 'You provided a `value` prop to a form ' +
144 'field without an `onChange` handler. This will render a read-only ' +
145 'field. If the field should be mutable use `defaultValue`. ' +
146 'Otherwise, set either `onChange` or `readOnly`.',
@@ -153,7 +153,7 @@ describe('ReactDOMInput', () => {
153 root.render(<input type="checkbox" checked={false} />);
154 });
155 }).toErrorDev(
156 - 'Warning: You provided a `checked` prop to a form field without an `onChange` handler.',
156 + 'You provided a `checked` prop to a form field without an `onChange` handler.',
157 );
158 });
159
@@ -169,7 +169,7 @@ describe('ReactDOMInput', () => {
169 root.render(<input type="checkbox" checked={false} readOnly={false} />);
170 });
171 }).toErrorDev(
172 - 'Warning: You provided a `checked` prop to a form field without an `onChange` handler. ' +
172 + 'You provided a `checked` prop to a form field without an `onChange` handler. ' +
173 'This will render a read-only field. If the field should be mutable use `defaultChecked`. ' +
174 'Otherwise, set either `onChange` or `readOnly`.',
175 );
@@ -218,7 +218,7 @@ describe('ReactDOMInput', () => {
218 root.render(<input type="text" value="lion" />);
219 });
220 }).toErrorDev(
221 - 'Warning: You provided a `value` prop to a form field without an `onChange` handler.',
221 + 'You provided a `value` prop to a form field without an `onChange` handler.',
222 );
223 const node = container.firstChild;
224 expect(isValueDirty(node)).toBe(true);
@@ -1911,7 +1911,7 @@ describe('ReactDOMInput', () => {
1911 root.render(<input type="text" value="zoink" readOnly={false} />);
1912 });
1913 }).toErrorDev(
1914 - 'Warning: You provided a `value` prop to a form ' +
1914 + 'You provided a `value` prop to a form ' +
1915 'field without an `onChange` handler. This will render a read-only ' +
1916 'field. If the field should be mutable use `defaultValue`. ' +
1917 'Otherwise, set either `onChange` or `readOnly`.\n' +
@@ -2048,7 +2048,7 @@ describe('ReactDOMInput', () => {
2048 root.render(<input type="text" />);
2049 });
2050 }).toErrorDev(
2051 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2051 + 'A component is changing a controlled input to be uncontrolled. ' +
2052 'This is likely caused by the value changing from a defined to ' +
2053 'undefined, which should not happen. ' +
2054 'Decide between using a controlled or uncontrolled input ' +
@@ -2071,7 +2071,7 @@ describe('ReactDOMInput', () => {
2071 }).toErrorDev([
2072 '`value` prop on `input` should not be null. ' +
2073 'Consider using an empty string to clear the component or `undefined` for uncontrolled components',
2074 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2074 + 'A component is changing a controlled input to be uncontrolled. ' +
2075 'This is likely caused by the value changing from a defined to ' +
2076 'undefined, which should not happen. ' +
2077 'Decide between using a controlled or uncontrolled input ' +
@@ -2092,7 +2092,7 @@ describe('ReactDOMInput', () => {
2092 root.render(<input type="text" defaultValue="uncontrolled" />);
2093 });
2094 }).toErrorDev(
2095 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2095 + 'A component is changing a controlled input to be uncontrolled. ' +
2096 'This is likely caused by the value changing from a defined to ' +
2097 'undefined, which should not happen. ' +
2098 'Decide between using a controlled or uncontrolled input ' +
@@ -2111,7 +2111,7 @@ describe('ReactDOMInput', () => {
2111 root.render(<input type="text" value="controlled" />);
2112 });
2113 }).toErrorDev(
2114 - 'Warning: A component is changing an uncontrolled input to be controlled. ' +
2114 + 'A component is changing an uncontrolled input to be controlled. ' +
2115 'This is likely caused by the value changing from undefined to ' +
2116 'a defined value, which should not happen. ' +
2117 'Decide between using a controlled or uncontrolled input ' +
@@ -2135,7 +2135,7 @@ describe('ReactDOMInput', () => {
2135 root.render(<input type="text" value="controlled" />);
2136 });
2137 }).toErrorDev(
2138 - 'Warning: A component is changing an uncontrolled input to be controlled. ' +
2138 + 'A component is changing an uncontrolled input to be controlled. ' +
2139 'This is likely caused by the value changing from undefined to ' +
2140 'a defined value, which should not happen. ' +
2141 'Decide between using a controlled or uncontrolled input ' +
@@ -2156,7 +2156,7 @@ describe('ReactDOMInput', () => {
2156 root.render(<input type="checkbox" />);
2157 });
2158 }).toErrorDev(
2159 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2159 + 'A component is changing a controlled input to be uncontrolled. ' +
2160 'This is likely caused by the value changing from a defined to ' +
2161 'undefined, which should not happen. ' +
2162 'Decide between using a controlled or uncontrolled input ' +
@@ -2177,7 +2177,7 @@ describe('ReactDOMInput', () => {
2177 root.render(<input type="checkbox" checked={null} />);
2178 });
2179 }).toErrorDev(
2180 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2180 + 'A component is changing a controlled input to be uncontrolled. ' +
2181 'This is likely caused by the value changing from a defined to ' +
2182 'undefined, which should not happen. ' +
2183 'Decide between using a controlled or uncontrolled input ' +
@@ -2198,7 +2198,7 @@ describe('ReactDOMInput', () => {
2198 root.render(<input type="checkbox" defaultChecked={true} />);
2199 });
2200 }).toErrorDev(
2201 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2201 + 'A component is changing a controlled input to be uncontrolled. ' +
2202 'This is likely caused by the value changing from a defined to ' +
2203 'undefined, which should not happen. ' +
2204 'Decide between using a controlled or uncontrolled input ' +
@@ -2217,7 +2217,7 @@ describe('ReactDOMInput', () => {
2217 root.render(<input type="checkbox" checked={true} />);
2218 });
2219 }).toErrorDev(
2220 - 'Warning: A component is changing an uncontrolled input to be controlled. ' +
2220 + 'A component is changing an uncontrolled input to be controlled. ' +
2221 'This is likely caused by the value changing from undefined to ' +
2222 'a defined value, which should not happen. ' +
2223 'Decide between using a controlled or uncontrolled input ' +
@@ -2236,7 +2236,7 @@ describe('ReactDOMInput', () => {
2236 root.render(<input type="checkbox" checked={true} />);
2237 });
2238 }).toErrorDev(
2239 - 'Warning: A component is changing an uncontrolled input to be controlled. ' +
2239 + 'A component is changing an uncontrolled input to be controlled. ' +
2240 'This is likely caused by the value changing from undefined to ' +
2241 'a defined value, which should not happen. ' +
2242 'Decide between using a controlled or uncontrolled input ' +
@@ -2255,7 +2255,7 @@ describe('ReactDOMInput', () => {
2255 root.render(<input type="radio" />);
2256 });
2257 }).toErrorDev(
2258 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2258 + 'A component is changing a controlled input to be uncontrolled. ' +
2259 'This is likely caused by the value changing from a defined to ' +
2260 'undefined, which should not happen. ' +
2261 'Decide between using a controlled or uncontrolled input ' +
@@ -2274,7 +2274,7 @@ describe('ReactDOMInput', () => {
2274 root.render(<input type="radio" checked={null} />);
2275 });
2276 }).toErrorDev(
2277 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2277 + 'A component is changing a controlled input to be uncontrolled. ' +
2278 'This is likely caused by the value changing from a defined to ' +
2279 'undefined, which should not happen. ' +
2280 'Decide between using a controlled or uncontrolled input ' +
@@ -2293,7 +2293,7 @@ describe('ReactDOMInput', () => {
2293 root.render(<input type="radio" defaultChecked={true} />);
2294 });
2295 }).toErrorDev(
2296 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2296 + 'A component is changing a controlled input to be uncontrolled. ' +
2297 'This is likely caused by the value changing from a defined to ' +
2298 'undefined, which should not happen. ' +
2299 'Decide between using a controlled or uncontrolled input ' +
@@ -2312,7 +2312,7 @@ describe('ReactDOMInput', () => {
2312 root.render(<input type="radio" checked={true} />);
2313 });
2314 }).toErrorDev(
2315 - 'Warning: A component is changing an uncontrolled input to be controlled. ' +
2315 + 'A component is changing an uncontrolled input to be controlled. ' +
2316 'This is likely caused by the value changing from undefined to ' +
2317 'a defined value, which should not happen. ' +
2318 'Decide between using a controlled or uncontrolled input ' +
@@ -2331,7 +2331,7 @@ describe('ReactDOMInput', () => {
2331 root.render(<input type="radio" checked={true} />);
2332 });
2333 }).toErrorDev(
2334 - 'Warning: A component is changing an uncontrolled input to be controlled. ' +
2334 + 'A component is changing an uncontrolled input to be controlled. ' +
2335 'This is likely caused by the value changing from undefined to ' +
2336 'a defined value, which should not happen. ' +
2337 'Decide between using a controlled or uncontrolled input ' +
@@ -2395,7 +2395,7 @@ describe('ReactDOMInput', () => {
2395 root.render(<input type="radio" value="value" />);
2396 });
2397 }).toErrorDev(
2398 - 'Warning: A component is changing a controlled input to be uncontrolled. ' +
2398 + 'A component is changing a controlled input to be uncontrolled. ' +
2399 'This is likely caused by the value changing from a defined to ' +
2400 'undefined, which should not happen. ' +
2401 'Decide between using a controlled or uncontrolled input ' +
packages/react-dom/src/__tests__/ReactDOMInvalidARIAHook-test.js
+5 -5
@@ -36,7 +36,7 @@ describe('ReactDOMInvalidARIAHook', () => {
36 });
37 it('should warn for one invalid aria-* prop', async () => {
38 await expect(() => mountComponent({'aria-badprop': 'maybe'})).toErrorDev(
39 - 'Warning: Invalid aria prop `aria-badprop` on <div> tag. ' +
39 + 'Invalid aria prop `aria-badprop` on <div> tag. ' +
40 'For details, see https://react.dev/link/invalid-aria-props',
41 );
42 });
@@ -47,14 +47,14 @@ describe('ReactDOMInvalidARIAHook', () => {
47 'aria-malprop': 'Turbulent seas',
48 }),
49 ).toErrorDev(
50 - 'Warning: Invalid aria props `aria-badprop`, `aria-malprop` on <div> ' +
50 + 'Invalid aria props `aria-badprop`, `aria-malprop` on <div> ' +
51 'tag. For details, see https://react.dev/link/invalid-aria-props',
52 );
53 });
54 it('should warn for an improperly cased aria-* prop', async () => {
55 // The valid attribute name is aria-haspopup.
56 await expect(() => mountComponent({'aria-hasPopup': 'true'})).toErrorDev(
57 - 'Warning: Unknown ARIA attribute `aria-hasPopup`. ' +
57 + 'Unknown ARIA attribute `aria-hasPopup`. ' +
58 'Did you mean `aria-haspopup`?',
59 );
60 });
@@ -62,7 +62,7 @@ describe('ReactDOMInvalidARIAHook', () => {
62 it('should warn for use of recognized camel case aria attributes', async () => {
63 // The valid attribute name is aria-haspopup.
64 await expect(() => mountComponent({ariaHasPopup: 'true'})).toErrorDev(
65 - 'Warning: Invalid ARIA attribute `ariaHasPopup`. ' +
65 + 'Invalid ARIA attribute `ariaHasPopup`. ' +
66 'Did you mean `aria-haspopup`?',
67 );
68 });
@@ -72,7 +72,7 @@ describe('ReactDOMInvalidARIAHook', () => {
72 await expect(() =>
73 mountComponent({ariaSomethingInvalid: 'true'}),
74 ).toErrorDev(
75 - 'Warning: Invalid ARIA attribute `ariaSomethingInvalid`. ARIA ' +
75 + 'Invalid ARIA attribute `ariaSomethingInvalid`. ARIA ' +
76 'attributes follow the pattern aria-* and must be lowercase.',
77 );
78 });
packages/react-dom/src/__tests__/ReactDOMOption-test.js
+1 -1
@@ -266,7 +266,7 @@ describe('ReactDOMOption', () => {
266 onRecoverableError: () => {},
267 });
268 });
269 - }).toErrorDev(['Warning: In HTML, <div> cannot be a child of <option>']);
269 + }).toErrorDev(['In HTML, <div> cannot be a child of <option>']);
270 option = container.firstChild.firstChild;
271
272 expect(option.textContent).toBe('BarFooBaz');
packages/react-dom/src/__tests__/ReactDOMSelect-test.js
+4 -4
@@ -1694,7 +1694,7 @@ describe('ReactDOMSelect', () => {
1694 );
1695 });
1696 }).toErrorDev(
1697 - 'Warning: You provided a `value` prop to a form ' +
1697 + 'You provided a `value` prop to a form ' +
1698 'field without an `onChange` handler. This will render a read-only ' +
1699 'field. If the field should be mutable use `defaultValue`. ' +
1700 'Otherwise, set `onChange`.',
@@ -1715,7 +1715,7 @@ describe('ReactDOMSelect', () => {
1715 );
1716 });
1717 }).toErrorDev(
1718 - 'Warning: You provided a `value` prop to a form ' +
1718 + 'You provided a `value` prop to a form ' +
1719 'field without an `onChange` handler. This will render a read-only ' +
1720 'field. If the field should be mutable use `defaultValue`. ' +
1721 'Otherwise, set `onChange`.',
@@ -1736,7 +1736,7 @@ describe('ReactDOMSelect', () => {
1736 );
1737 });
1738 }).toErrorDev(
1739 - 'Warning: You provided a `value` prop to a form ' +
1739 + 'You provided a `value` prop to a form ' +
1740 'field without an `onChange` handler. This will render a read-only ' +
1741 'field. If the field should be mutable use `defaultValue`. ' +
1742 'Otherwise, set `onChange`.',
@@ -1757,7 +1757,7 @@ describe('ReactDOMSelect', () => {
1757 );
1758 });
1759 }).toErrorDev(
1760 - 'Warning: You provided a `value` prop to a form ' +
1760 + 'You provided a `value` prop to a form ' +
1761 'field without an `onChange` handler. This will render a read-only ' +
1762 'field. If the field should be mutable use `defaultValue`. ' +
1763 'Otherwise, set `onChange`.',
packages/react-dom/src/__tests__/ReactDOMServerIntegrationElements-test.js
+3 -3
@@ -987,7 +987,7 @@ describe('ReactDOMServerIntegration', () => {
987 expect(() => {
988 EmptyComponent = <EmptyComponent />;
989 }).toErrorDev(
990 - 'Warning: React.jsx: type is invalid -- expected a string ' +
990 + 'React.jsx: type is invalid -- expected a string ' +
991 '(for built-in components) or a class/function (for composite ' +
992 'components) but got: object. You likely forgot to export your ' +
993 "component from the file it's defined in, or you might have mixed up " +
@@ -1011,7 +1011,7 @@ describe('ReactDOMServerIntegration', () => {
1011 expect(() => {
1012 NullComponent = <NullComponent />;
1013 }).toErrorDev(
1014 - 'Warning: React.jsx: type is invalid -- expected a string ' +
1014 + 'React.jsx: type is invalid -- expected a string ' +
1015 '(for built-in components) or a class/function (for composite ' +
1016 'components) but got: null.',
1017 {withoutStack: true},
@@ -1029,7 +1029,7 @@ describe('ReactDOMServerIntegration', () => {
1029 expect(() => {
1030 UndefinedComponent = <UndefinedComponent />;
1031 }).toErrorDev(
1032 - 'Warning: React.jsx: type is invalid -- expected a string ' +
1032 + 'React.jsx: type is invalid -- expected a string ' +
1033 '(for built-in components) or a class/function (for composite ' +
1034 'components) but got: undefined. You likely forgot to export your ' +
1035 "component from the file it's defined in, or you might have mixed up " +
packages/react-dom/src/__tests__/ReactDOMServerIntegrationLegacyContext-test.js
+1 -1
@@ -314,7 +314,7 @@ describe('ReactDOMServerIntegration', () => {
314 expect(() => {
315 ReactDOMServer.renderToString(<MyComponent />);
316 }).toErrorDev(
317 - 'Warning: MyComponent.getChildContext(): childContextTypes must be defined in order to use getChildContext().\n' +
317 + 'MyComponent.getChildContext(): childContextTypes must be defined in order to use getChildContext().\n' +
318 ' in MyComponent (at **)',
319 );
320 });
packages/react-dom/src/__tests__/ReactDOMServerIntegrationRefs-test.js
+1 -1
@@ -96,7 +96,7 @@ describe('ReactDOMServerIntegration', () => {
96 true,
97 );
98 }).toErrorDev([
99 - 'Warning: Component "RefsComponent" contains the string ref "myDiv". ' +
99 + 'Component "RefsComponent" contains the string ref "myDiv". ' +
100 'Support for string refs will be removed in a future major release. ' +
101 'We recommend using useRef() or createRef() instead. ' +
102 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
packages/react-dom/src/__tests__/ReactDOMServerLifecycles-test.js
+1 -1
@@ -260,7 +260,7 @@ describe('ReactDOMServerLifecycles', () => {
260 '<div>1-2</div>',
261 );
262 }).toErrorDev(
263 - 'Warning: Can only update a mounting component. This ' +
263 + 'Can only update a mounting component. This ' +
264 'usually means you called setState() outside componentWillMount() on ' +
265 'the server. This is a no-op.\n\n' +
266 'Please check the code for the Outer component.',
packages/react-dom/src/__tests__/ReactDOMShorthandCSSPropertyCollision-test.js
+8 -8
@@ -34,7 +34,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
34 root.render(<div style={{font: 'foo'}} />);
35 });
36 }).toErrorDev(
37 - 'Warning: Removing a style property during rerender (fontStyle) ' +
37 + 'Removing a style property during rerender (fontStyle) ' +
38 'when a conflicting property is set (font) can lead to styling ' +
39 "bugs. To avoid this, don't mix shorthand and non-shorthand " +
40 'properties for the same value; instead, replace the shorthand ' +
@@ -55,7 +55,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
55 root.render(<div style={{font: 'qux', fontStyle: 'baz'}} />);
56 });
57 }).toErrorDev(
58 - 'Warning: Updating a style property during rerender (font) when ' +
58 + 'Updating a style property during rerender (font) when ' +
59 'a conflicting property is set (fontStyle) can lead to styling ' +
60 "bugs. To avoid this, don't mix shorthand and non-shorthand " +
61 'properties for the same value; instead, replace the shorthand ' +
@@ -67,7 +67,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
67 root.render(<div style={{fontStyle: 'baz'}} />);
68 });
69 }).toErrorDev(
70 - 'Warning: Removing a style property during rerender (font) when ' +
70 + 'Removing a style property during rerender (font) when ' +
71 'a conflicting property is set (fontStyle) can lead to styling ' +
72 "bugs. To avoid this, don't mix shorthand and non-shorthand " +
73 'properties for the same value; instead, replace the shorthand ' +
@@ -87,7 +87,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
87 root.render(<div style={{background: 'yellow'}} />);
88 });
89 }).toErrorDev(
90 - 'Warning: Removing a style property during rerender ' +
90 + 'Removing a style property during rerender ' +
91 '(backgroundPosition) when a conflicting property is set ' +
92 "(background) can lead to styling bugs. To avoid this, don't mix " +
93 'shorthand and non-shorthand properties for the same value; ' +
@@ -110,7 +110,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
110 root.render(<div style={{backgroundPosition: 'top'}} />);
111 });
112 }).toErrorDev(
113 - 'Warning: Removing a style property during rerender (background) ' +
113 + 'Removing a style property during rerender (background) ' +
114 'when a conflicting property is set (backgroundPosition) can lead ' +
115 "to styling bugs. To avoid this, don't mix shorthand and " +
116 'non-shorthand properties for the same value; instead, replace the ' +
@@ -129,7 +129,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
129 root.render(<div style={{borderLeft: '1px solid red'}} />);
130 });
131 }).toErrorDev(
132 - 'Warning: Removing a style property during rerender (borderStyle) ' +
132 + 'Removing a style property during rerender (borderStyle) ' +
133 'when a conflicting property is set (borderLeft) can lead to ' +
134 "styling bugs. To avoid this, don't mix shorthand and " +
135 'non-shorthand properties for the same value; instead, replace the ' +
@@ -143,7 +143,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
143 );
144 });
145 }).toErrorDev(
146 - 'Warning: Updating a style property during rerender (borderStyle) ' +
146 + 'Updating a style property during rerender (borderStyle) ' +
147 'when a conflicting property is set (borderLeft) can lead to ' +
148 "styling bugs. To avoid this, don't mix shorthand and " +
149 'non-shorthand properties for the same value; instead, replace the ' +
@@ -161,7 +161,7 @@ describe('ReactDOMShorthandCSSPropertyCollision', () => {
161 root.render(<div style={{borderStyle: 'dotted'}} />);
162 });
163 }).toErrorDev(
164 - 'Warning: Removing a style property during rerender (borderLeft) ' +
164 + 'Removing a style property during rerender (borderLeft) ' +
165 'when a conflicting property is set (borderStyle) can lead to ' +
166 "styling bugs. To avoid this, don't mix shorthand and " +
167 'non-shorthand properties for the same value; instead, replace the ' +
packages/react-dom/src/__tests__/ReactDOMSingletonComponents-test.js
+1 -1
@@ -165,7 +165,7 @@ describe('ReactDOM HostSingleton', () => {
165 await expect(async () => {
166 await waitForAll([]);
167 }).toErrorDev(
168 - 'Warning: You are mounting a new head component when a previous one has not first unmounted. It is an error to render more than one head component at a time and attributes and children of these components will likely fail in unpredictable ways. Please only render a single instance of <head> and if you need to mount a new one, ensure any previous ones have unmounted first',
168 + 'You are mounting a new head component when a previous one has not first unmounted. It is an error to render more than one head component at a time and attributes and children of these components will likely fail in unpredictable ways. Please only render a single instance of <head> and if you need to mount a new one, ensure any previous ones have unmounted first',
169 );
170 expect(getVisibleChildren(document)).toEqual(
171 <html>
packages/react-dom/src/__tests__/ReactDOMTextarea-test.js
+4 -4
@@ -1059,7 +1059,7 @@ describe('ReactDOMTextarea', () => {
1059 root.render(<textarea value={false} />);
1060 });
1061 }).toErrorDev(
1062 - 'Warning: You provided a `value` prop to a form ' +
1062 + 'You provided a `value` prop to a form ' +
1063 'field without an `onChange` handler. This will render a read-only ' +
1064 'field. If the field should be mutable use `defaultValue`. ' +
1065 'Otherwise, set either `onChange` or `readOnly`.',
@@ -1074,7 +1074,7 @@ describe('ReactDOMTextarea', () => {
1074 root.render(<textarea value={0} />);
1075 });
1076 }).toErrorDev(
1077 - 'Warning: You provided a `value` prop to a form ' +
1077 + 'You provided a `value` prop to a form ' +
1078 'field without an `onChange` handler. This will render a read-only ' +
1079 'field. If the field should be mutable use `defaultValue`. ' +
1080 'Otherwise, set either `onChange` or `readOnly`.',
@@ -1089,7 +1089,7 @@ describe('ReactDOMTextarea', () => {
1089 root.render(<textarea value="0" />);
1090 });
1091 }).toErrorDev(
1092 - 'Warning: You provided a `value` prop to a form ' +
1092 + 'You provided a `value` prop to a form ' +
1093 'field without an `onChange` handler. This will render a read-only ' +
1094 'field. If the field should be mutable use `defaultValue`. ' +
1095 'Otherwise, set either `onChange` or `readOnly`.',
@@ -1104,7 +1104,7 @@ describe('ReactDOMTextarea', () => {
1104 root.render(<textarea value="" />);
1105 });
1106 }).toErrorDev(
1107 - 'Warning: You provided a `value` prop to a form ' +
1107 + 'You provided a `value` prop to a form ' +
1108 'field without an `onChange` handler. This will render a read-only ' +
1109 'field. If the field should be mutable use `defaultValue`. ' +
1110 'Otherwise, set either `onChange` or `readOnly`.',
packages/react-dom/src/__tests__/ReactDeprecationWarnings-test.js
+5 -5
@@ -38,7 +38,7 @@ describe('ReactDeprecationWarnings', () => {
38
39 ReactNoop.render(<FunctionalComponent />);
40 await expect(async () => await waitForAll([])).toErrorDev(
41 - 'Warning: FunctionalComponent: Support for defaultProps ' +
41 + 'FunctionalComponent: Support for defaultProps ' +
42 'will be removed from function components in a future major ' +
43 'release. Use JavaScript default parameters instead.',
44 );
@@ -60,7 +60,7 @@ describe('ReactDeprecationWarnings', () => {
60 </div>,
61 );
62 await expect(async () => await waitForAll([])).toErrorDev(
63 - 'Warning: FunctionalComponent: Support for defaultProps ' +
63 + 'FunctionalComponent: Support for defaultProps ' +
64 'will be removed from memo components in a future major ' +
65 'release. Use JavaScript default parameters instead.',
66 );
@@ -81,7 +81,7 @@ describe('ReactDeprecationWarnings', () => {
81
82 ReactNoop.render(<Component />);
83 await expect(async () => await waitForAll([])).toErrorDev(
84 - 'Warning: Component "Component" contains the string ref "refComponent". ' +
84 + 'Component "Component" contains the string ref "refComponent". ' +
85 'Support for string refs will be removed in a future major release. ' +
86 'We recommend using useRef() or createRef() instead. ' +
87 'Learn more about using refs safely here: ' +
@@ -138,7 +138,7 @@ describe('ReactDeprecationWarnings', () => {
138
139 ReactNoop.render(<Component />);
140 await expect(async () => await waitForAll([])).toErrorDev([
141 - 'Warning: Component "Component" contains the string ref "refComponent". ' +
141 + 'Component "Component" contains the string ref "refComponent". ' +
142 'Support for string refs will be removed in a future major release. ' +
143 'This case cannot be automatically converted to an arrow function. ' +
144 'We ask you to manually fix this case by using useRef() or createRef() instead. ' +
@@ -170,7 +170,7 @@ describe('ReactDeprecationWarnings', () => {
170
171 ReactNoop.render(<Component />);
172 await expect(async () => await waitForAll([])).toErrorDev([
173 - 'Warning: Component "Component" contains the string ref "refComponent". ' +
173 + 'Component "Component" contains the string ref "refComponent". ' +
174 'Support for string refs will be removed in a future major release. ' +
175 'This case cannot be automatically converted to an arrow function. ' +
176 'We ask you to manually fix this case by using useRef() or createRef() instead. ' +
packages/react-dom/src/__tests__/ReactFunctionComponent-test.js
+7 -7
@@ -214,7 +214,7 @@ describe('ReactFunctionComponent', () => {
214 root.render(<ParentUsingStringRef />);
215 });
216 }).toErrorDev(
217 - 'Warning: Function components cannot be given refs. ' +
217 + 'Function components cannot be given refs. ' +
218 'Attempts to access this ref will fail. ' +
219 'Did you mean to use React.forwardRef()?\n\n' +
220 'Check the render method ' +
@@ -257,7 +257,7 @@ describe('ReactFunctionComponent', () => {
257 root.render(<ParentUsingFunctionRef />);
258 });
259 }).toErrorDev(
260 - 'Warning: Function components cannot be given refs. ' +
260 + 'Function components cannot be given refs. ' +
261 'Attempts to access this ref will fail. ' +
262 'Did you mean to use React.forwardRef()?\n\n' +
263 'Check the render method ' +
@@ -297,7 +297,7 @@ describe('ReactFunctionComponent', () => {
297 <AnonymousParentUsingJSX ref={current => (instance1 = current)} />,
298 );
299 });
300 - }).toErrorDev('Warning: Function components cannot be given refs.');
300 + }).toErrorDev('Function components cannot be given refs.');
301 // Should be deduped (offending element is on the same line):
302 instance1.forceUpdate();
303 // Should also be deduped (offending element is on the same line):
@@ -326,7 +326,7 @@ describe('ReactFunctionComponent', () => {
326 <AnonymousParentNotUsingJSX ref={current => (instance2 = current)} />,
327 );
328 });
329 - }).toErrorDev('Warning: Function components cannot be given refs.');
329 + }).toErrorDev('Function components cannot be given refs.');
330 // Should be deduped (same internal instance, no additional warnings)
331 instance2.forceUpdate();
332 // Could not be differentiated (since owner is anonymous and no source location)
@@ -354,7 +354,7 @@ describe('ReactFunctionComponent', () => {
354 <NamedParentNotUsingJSX ref={current => (instance3 = current)} />,
355 );
356 });
357 - }).toErrorDev('Warning: Function components cannot be given refs.');
357 + }).toErrorDev('Function components cannot be given refs.');
358 // Should be deduped (same owner name, no additional warnings):
359 instance3.forceUpdate();
360 // Should also be deduped (same owner name, no additional warnings):
@@ -398,7 +398,7 @@ describe('ReactFunctionComponent', () => {
398 root.render(<Parent />);
399 });
400 }).toErrorDev(
401 - 'Warning: Function components cannot be given refs. ' +
401 + 'Function components cannot be given refs. ' +
402 'Attempts to access this ref will fail. ' +
403 'Did you mean to use React.forwardRef()?\n\n' +
404 'Check the render method ' +
@@ -441,7 +441,7 @@ describe('ReactFunctionComponent', () => {
441 });
442 expect(container.textContent).toBe('2');
443 }).toErrorDev([
444 - 'Warning: Child: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.',
444 + 'Child: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.',
445 ]);
446 });
447
packages/react-dom/src/__tests__/ReactLegacyErrorBoundaries-test.internal.js
+2 -2
@@ -2106,7 +2106,7 @@ describe('ReactLegacyErrorBoundaries', () => {
2106 });
2107 }).rejects.toThrow('got: null');
2108 }).toErrorDev(
2109 - 'Warning: React.jsx: type is invalid -- expected a string ' +
2109 + 'React.jsx: type is invalid -- expected a string ' +
2110 '(for built-in components) or a class/function ' +
2111 '(for composite components) but got: null.',
2112 {withoutStack: 1},
@@ -2120,7 +2120,7 @@ describe('ReactLegacyErrorBoundaries', () => {
2120 });
2121 }).rejects.toThrow('got: undefined');
2122 }).toErrorDev(
2123 - 'Warning: React.jsx: type is invalid -- expected a string ' +
2123 + 'React.jsx: type is invalid -- expected a string ' +
2124 '(for built-in components) or a class/function ' +
2125 '(for composite components) but got: undefined.',
2126 {withoutStack: 1},
packages/react-dom/src/__tests__/ReactLegacyMount-test.js
+2 -2
@@ -169,7 +169,7 @@ describe('ReactMount', () => {
169 const rootNode = container.firstChild;
170
171 expect(() => ReactDOM.render(<span />, rootNode)).toErrorDev(
172 - 'Warning: Replacing React-rendered children with a new ' +
172 + 'Replacing React-rendered children with a new ' +
173 'root component. If you intended to update the children of this node, ' +
174 'you should instead have the existing children update their state and ' +
175 'render the new components instead of calling ReactDOM.render.',
@@ -198,7 +198,7 @@ describe('ReactMount', () => {
198 expect(ReactDOM).not.toEqual(ReactDOMOther);
199
200 expect(() => ReactDOMOther.unmountComponentAtNode(container)).toErrorDev(
201 - "Warning: unmountComponentAtNode(): The node you're attempting to unmount " +
201 + "unmountComponentAtNode(): The node you're attempting to unmount " +
202 'was rendered by another copy of React.',
203 {withoutStack: true},
204 );
packages/react-dom/src/__tests__/ReactLegacyUpdates-test.js
+2 -2
@@ -935,7 +935,7 @@ describe('ReactLegacyUpdates', () => {
935 );
936 }).toErrorDev(
937 'Expected the last optional `callback` argument to be ' +
938 - 'a function. Instead received: [object Object].',
938 + "a function. Instead received: { foo: 'bar' }.",
939 {withoutStack: 1},
940 );
941 // Make sure the warning is deduplicated and doesn't fire again
@@ -996,7 +996,7 @@ describe('ReactLegacyUpdates', () => {
996 );
997 }).toErrorDev(
998 'Expected the last optional `callback` argument to be ' +
999 - 'a function. Instead received: [object Object].',
999 + "a function. Instead received: { foo: 'bar' }.",
1000 {withoutStack: 1},
1001 );
1002 // Make sure the warning is deduplicated and doesn't fire again
packages/react-dom/src/__tests__/ReactMountDestruction-test.js
+2 -2
@@ -64,7 +64,7 @@ describe('ReactMount', () => {
64 // Test that unmounting at a root node gives a helpful warning
65 const rootDiv = mainContainerDiv.firstChild;
66 expect(() => ReactDOM.unmountComponentAtNode(rootDiv)).toErrorDev(
67 - "Warning: unmountComponentAtNode(): The node you're attempting to " +
67 + "unmountComponentAtNode(): The node you're attempting to " +
68 'unmount was rendered by React and is not a top-level container. You ' +
69 'may have accidentally passed in a React root node instead of its ' +
70 'container.',
@@ -89,7 +89,7 @@ describe('ReactMount', () => {
89 // Test that unmounting at a non-root node gives a different warning
90 const nonRootDiv = mainContainerDiv.firstChild.firstChild;
91 expect(() => ReactDOM.unmountComponentAtNode(nonRootDiv)).toErrorDev(
92 - "Warning: unmountComponentAtNode(): The node you're attempting to " +
92 + "unmountComponentAtNode(): The node you're attempting to " +
93 'unmount was rendered by React and is not a top-level container. ' +
94 'Instead, have the parent component update its state and rerender in ' +
95 'order to remove this component.',
packages/react-dom/src/__tests__/ReactMultiChildText-test.js
+2 -2
@@ -169,8 +169,8 @@ describe('ReactMultiChildText', () => {
169 ['', 'foo', <div>{true}{<div />}{1.2}{''}</div>, 'foo'], ['', 'foo', <div />, 'foo'],
170 ]);
171 }).toErrorDev([
172 - 'Warning: Each child in a list should have a unique "key" prop.',
173 - 'Warning: Each child in a list should have a unique "key" prop.',
172 + 'Each child in a list should have a unique "key" prop.',
173 + 'Each child in a list should have a unique "key" prop.',
174 ]);
175 });
176
packages/react-dom/src/__tests__/ReactRenderDocument-test.js
+1 -1
@@ -292,7 +292,7 @@ describe('rendering React components at document', () => {
292 favorSafetyOverHydrationPerf
293 ? []
294 : [
295 - "Warning: A tree hydrated but some attributes of the server rendered HTML didn't match the client properties.",
295 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties.",
296 ],
297 {withoutStack: true},
298 );
packages/react-dom/src/__tests__/ReactServerRendering-test.js
+7 -7
@@ -592,7 +592,7 @@ describe('ReactDOMServer', () => {
592
593 ReactDOMServer.renderToString(<Foo />);
594 expect(() => jest.runOnlyPendingTimers()).toErrorDev(
595 - 'Warning: Can only update a mounting component.' +
595 + 'Can only update a mounting component.' +
596 ' This usually means you called setState() outside componentWillMount() on the server.' +
597 ' This is a no-op.\n\nPlease check the code for the Foo component.',
598 {withoutStack: true},
@@ -620,7 +620,7 @@ describe('ReactDOMServer', () => {
620
621 ReactDOMServer.renderToString(<Baz />);
622 expect(() => jest.runOnlyPendingTimers()).toErrorDev(
623 - 'Warning: Can only update a mounting component. ' +
623 + 'Can only update a mounting component. ' +
624 'This usually means you called forceUpdate() outside componentWillMount() on the server. ' +
625 'This is a no-op.\n\nPlease check the code for the Baz component.',
626 {withoutStack: true},
@@ -732,11 +732,11 @@ describe('ReactDOMServer', () => {
732 </div>,
733 ),
734 ).toErrorDev([
735 - 'Warning: <inPUT /> is using incorrect casing. ' +
735 + '<inPUT /> is using incorrect casing. ' +
736 'Use PascalCase for React components, ' +
737 'or lowercase for HTML elements.',
738 // linearGradient doesn't warn
739 - 'Warning: <iFrame /> is using incorrect casing. ' +
739 + '<iFrame /> is using incorrect casing. ' +
740 'Use PascalCase for React components, ' +
741 'or lowercase for HTML elements.',
742 ]);
@@ -746,7 +746,7 @@ describe('ReactDOMServer', () => {
746 expect(() =>
747 ReactDOMServer.renderToString(<div contentEditable={true} children="" />),
748 ).toErrorDev(
749 - 'Warning: A component is `contentEditable` and contains `children` ' +
749 + 'A component is `contentEditable` and contains `children` ' +
750 'managed by React. It is now your responsibility to guarantee that ' +
751 'none of those nodes are unexpectedly modified or duplicated. This ' +
752 'is probably not intentional.\n in div (at **)',
@@ -765,7 +765,7 @@ describe('ReactDOMServer', () => {
765 ReactDOMServer.renderToString(<ClassWithRenderNotExtended />),
766 ).toThrow(TypeError);
767 }).toErrorDev(
768 - 'Warning: The <ClassWithRenderNotExtended /> component appears to have a render method, ' +
768 + 'The <ClassWithRenderNotExtended /> component appears to have a render method, ' +
769 "but doesn't extend React.Component. This is likely to cause errors. " +
770 'Change ClassWithRenderNotExtended to extend React.Component instead.',
771 );
@@ -923,7 +923,7 @@ describe('ReactDOMServer', () => {
923 expect(() => {
924 ReactDOMServer.renderToString(<ComponentA />);
925 }).toErrorDev(
926 - 'Warning: ComponentA defines an invalid contextType. ' +
926 + 'ComponentA defines an invalid contextType. ' +
927 'contextType should point to the Context object returned by React.createContext(). ' +
928 'Did you accidentally pass the Context.Consumer instead?',
929 );
packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js
+3 -3
@@ -145,7 +145,7 @@ describe('ReactDOMServerHydration', () => {
145 favorSafetyOverHydrationPerf
146 ? []
147 : [
148 - " A tree hydrated but some attributes of the server rendered HTML didn't match the client properties.",
148 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties.",
149 ],
150 {withoutStack: true},
151 );
@@ -545,7 +545,7 @@ describe('ReactDOMServerHydration', () => {
545 favorSafetyOverHydrationPerf
546 ? []
547 : [
548 - " A tree hydrated but some attributes of the server rendered HTML didn't match the client properties.",
548 + "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties.",
549 ],
550 {withoutStack: true},
551 );
@@ -598,7 +598,7 @@ describe('ReactDOMServerHydration', () => {
598 ReactDOMClient.hydrateRoot(element, jsx);
599 });
600 }).toErrorDev(
601 - `Warning: Assignment to read-only property will result in a no-op: \`${readOnlyProperty}\``,
601 + `Assignment to read-only property will result in a no-op: \`${readOnlyProperty}\``,
602 );
603 }
604 });
packages/react-dom/src/__tests__/ReactUpdates-test.js
+2 -2
@@ -1804,7 +1804,7 @@ describe('ReactUpdates', () => {
1804 await act(() => ReactDOM.flushSync(() => root.render(<App />)));
1805 }).rejects.toThrow('Maximum update depth exceeded');
1806 }).toErrorDev(
1807 - 'Warning: Cannot update a component (`App`) while rendering a different component (`Child`)',
1807 + 'Cannot update a component (`App`) while rendering a different component (`Child`)',
1808 );
1809 });
1810
@@ -1839,7 +1839,7 @@ describe('ReactUpdates', () => {
1839 }
1840 expect(error.message).toMatch('Maximum update depth exceeded');
1841 }).toErrorDev(
1842 - 'Warning: Cannot update a component (`App`) while rendering a different component (`Child`)',
1842 + 'Cannot update a component (`App`) while rendering a different component (`Child`)',
1843 );
1844 });
1845
packages/react-dom/src/__tests__/findDOMNodeFB-test.js
+2 -2
@@ -130,7 +130,7 @@ describe('findDOMNode', () => {
130
131 let match;
132 expect(() => (match = ReactDOM.findDOMNode(parent))).toErrorDev([
133 - 'Warning: findDOMNode is deprecated in StrictMode. ' +
133 + 'findDOMNode is deprecated in StrictMode. ' +
134 'findDOMNode was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
135 'Instead, add a ref directly to the element you want to reference. ' +
136 'Learn more about using refs safely here: ' +
@@ -163,7 +163,7 @@ describe('findDOMNode', () => {
163
164 let match;
165 expect(() => (match = ReactDOM.findDOMNode(parent))).toErrorDev([
166 - 'Warning: findDOMNode is deprecated in StrictMode. ' +
166 + 'findDOMNode is deprecated in StrictMode. ' +
167 'findDOMNode was passed an instance of IsInStrictMode which is inside StrictMode. ' +
168 'Instead, add a ref directly to the element you want to reference. ' +
169 'Learn more about using refs safely here: ' +
packages/react-dom/src/__tests__/refs-test.js
+4 -4
@@ -122,7 +122,7 @@ describe('reactiverefs', () => {
122 );
123 });
124 }).toErrorDev([
125 - 'Warning: Component "TestRefsComponent" contains the string ' +
125 + 'Component "TestRefsComponent" contains the string ' +
126 'ref "resetDiv". Support for string refs will be removed in a ' +
127 'future major release. We recommend using useRef() or createRef() ' +
128 'instead. Learn more about using refs safely ' +
@@ -130,7 +130,7 @@ describe('reactiverefs', () => {
130 ' in div (at **)\n' +
131 ' in div (at **)\n' +
132 ' in TestRefsComponent (at **)',
133 - 'Warning: Component "ClickCounter" contains the string ' +
133 + 'Component "ClickCounter" contains the string ' +
134 'ref "clickLog0". Support for string refs will be removed in a ' +
135 'future major release. We recommend using useRef() or createRef() ' +
136 'instead. Learn more about using refs safely ' +
@@ -336,7 +336,7 @@ describe('ref swapping', () => {
336 root.render(<A ref={current => (a = current)} />);
337 });
338 }).toErrorDev([
339 - 'Warning: Component "A" contains the string ref "1". ' +
339 + 'Component "A" contains the string ref "1". ' +
340 'Support for string refs will be removed in a future major release. ' +
341 'We recommend using useRef() or createRef() instead. ' +
342 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
@@ -565,7 +565,7 @@ describe('strings refs across renderers', () => {
565 );
566 });
567 }).toErrorDev([
568 - 'Warning: Component "Parent" contains the string ref "child1". ' +
568 + 'Component "Parent" contains the string ref "child1". ' +
569 'Support for string refs will be removed in a future major release. ' +
570 'We recommend using useRef() or createRef() instead. ' +
571 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
packages/react-dom/src/__tests__/validateDOMNesting-test.js
+1 -1
@@ -126,7 +126,7 @@ describe('validateDOMNesting', () => {
126 'This will cause a hydration error.\n' +
127 ' in body (at **)\n' +
128 ' in foreignObject (at **)',
129 - 'Warning: You are mounting a new body component when a previous one has not first unmounted. It is an error to render more than one body component at a time and attributes and children of these components will likely fail in unpredictable ways. Please only render a single instance of <body> and if you need to mount a new one, ensure any previous ones have unmounted first.\n' +
129 + 'You are mounting a new body component when a previous one has not first unmounted. It is an error to render more than one body component at a time and attributes and children of these components will likely fail in unpredictable ways. Please only render a single instance of <body> and if you need to mount a new one, ensure any previous ones have unmounted first.\n' +
130 ' in body (at **)',
131 ],
132 );
packages/react-dom/src/client/__tests__/trustedTypes-test.internal.js
+2 -2
@@ -245,7 +245,7 @@ describe('when Trusted Types are available in global object', () => {
245 root.render(<Component />);
246 });
247 }).toErrorDev(
248 - "Warning: Using 'dangerouslySetInnerHTML' in an svg element with " +
248 + "Using 'dangerouslySetInnerHTML' in an svg element with " +
249 'Trusted Types enabled in an Internet Explorer will cause ' +
250 'the trusted value to be converted to string. Assigning string ' +
251 "to 'innerHTML' will throw an error if Trusted Types are enforced. " +
@@ -263,7 +263,7 @@ describe('when Trusted Types are available in global object', () => {
263 root.render(<script>alert("I am not executed")</script>);
264 });
265 }).toErrorDev(
266 - 'Warning: Encountered a script tag while rendering React component. ' +
266 + 'Encountered a script tag while rendering React component. ' +
267 'Scripts inside React components are never executed when rendering ' +
268 'on the client. Consider using template tag instead ' +
269 '(https://developer.mozilla.org/en-US/docs/Web/HTML/Element/template).\n' +
packages/react-native-renderer/src/ReactNativeFiberHostComponent.js
+1 -1
@@ -92,7 +92,7 @@ class ReactNativeFiberHostComponent implements INativeMethods {
92 if (relativeNode == null) {
93 if (__DEV__) {
94 console.error(
95 - 'Warning: ref.measureLayout must be called with a node handle or a ref to a native component.',
95 + 'ref.measureLayout must be called with a node handle or a ref to a native component.',
96 );
97 }
98
packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js
+5 -5
@@ -18,7 +18,7 @@ let StrictMode;
18 let act;
19
20 const DISPATCH_COMMAND_REQUIRES_HOST_COMPONENT =
21 - "Warning: dispatchCommand was called with a ref that isn't a " +
21 + "dispatchCommand was called with a ref that isn't a " +
22 'native component. Use React.forwardRef to get access to the underlying native component';
23
24 const SEND_ACCESSIBILITY_EVENT_REQUIRES_HOST_COMPONENT =
@@ -898,7 +898,7 @@ describe('ReactFabric', () => {
898 expect(
899 () => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
900 ).toErrorDev([
901 - 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
901 + 'findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
902 'findHostInstance_DEPRECATED was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
903 'Instead, add a ref directly to the element you want to reference. ' +
904 'Learn more about using refs safely here: ' +
@@ -937,7 +937,7 @@ describe('ReactFabric', () => {
937 expect(
938 () => (match = ReactFabric.findHostInstance_DEPRECATED(parent)),
939 ).toErrorDev([
940 - 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
940 + 'findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
941 'findHostInstance_DEPRECATED was passed an instance of IsInStrictMode which is inside StrictMode. ' +
942 'Instead, add a ref directly to the element you want to reference. ' +
943 'Learn more about using refs safely here: ' +
@@ -976,7 +976,7 @@ describe('ReactFabric', () => {
976
977 let match;
978 expect(() => (match = ReactFabric.findNodeHandle(parent))).toErrorDev([
979 - 'Warning: findNodeHandle is deprecated in StrictMode. ' +
979 + 'findNodeHandle is deprecated in StrictMode. ' +
980 'findNodeHandle was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
981 'Instead, add a ref directly to the element you want to reference. ' +
982 'Learn more about using refs safely here: ' +
@@ -1015,7 +1015,7 @@ describe('ReactFabric', () => {
1015
1016 let match;
1017 expect(() => (match = ReactFabric.findNodeHandle(parent))).toErrorDev([
1018 - 'Warning: findNodeHandle is deprecated in StrictMode. ' +
1018 + 'findNodeHandle is deprecated in StrictMode. ' +
1019 'findNodeHandle was passed an instance of IsInStrictMode which is inside StrictMode. ' +
1020 'Instead, add a ref directly to the element you want to reference. ' +
1021 'Learn more about using refs safely here: ' +
packages/react-native-renderer/src/__tests__/ReactNativeMount-test.internal.js
+6 -6
@@ -20,11 +20,11 @@ let ReactNativePrivateInterface;
20 let act;
21
22 const DISPATCH_COMMAND_REQUIRES_HOST_COMPONENT =
23 - "Warning: dispatchCommand was called with a ref that isn't a " +
23 + "dispatchCommand was called with a ref that isn't a " +
24 'native component. Use React.forwardRef to get access to the underlying native component';
25
26 const SEND_ACCESSIBILITY_EVENT_REQUIRES_HOST_COMPONENT =
27 - "Warning: sendAccessibilityEvent was called with a ref that isn't a " +
27 + "sendAccessibilityEvent was called with a ref that isn't a " +
28 'native component. Use React.forwardRef to get access to the underlying native component';
29
30 describe('ReactNative', () => {
@@ -618,7 +618,7 @@ describe('ReactNative', () => {
618 expect(
619 () => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
620 ).toErrorDev([
621 - 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
621 + 'findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
622 'findHostInstance_DEPRECATED was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
623 'Instead, add a ref directly to the element you want to reference. ' +
624 'Learn more about using refs safely here: ' +
@@ -656,7 +656,7 @@ describe('ReactNative', () => {
656 expect(
657 () => (match = ReactNative.findHostInstance_DEPRECATED(parent)),
658 ).toErrorDev([
659 - 'Warning: findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
659 + 'findHostInstance_DEPRECATED is deprecated in StrictMode. ' +
660 'findHostInstance_DEPRECATED was passed an instance of IsInStrictMode which is inside StrictMode. ' +
661 'Instead, add a ref directly to the element you want to reference. ' +
662 'Learn more about using refs safely here: ' +
@@ -691,7 +691,7 @@ describe('ReactNative', () => {
691
692 let match;
693 expect(() => (match = ReactNative.findNodeHandle(parent))).toErrorDev([
694 - 'Warning: findNodeHandle is deprecated in StrictMode. ' +
694 + 'findNodeHandle is deprecated in StrictMode. ' +
695 'findNodeHandle was passed an instance of ContainsStrictModeChild which renders StrictMode children. ' +
696 'Instead, add a ref directly to the element you want to reference. ' +
697 'Learn more about using refs safely here: ' +
@@ -727,7 +727,7 @@ describe('ReactNative', () => {
727
728 let match;
729 expect(() => (match = ReactNative.findNodeHandle(parent))).toErrorDev([
730 - 'Warning: findNodeHandle is deprecated in StrictMode. ' +
730 + 'findNodeHandle is deprecated in StrictMode. ' +
731 'findNodeHandle was passed an instance of IsInStrictMode which is inside StrictMode. ' +
732 'Instead, add a ref directly to the element you want to reference. ' +
733 'Learn more about using refs safely here: ' +
packages/react-reconciler/src/__tests__/DebugTracing-test.internal.js
+1 -1
@@ -279,7 +279,7 @@ describe('DebugTracing', () => {
279 );
280 });
281 }).toErrorDev(
282 - 'Warning: Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.',
282 + 'Cannot update during an existing state transition (such as within `render`). Render methods should be a pure function of props and state.',
283 );
284
285 expect(logs).toEqual([
packages/react-reconciler/src/__tests__/ReactHooks-test.internal.js
+21 -21
@@ -594,7 +594,7 @@ describe('ReactHooks', () => {
594 root.update(<App dependencies={['A', 'B']} />);
595 });
596 }).toErrorDev([
597 - 'Warning: The final argument passed to useLayoutEffect changed size ' +
597 + 'The final argument passed to useLayoutEffect changed size ' +
598 'between renders. The order and size of this array must remain ' +
599 'constant.\n\n' +
600 'Previous: [A]\n' +
@@ -630,7 +630,7 @@ describe('ReactHooks', () => {
630 root.update(<App text="Hello" hasDeps={false} />);
631 });
632 }).toErrorDev([
633 - 'Warning: useMemo received a final argument during this render, but ' +
633 + 'useMemo received a final argument during this render, but ' +
634 'not during the previous render. Even though the final argument is ' +
635 'optional, its type cannot change between renders.',
636 ]);
@@ -654,13 +654,13 @@ describe('ReactHooks', () => {
654 });
655 });
656 }).toErrorDev([
657 - 'Warning: useEffect received a final argument that is not an array (instead, received `string`). ' +
657 + 'useEffect received a final argument that is not an array (instead, received `string`). ' +
658 'When specified, the final argument must be an array.',
659 - 'Warning: useLayoutEffect received a final argument that is not an array (instead, received `string`). ' +
659 + 'useLayoutEffect received a final argument that is not an array (instead, received `string`). ' +
660 'When specified, the final argument must be an array.',
661 - 'Warning: useMemo received a final argument that is not an array (instead, received `string`). ' +
661 + 'useMemo received a final argument that is not an array (instead, received `string`). ' +
662 'When specified, the final argument must be an array.',
663 - 'Warning: useCallback received a final argument that is not an array (instead, received `string`). ' +
663 + 'useCallback received a final argument that is not an array (instead, received `string`). ' +
664 'When specified, the final argument must be an array.',
665 ]);
666 await expect(async () => {
@@ -670,13 +670,13 @@ describe('ReactHooks', () => {
670 });
671 });
672 }).toErrorDev([
673 - 'Warning: useEffect received a final argument that is not an array (instead, received `number`). ' +
673 + 'useEffect received a final argument that is not an array (instead, received `number`). ' +
674 'When specified, the final argument must be an array.',
675 - 'Warning: useLayoutEffect received a final argument that is not an array (instead, received `number`). ' +
675 + 'useLayoutEffect received a final argument that is not an array (instead, received `number`). ' +
676 'When specified, the final argument must be an array.',
677 - 'Warning: useMemo received a final argument that is not an array (instead, received `number`). ' +
677 + 'useMemo received a final argument that is not an array (instead, received `number`). ' +
678 'When specified, the final argument must be an array.',
679 - 'Warning: useCallback received a final argument that is not an array (instead, received `number`). ' +
679 + 'useCallback received a final argument that is not an array (instead, received `number`). ' +
680 'When specified, the final argument must be an array.',
681 ]);
682 await expect(async () => {
@@ -686,13 +686,13 @@ describe('ReactHooks', () => {
686 });
687 });
688 }).toErrorDev([
689 - 'Warning: useEffect received a final argument that is not an array (instead, received `object`). ' +
689 + 'useEffect received a final argument that is not an array (instead, received `object`). ' +
690 'When specified, the final argument must be an array.',
691 - 'Warning: useLayoutEffect received a final argument that is not an array (instead, received `object`). ' +
691 + 'useLayoutEffect received a final argument that is not an array (instead, received `object`). ' +
692 'When specified, the final argument must be an array.',
693 - 'Warning: useMemo received a final argument that is not an array (instead, received `object`). ' +
693 + 'useMemo received a final argument that is not an array (instead, received `object`). ' +
694 'When specified, the final argument must be an array.',
695 - 'Warning: useCallback received a final argument that is not an array (instead, received `object`). ' +
695 + 'useCallback received a final argument that is not an array (instead, received `object`). ' +
696 'When specified, the final argument must be an array.',
697 ]);
698
@@ -725,7 +725,7 @@ describe('ReactHooks', () => {
725 });
726 });
727 }).toErrorDev([
728 - 'Warning: useImperativeHandle received a final argument that is not an array (instead, received `string`). ' +
728 + 'useImperativeHandle received a final argument that is not an array (instead, received `string`). ' +
729 'When specified, the final argument must be an array.',
730 ]);
731 await act(() => {
@@ -1127,7 +1127,7 @@ describe('ReactHooks', () => {
1127 );
1128 }).toErrorDev([
1129 'Do not call Hooks inside useEffect(...), useMemo(...), or other built-in Hooks',
1130 - 'Warning: React has detected a change in the order of Hooks called by App. ' +
1130 + 'React has detected a change in the order of Hooks called by App. ' +
1131 'This will lead to bugs and errors if not fixed. For more information, ' +
1132 'read the Rules of Hooks: https://react.dev/link/rules-of-hooks\n\n' +
1133 ' Previous render Next render\n' +
@@ -1593,7 +1593,7 @@ describe('ReactHooks', () => {
1593 // We just want to verify that warnings are always logged.
1594 }
1595 }).toErrorDev([
1596 - 'Warning: React has detected a change in the order of Hooks called by App. ' +
1596 + 'React has detected a change in the order of Hooks called by App. ' +
1597 'This will lead to bugs and errors if not fixed. For more information, ' +
1598 'read the Rules of Hooks: https://react.dev/link/rules-of-hooks\n\n' +
1599 ' Previous render Next render\n' +
@@ -1644,7 +1644,7 @@ describe('ReactHooks', () => {
1644 // We just want to verify that warnings are always logged.
1645 }
1646 }).toErrorDev([
1647 - 'Warning: React has detected a change in the order of Hooks called by App. ' +
1647 + 'React has detected a change in the order of Hooks called by App. ' +
1648 'This will lead to bugs and errors if not fixed. For more information, ' +
1649 'read the Rules of Hooks: https://react.dev/link/rules-of-hooks\n\n' +
1650 ' Previous render Next render\n' +
@@ -1728,7 +1728,7 @@ describe('ReactHooks', () => {
1728 // This is okay as far as this test is concerned.
1729 // We just want to verify that warnings are always logged.
1730 }).toErrorDev([
1731 - 'Warning: React has detected a change in the order of Hooks called by App. ' +
1731 + 'React has detected a change in the order of Hooks called by App. ' +
1732 'This will lead to bugs and errors if not fixed. For more information, ' +
1733 'read the Rules of Hooks: https://react.dev/link/rules-of-hooks\n\n' +
1734 ' Previous render Next render\n' +
@@ -1778,7 +1778,7 @@ describe('ReactHooks', () => {
1778 });
1779 }).rejects.toThrow('custom error');
1780 }).toErrorDev([
1781 - 'Warning: React has detected a change in the order of Hooks called by App. ' +
1781 + 'React has detected a change in the order of Hooks called by App. ' +
1782 'This will lead to bugs and errors if not fixed. For more information, ' +
1783 'read the Rules of Hooks: https://react.dev/link/rules-of-hooks\n\n' +
1784 ' Previous render Next render\n' +
@@ -1819,7 +1819,7 @@ describe('ReactHooks', () => {
1819 });
1820 }).rejects.toThrow('Hello');
1821 assertConsoleErrorDev([
1822 - 'Warning: Cannot update a component (`A`) while rendering ' +
1822 + 'Cannot update a component (`A`) while rendering ' +
1823 'a different component (`B`).',
1824 ]);
1825 });
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
+13 -13
@@ -2536,7 +2536,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2536 root1.render(<App return={17} />);
2537 });
2538 }).toErrorDev([
2539 - 'Warning: useEffect must not return anything besides a ' +
2539 + 'useEffect must not return anything besides a ' +
2540 'function, which is used for clean-up. You returned: 17',
2541 ]);
2542
@@ -2546,7 +2546,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2546 root2.render(<App return={null} />);
2547 });
2548 }).toErrorDev([
2549 - 'Warning: useEffect must not return anything besides a ' +
2549 + 'useEffect must not return anything besides a ' +
2550 'function, which is used for clean-up. You returned null. If your ' +
2551 'effect does not require clean up, return undefined (or nothing).',
2552 ]);
@@ -2557,7 +2557,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2557 root3.render(<App return={Promise.resolve()} />);
2558 });
2559 }).toErrorDev([
2560 - 'Warning: useEffect must not return anything besides a ' +
2560 + 'useEffect must not return anything besides a ' +
2561 'function, which is used for clean-up.\n\n' +
2562 'It looks like you wrote useEffect(async () => ...) or returned a Promise.',
2563 ]);
@@ -2915,7 +2915,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2915 root1.render(<App return={17} />);
2916 });
2917 }).toErrorDev([
2918 - 'Warning: useInsertionEffect must not return anything besides a ' +
2918 + 'useInsertionEffect must not return anything besides a ' +
2919 'function, which is used for clean-up. You returned: 17',
2920 ]);
2921
@@ -2925,7 +2925,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2925 root2.render(<App return={null} />);
2926 });
2927 }).toErrorDev([
2928 - 'Warning: useInsertionEffect must not return anything besides a ' +
2928 + 'useInsertionEffect must not return anything besides a ' +
2929 'function, which is used for clean-up. You returned null. If your ' +
2930 'effect does not require clean up, return undefined (or nothing).',
2931 ]);
@@ -2936,7 +2936,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2936 root3.render(<App return={Promise.resolve()} />);
2937 });
2938 }).toErrorDev([
2939 - 'Warning: useInsertionEffect must not return anything besides a ' +
2939 + 'useInsertionEffect must not return anything besides a ' +
2940 'function, which is used for clean-up.\n\n' +
2941 'It looks like you wrote useInsertionEffect(async () => ...) or returned a Promise.',
2942 ]);
@@ -2965,7 +2965,7 @@ describe('ReactHooksWithNoopRenderer', () => {
2965 await act(() => {
2966 root.render(<App />);
2967 });
2968 - }).toErrorDev(['Warning: useInsertionEffect must not schedule updates.']);
2968 + }).toErrorDev(['useInsertionEffect must not schedule updates.']);
2969
2970 await act(async () => {
2971 root.render(<App throw={true} />);
@@ -3007,7 +3007,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3007 await act(() => {
3008 root.render(<App foo="goodbye" />);
3009 });
3010 - }).toErrorDev(['Warning: useInsertionEffect must not schedule updates.']);
3010 + }).toErrorDev(['useInsertionEffect must not schedule updates.']);
3011
3012 await act(async () => {
3013 root.render(<App throw={true} />);
@@ -3194,7 +3194,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3194 root1.render(<App return={17} />);
3195 });
3196 }).toErrorDev([
3197 - 'Warning: useLayoutEffect must not return anything besides a ' +
3197 + 'useLayoutEffect must not return anything besides a ' +
3198 'function, which is used for clean-up. You returned: 17',
3199 ]);
3200
@@ -3204,7 +3204,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3204 root2.render(<App return={null} />);
3205 });
3206 }).toErrorDev([
3207 - 'Warning: useLayoutEffect must not return anything besides a ' +
3207 + 'useLayoutEffect must not return anything besides a ' +
3208 'function, which is used for clean-up. You returned null. If your ' +
3209 'effect does not require clean up, return undefined (or nothing).',
3210 ]);
@@ -3215,7 +3215,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3215 root3.render(<App return={Promise.resolve()} />);
3216 });
3217 }).toErrorDev([
3218 - 'Warning: useLayoutEffect must not return anything besides a ' +
3218 + 'useLayoutEffect must not return anything besides a ' +
3219 'function, which is used for clean-up.\n\n' +
3220 'It looks like you wrote useLayoutEffect(async () => ...) or returned a Promise.',
3221 ]);
@@ -3687,7 +3687,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3687 );
3688 assertLog([]);
3689 }).toErrorDev([
3690 - 'Warning: React has detected a change in the order of Hooks called by App. ' +
3690 + 'React has detected a change in the order of Hooks called by App. ' +
3691 'This will lead to bugs and errors if not fixed. For more information, ' +
3692 'read the Rules of Hooks: https://react.dev/link/rules-of-hooks\n\n' +
3693 ' Previous render Next render\n' +
@@ -3784,7 +3784,7 @@ describe('ReactHooksWithNoopRenderer', () => {
3784 );
3785 assertLog(['Unmount A']);
3786 }).toErrorDev([
3787 - 'Warning: React has detected a change in the order of Hooks called by App. ' +
3787 + 'React has detected a change in the order of Hooks called by App. ' +
3788 'This will lead to bugs and errors if not fixed. For more information, ' +
3789 'read the Rules of Hooks: https://react.dev/link/rules-of-hooks\n\n' +
3790 ' Previous render Next render\n' +
packages/react-reconciler/src/__tests__/ReactIncrementalErrorHandling-test.internal.js
+5 -5
@@ -1238,9 +1238,9 @@ describe('ReactIncrementalErrorHandling', () => {
1238 </ErrorBoundary>,
1239 );
1240 await expect(async () => await waitForAll([])).toErrorDev([
1241 - 'Warning: React.jsx: type is invalid -- expected a string',
1241 + 'React.jsx: type is invalid -- expected a string',
1242 // React retries once on error
1243 - 'Warning: React.jsx: type is invalid -- expected a string',
1243 + 'React.jsx: type is invalid -- expected a string',
1244 ]);
1245 expect(ReactNoop).toMatchRenderedOutput(
1246 <span
@@ -1289,9 +1289,9 @@ describe('ReactIncrementalErrorHandling', () => {
1289 </ErrorBoundary>,
1290 );
1291 await expect(async () => await waitForAll([])).toErrorDev([
1292 - 'Warning: React.jsx: type is invalid -- expected a string',
1292 + 'React.jsx: type is invalid -- expected a string',
1293 // React retries once on error
1294 - 'Warning: React.jsx: type is invalid -- expected a string',
1294 + 'React.jsx: type is invalid -- expected a string',
1295 ]);
1296 expect(ReactNoop).toMatchRenderedOutput(
1297 <span
@@ -1311,7 +1311,7 @@ describe('ReactIncrementalErrorHandling', () => {
1311 it('recovers from uncaught reconciler errors', async () => {
1312 const InvalidType = undefined;
1313 expect(() => ReactNoop.render(<InvalidType />)).toErrorDev(
1314 - 'Warning: React.jsx: type is invalid -- expected a string',
1314 + 'React.jsx: type is invalid -- expected a string',
1315 {withoutStack: true},
1316 );
1317 await waitForThrow(
packages/react-reconciler/src/__tests__/ReactIncrementalSideEffects-test.js
+2 -2
@@ -1303,7 +1303,7 @@ describe('ReactIncrementalSideEffects', () => {
1303 await waitForAll([]);
1304 } else {
1305 await expect(async () => await waitForAll([])).toErrorDev(
1306 - 'Warning: Function components cannot be given refs. ' +
1306 + 'Function components cannot be given refs. ' +
1307 'Attempts to access this ref will fail. ' +
1308 'Did you mean to use React.forwardRef()?\n\n' +
1309 'Check the render method ' +
@@ -1372,7 +1372,7 @@ describe('ReactIncrementalSideEffects', () => {
1372 await expect(async () => {
1373 await waitForAll([]);
1374 }).toErrorDev([
1375 - 'Warning: Component "Foo" contains the string ref "bar". ' +
1375 + 'Component "Foo" contains the string ref "bar". ' +
1376 'Support for string refs will be removed in a future major release. ' +
1377 'We recommend using useRef() or createRef() instead. ' +
1378 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
packages/react-reconciler/src/__tests__/ReactIsomorphicAct-test.js
+1 -1
@@ -290,7 +290,7 @@ describe('isomorphic act()', () => {
290
291 expect(console.error).toHaveBeenCalledTimes(1);
292 expect(console.error.mock.calls[0][0]).toContain(
293 - 'Warning: A component suspended inside an `act` scope, but the `act` ' +
293 + 'A component suspended inside an `act` scope, but the `act` ' +
294 'call was not awaited. When testing React components that ' +
295 'depend on asynchronous data, you must await the result:\n\n' +
296 'await act(() => ...)',
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
+1 -1
@@ -703,7 +703,7 @@ describe('ReactLazy', () => {
703 await act(() => resolveFakeImport(T));
704 assertLog(['Hi Bye']);
705 }).toErrorDev(
706 - 'Warning: T: Support for defaultProps ' +
706 + 'T: Support for defaultProps ' +
707 'will be removed from function components in a future major ' +
708 'release. Use JavaScript default parameters instead.',
709 );
packages/react-reconciler/src/__tests__/ReactMemo-test.js
+2 -2
@@ -58,7 +58,7 @@ describe('memo', () => {
58 }
59 ReactNoop.render(<Outer />);
60 await expect(async () => await waitForAll([])).toErrorDev([
61 - 'Warning: Function components cannot be given refs. Attempts to access ' +
61 + 'Function components cannot be given refs. Attempts to access ' +
62 'this ref will fail.',
63 ]);
64 });
@@ -76,7 +76,7 @@ describe('memo', () => {
76 }
77 ReactNoop.render(<Outer />);
78 await expect(async () => await waitForAll([])).toErrorDev([
79 - 'Warning: Function components cannot be given refs. Attempts to access ' +
79 + 'Function components cannot be given refs. Attempts to access ' +
80 'this ref will fail.',
81 ]);
82 });
packages/react-reconciler/src/__tests__/ReactSuspenseCallback-test.js
+1 -1
@@ -58,7 +58,7 @@ describe('ReactSuspense', () => {
58
59 ReactNoop.render(elementBadType);
60 await expect(async () => await waitForAll([])).toErrorDev([
61 - 'Warning: Unexpected type for suspenseCallback.',
61 + 'Unexpected type for suspenseCallback.',
62 ]);
63
64 const elementMissingCallback = (
packages/react-reconciler/src/__tests__/ReactSuspenseList-test.js
+8 -8
@@ -67,7 +67,7 @@ describe('ReactSuspenseList', () => {
67 ReactNoop.render(<Foo />);
68 });
69 }).toErrorDev([
70 - 'Warning: "something" is not a supported revealOrder on ' +
70 + '"something" is not a supported revealOrder on ' +
71 '<SuspenseList />. Did you mean "together", "forwards" or "backwards"?' +
72 '\n in SuspenseList (at **)' +
73 '\n in Foo (at **)',
@@ -89,7 +89,7 @@ describe('ReactSuspenseList', () => {
89 ReactNoop.render(<Foo />);
90 });
91 }).toErrorDev([
92 - 'Warning: "TOGETHER" is not a valid value for revealOrder on ' +
92 + '"TOGETHER" is not a valid value for revealOrder on ' +
93 '<SuspenseList />. Use lowercase "together" instead.' +
94 '\n in SuspenseList (at **)' +
95 '\n in Foo (at **)',
@@ -111,7 +111,7 @@ describe('ReactSuspenseList', () => {
111 ReactNoop.render(<Foo />);
112 });
113 }).toErrorDev([
114 - 'Warning: "forward" is not a valid value for revealOrder on ' +
114 + '"forward" is not a valid value for revealOrder on ' +
115 '<SuspenseList />. React uses the -s suffix in the spelling. ' +
116 'Use "forwards" instead.' +
117 '\n in SuspenseList (at **)' +
@@ -146,7 +146,7 @@ describe('ReactSuspenseList', () => {
146 );
147 });
148 }).toErrorDev([
149 - 'Warning: A single row was passed to a <SuspenseList revealOrder="forwards" />. ' +
149 + 'A single row was passed to a <SuspenseList revealOrder="forwards" />. ' +
150 'This is not useful since it needs multiple rows. ' +
151 'Did you mean to pass multiple children or an array?' +
152 '\n in SuspenseList (at **)' +
@@ -169,7 +169,7 @@ describe('ReactSuspenseList', () => {
169 ReactNoop.render(<Foo />);
170 });
171 }).toErrorDev([
172 - 'Warning: A single row was passed to a <SuspenseList revealOrder="backwards" />. ' +
172 + 'A single row was passed to a <SuspenseList revealOrder="backwards" />. ' +
173 'This is not useful since it needs multiple rows. ' +
174 'Did you mean to pass multiple children or an array?' +
175 '\n in SuspenseList (at **)' +
@@ -197,7 +197,7 @@ describe('ReactSuspenseList', () => {
197 ReactNoop.render(<Foo items={['A', 'B']} />);
198 });
199 }).toErrorDev([
200 - 'Warning: A nested array was passed to row #0 in <SuspenseList />. ' +
200 + 'A nested array was passed to row #0 in <SuspenseList />. ' +
201 'Wrap it in an additional SuspenseList to configure its revealOrder: ' +
202 '<SuspenseList revealOrder=...> ... ' +
203 '<SuspenseList revealOrder=...>{array}</SuspenseList> ... ' +
@@ -1484,7 +1484,7 @@ describe('ReactSuspenseList', () => {
1484 ReactNoop.render(<Foo />);
1485 });
1486 }).toErrorDev([
1487 - 'Warning: "collapse" is not a supported value for tail on ' +
1487 + '"collapse" is not a supported value for tail on ' +
1488 '<SuspenseList />. Did you mean "collapsed" or "hidden"?' +
1489 '\n in SuspenseList (at **)' +
1490 '\n in Foo (at **)',
@@ -1506,7 +1506,7 @@ describe('ReactSuspenseList', () => {
1506 ReactNoop.render(<Foo />);
1507 });
1508 }).toErrorDev([
1509 - 'Warning: <SuspenseList tail="collapsed" /> is only valid if ' +
1509 + '<SuspenseList tail="collapsed" /> is only valid if ' +
1510 'revealOrder is "forwards" or "backwards". ' +
1511 'Did you mean to specify revealOrder="forwards"?' +
1512 '\n in SuspenseList (at **)' +
packages/react-reconciler/src/__tests__/ReactUse-test.js
+1 -1
@@ -551,7 +551,7 @@ describe('ReactUse', () => {
551 if (__DEV__) {
552 expect(console.error).toHaveBeenCalledTimes(1);
553 expect(console.error.mock.calls[0][0]).toContain(
554 - 'Warning: `use` was called from inside a try/catch block. This is not ' +
554 + '`use` was called from inside a try/catch block. This is not ' +
555 'allowed and can lead to unexpected behavior. To handle errors ' +
556 'triggered by `use`, wrap your component in a error boundary.',
557 );
packages/react-server-dom-webpack/src/__tests__/ReactFlightDOMForm-test.js
+2 -2
@@ -968,7 +968,7 @@ describe('ReactFlightDOMForm', () => {
968 }
969
970 await expect(submitTheForm).toErrorDev(
971 - 'Warning: Failed to serialize an action for progressive enhancement:\n' +
971 + 'Failed to serialize an action for progressive enhancement:\n' +
972 'Error: React Element cannot be passed to Server Functions from the Client without a temporary reference set. Pass a TemporaryReferenceSet to the options.\n' +
973 ' [<div/>]\n' +
974 ' ^^^^^^',
@@ -1045,7 +1045,7 @@ describe('ReactFlightDOMForm', () => {
1045 }
1046
1047 await expect(submitTheForm).toErrorDev(
1048 - 'Warning: Failed to serialize an action for progressive enhancement:\n' +
1048 + 'Failed to serialize an action for progressive enhancement:\n' +
1049 'Error: File/Blob fields are not yet supported in progressive forms. Will fallback to client hydration.',
1050 );
1051
packages/react-test-renderer/src/__tests__/ReactTestRenderer-test.internal.js
+2 -2
@@ -67,7 +67,7 @@ describe('ReactTestRenderer', () => {
67 ReactTestRenderer.create(<div />);
68 expect(console.error).toHaveBeenCalledTimes(1);
69 expect(console.error.mock.calls[0][0]).toContain(
70 - 'Warning: react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer',
70 + 'react-test-renderer is deprecated. See https://react.dev/warnings/react-test-renderer',
71 );
72 console.error.mockRestore();
73 });
@@ -412,7 +412,7 @@ describe('ReactTestRenderer', () => {
412 ReactTestRenderer.create(<Foo />);
413 });
414 }).toErrorDev(
415 - 'Warning: Function components cannot be given refs. Attempts ' +
415 + 'Function components cannot be given refs. Attempts ' +
416 'to access this ref will fail. ' +
417 'Did you mean to use React.forwardRef()?\n' +
418 ' in Bar (at **)\n' +
packages/react/src/__tests__/ReactChildren-test.js
+7 -15
@@ -338,7 +338,7 @@ describe('ReactChildren', () => {
338 // With the flag on this doesn't warn eagerly but only when rendered
339 gate(flag => flag.enableOwnerStacks)
340 ? []
341 - : ['Warning: Each child in a list should have a unique "key" prop.'],
341 + : ['Each child in a list should have a unique "key" prop.'],
342 );
343
344 React.Children.forEach(instance.props.children, callback, context);
@@ -363,9 +363,7 @@ describe('ReactChildren', () => {
363 await act(() => {
364 root.render(instance);
365 });
366 - }).toErrorDev(
367 - 'Warning: Each child in a list should have a unique "key" prop.',
368 - );
366 + }).toErrorDev('Each child in a list should have a unique "key" prop.');
367 });
368
369 it('should be called for each child in an iterable with keys', () => {
@@ -889,9 +887,7 @@ describe('ReactChildren', () => {
887 </ComponentRenderingMappedChildren>,
888 );
889 });
892 - }).toErrorDev([
893 - 'Warning: Each child in a list should have a unique "key" prop.',
894 - ]);
890 + }).toErrorDev(['Each child in a list should have a unique "key" prop.']);
891 });
892
893 it('does not warn for mapped static children without keys', async () => {
@@ -938,9 +934,7 @@ describe('ReactChildren', () => {
934 </ComponentRenderingClonedChildren>,
935 );
936 });
941 - }).toErrorDev([
942 - 'Warning: Each child in a list should have a unique "key" prop.',
943 - ]);
937 + }).toErrorDev(['Each child in a list should have a unique "key" prop.']);
938 });
939
940 it('does not warn for cloned static children without keys', async () => {
@@ -981,9 +975,7 @@ describe('ReactChildren', () => {
975 </ComponentRenderingFlattenedChildren>,
976 );
977 });
984 - }).toErrorDev([
985 - 'Warning: Each child in a list should have a unique "key" prop.',
986 - ]);
978 + }).toErrorDev(['Each child in a list should have a unique "key" prop.']);
979 });
980
981 it('does not warn for flattened static children without keys', async () => {
@@ -1166,7 +1158,7 @@ describe('ReactChildren', () => {
1158 root.render(<ComponentReturningArray />);
1159 });
1160 }).toErrorDev(
1169 - 'Warning: ' +
1161 + '' +
1162 'Each child in a list should have a unique "key" prop.' +
1163 '\n\nCheck the top-level render call using <ComponentReturningArray>. It was passed a child from ComponentReturningArray. ' +
1164 'See https://react.dev/link/warning-keys for more information.' +
@@ -1197,7 +1189,7 @@ describe('ReactChildren', () => {
1189 root.render([<div />, <div />]);
1190 });
1191 }).toErrorDev(
1200 - 'Warning: ' +
1192 + '' +
1193 'Each child in a list should have a unique "key" prop.' +
1194 '\n\nCheck the top-level render call using <Root>. ' +
1195 'See https://react.dev/link/warning-keys for more information.' +
packages/react/src/__tests__/ReactCoffeeScriptClass-test.coffee
+4 -4
@@ -468,7 +468,7 @@ describe 'ReactCoffeeScriptClass', ->
468 expect(->
469 test React.createElement(NamedComponent), 'SPAN', 'foo'
470 ).toErrorDev(
471 - 'Warning: NamedComponent has a method called componentShouldUpdate().
471 + 'NamedComponent has a method called componentShouldUpdate().
472 Did you mean shouldComponentUpdate()? The name is phrased as a
473 question because the function is expected to return a value.'
474 )
@@ -486,7 +486,7 @@ describe 'ReactCoffeeScriptClass', ->
486 expect(->
487 test React.createElement(NamedComponent), 'SPAN', 'foo'
488 ).toErrorDev(
489 - 'Warning: NamedComponent has a method called componentWillRecieveProps().
489 + 'NamedComponent has a method called componentWillRecieveProps().
490 Did you mean componentWillReceiveProps()?'
491 )
492
@@ -503,7 +503,7 @@ describe 'ReactCoffeeScriptClass', ->
503 expect(->
504 test React.createElement(NamedComponent), 'SPAN', 'foo'
505 ).toErrorDev(
506 - 'Warning: NamedComponent has a method called UNSAFE_componentWillRecieveProps().
506 + 'NamedComponent has a method called UNSAFE_componentWillRecieveProps().
507 Did you mean UNSAFE_componentWillReceiveProps()?'
508 )
509
@@ -554,7 +554,7 @@ describe 'ReactCoffeeScriptClass', ->
554 expect(->
555 test(React.createElement(Foo, ref: ref), 'DIV', 'foo')
556 ).toErrorDev([
557 - 'Warning: Component "Foo" contains the string ref "inner". ' +
557 + 'Component "Foo" contains the string ref "inner". ' +
558 'Support for string refs will be removed in a future major release. ' +
559 'We recommend using useRef() or createRef() instead. ' +
560 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
packages/react/src/__tests__/ReactContextValidator-test.js
+8 -8
@@ -188,7 +188,7 @@ describe('ReactContextValidator', () => {
188 root.render(<ComponentA />);
189 });
190 }).toErrorDev(
191 - 'Warning: ComponentA.childContextTypes is specified but there is no ' +
191 + 'ComponentA.childContextTypes is specified but there is no ' +
192 'getChildContext() method on the instance. You can either define ' +
193 'getChildContext() on ComponentA or remove childContextTypes from it.',
194 );
@@ -207,7 +207,7 @@ describe('ReactContextValidator', () => {
207 root.render(<ComponentB />);
208 });
209 }).toErrorDev(
210 - 'Warning: ComponentB.childContextTypes is specified but there is no ' +
210 + 'ComponentB.childContextTypes is specified but there is no ' +
211 'getChildContext() method on the instance. You can either define ' +
212 'getChildContext() on ComponentB or remove childContextTypes from it.',
213 );
@@ -259,7 +259,7 @@ describe('ReactContextValidator', () => {
259 root.render(<ParentContextProvider />);
260 });
261 }).toErrorDev([
262 - 'Warning: MiddleMissingContext.childContextTypes is specified but there is no ' +
262 + 'MiddleMissingContext.childContextTypes is specified but there is no ' +
263 'getChildContext() method on the instance. You can either define getChildContext() ' +
264 'on MiddleMissingContext or remove childContextTypes from it.',
265 ]);
@@ -436,7 +436,7 @@ describe('ReactContextValidator', () => {
436 );
437 });
438 }).toErrorDev(
439 - 'Warning: ComponentA declares both contextTypes and contextType static properties. ' +
439 + 'ComponentA declares both contextTypes and contextType static properties. ' +
440 'The legacy contextTypes property will be ignored.',
441 );
442
@@ -462,7 +462,7 @@ describe('ReactContextValidator', () => {
462 );
463 });
464 }).toErrorDev(
465 - 'Warning: ComponentB declares both contextTypes and contextType static properties. ' +
465 + 'ComponentB declares both contextTypes and contextType static properties. ' +
466 'The legacy contextTypes property will be ignored.',
467 );
468 });
@@ -484,7 +484,7 @@ describe('ReactContextValidator', () => {
484 root.render(<ComponentA />);
485 });
486 }).toErrorDev(
487 - 'Warning: ComponentA defines an invalid contextType. ' +
487 + 'ComponentA defines an invalid contextType. ' +
488 'contextType should point to the Context object returned by React.createContext(). ' +
489 'Did you accidentally pass the Context.Consumer instead?',
490 );
@@ -628,7 +628,7 @@ describe('ReactContextValidator', () => {
628 root.render(<ComponentA />);
629 });
630 }).toErrorDev(
631 - 'Warning: ComponentA: Function components do not support contextType.',
631 + 'ComponentA: Function components do not support contextType.',
632 );
633
634 // Warnings should be deduped by component type
@@ -645,7 +645,7 @@ describe('ReactContextValidator', () => {
645 root.render(<ComponentB />);
646 });
647 }).toErrorDev(
648 - 'Warning: ComponentB: Function components do not support contextType.',
648 + 'ComponentB: Function components do not support contextType.',
649 );
650 });
651 });
packages/react/src/__tests__/ReactES6Class-test.js
+6 -9
@@ -71,9 +71,9 @@ describe('ReactES6Class', () => {
71 ReactDOM.flushSync(() => root.render(<Foo />));
72 }).toErrorDev([
73 // A failed component renders twice in DEV in concurrent mode
74 - 'Warning: No `render` method found on the Foo instance: ' +
74 + 'No `render` method found on the Foo instance: ' +
75 'you may have forgotten to define `render`.',
76 - 'Warning: No `render` method found on the Foo instance: ' +
76 + 'No `render` method found on the Foo instance: ' +
77 'you may have forgotten to define `render`.',
78 ]);
79 } finally {
@@ -510,8 +510,7 @@ describe('ReactES6Class', () => {
510 }
511
512 expect(() => runTest(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
513 - 'Warning: ' +
514 - 'NamedComponent has a method called componentShouldUpdate(). Did you ' +
513 + 'NamedComponent has a method called componentShouldUpdate(). Did you ' +
514 'mean shouldComponentUpdate()? The name is phrased as a question ' +
515 'because the function is expected to return a value.',
516 );
@@ -528,8 +527,7 @@ describe('ReactES6Class', () => {
527 }
528
529 expect(() => runTest(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
531 - 'Warning: ' +
532 - 'NamedComponent has a method called componentWillRecieveProps(). Did ' +
530 + 'NamedComponent has a method called componentWillRecieveProps(). Did ' +
531 'you mean componentWillReceiveProps()?',
532 );
533 });
@@ -545,8 +543,7 @@ describe('ReactES6Class', () => {
543 }
544
545 expect(() => runTest(<NamedComponent />, 'SPAN', 'foo')).toErrorDev(
548 - 'Warning: ' +
549 - 'NamedComponent has a method called UNSAFE_componentWillRecieveProps(). ' +
546 + 'NamedComponent has a method called UNSAFE_componentWillRecieveProps(). ' +
547 'Did you mean UNSAFE_componentWillReceiveProps()?',
548 );
549 });
@@ -598,7 +595,7 @@ describe('ReactES6Class', () => {
595 expect(() => {
596 runTest(<Foo ref={ref} />, 'DIV', 'foo');
597 }).toErrorDev([
601 - 'Warning: Component "Foo" contains the string ref "inner". ' +
598 + 'Component "Foo" contains the string ref "inner". ' +
599 'Support for string refs will be removed in a future major release. ' +
600 'We recommend using useRef() or createRef() instead. ' +
601 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
packages/react/src/__tests__/ReactElementClone-test.js
+1 -1
@@ -319,7 +319,7 @@ describe('ReactElementClone', () => {
319 await act(() => root.render(<Parent />));
320 expect(child.refs.xyz.tagName).toBe('DIV');
321 }).toErrorDev([
322 - 'Warning: Component "Child" contains the string ref "xyz". Support for ' +
322 + 'Component "Child" contains the string ref "xyz". Support for ' +
323 'string refs will be removed in a future major release. We recommend ' +
324 'using useRef() or createRef() instead. Learn more about using refs ' +
325 'safely here: https://react.dev/link/strict-mode-string-ref',
packages/react/src/__tests__/ReactElementValidator-test.internal.js
+16 -16
@@ -95,12 +95,12 @@ describe('ReactElementValidator', () => {
95 }).toErrorDev(
96 gate(flags => flags.enableOwnerStacks)
97 ? // For owner stacks the parent being validated is the div.
98 - 'Warning: Each child in a list should have a unique ' +
98 + 'Each child in a list should have a unique ' +
99 '"key" prop.' +
100 '\n\nCheck the top-level render call using <div>. ' +
101 'See https://react.dev/link/warning-keys for more information.\n' +
102 ' in div (at **)'
103 - : 'Warning: Each child in a list should have a unique ' +
103 + : 'Each child in a list should have a unique ' +
104 '"key" prop. See https://react.dev/link/warning-keys for more information.\n' +
105 ' in div (at **)',
106 );
@@ -114,7 +114,7 @@ describe('ReactElementValidator', () => {
114
115 await act(() => root.render(<div>{divs}</div>));
116 }).toErrorDev(
117 - 'Warning: Each child in a list should have a unique ' +
117 + 'Each child in a list should have a unique ' +
118 '"key" prop.\n\nCheck the top-level render call using <div>. See ' +
119 'https://react.dev/link/warning-keys for more information.\n' +
120 ' in div (at **)',
@@ -138,7 +138,7 @@ describe('ReactElementValidator', () => {
138 const root = ReactDOMClient.createRoot(document.createElement('div'));
139 await act(() => root.render(<GrandParent />));
140 }).toErrorDev(
141 - 'Warning: Each child in a list should have a unique ' +
141 + 'Each child in a list should have a unique ' +
142 '"key" prop.\n\nCheck the render method of `Component`. See ' +
143 'https://react.dev/link/warning-keys for more information.\n' +
144 ' in div (at **)\n' +
@@ -297,38 +297,38 @@ describe('ReactElementValidator', () => {
297 ? // We don't need these extra warnings because we already have the errors.
298 []
299 : [
300 - 'Warning: React.createElement: type is invalid -- expected a string ' +
300 + 'React.createElement: type is invalid -- expected a string ' +
301 '(for built-in components) or a class/function (for composite ' +
302 'components) but got: undefined. You likely forgot to export your ' +
303 "component from the file it's defined in, or you might have mixed up " +
304 'default and named imports.',
305 - 'Warning: React.createElement: type is invalid -- expected a string ' +
305 + 'React.createElement: type is invalid -- expected a string ' +
306 '(for built-in components) or a class/function (for composite ' +
307 'components) but got: null.',
308 - 'Warning: React.createElement: type is invalid -- expected a string ' +
308 + 'React.createElement: type is invalid -- expected a string ' +
309 '(for built-in components) or a class/function (for composite ' +
310 'components) but got: boolean.',
311 - 'Warning: React.createElement: type is invalid -- expected a string ' +
311 + 'React.createElement: type is invalid -- expected a string ' +
312 '(for built-in components) or a class/function (for composite ' +
313 'components) but got: object.',
314 - 'Warning: React.createElement: type is invalid -- expected a string ' +
314 + 'React.createElement: type is invalid -- expected a string ' +
315 '(for built-in components) or a class/function (for composite ' +
316 'components) but got: object. You likely forgot to export your ' +
317 "component from the file it's defined in, or you might have mixed up " +
318 'default and named imports.',
319 - 'Warning: React.createElement: type is invalid -- expected a string ' +
319 + 'React.createElement: type is invalid -- expected a string ' +
320 '(for built-in components) or a class/function (for composite ' +
321 'components) but got: <div />. Did you accidentally export a JSX literal ' +
322 'instead of a component?',
323 - 'Warning: React.createElement: type is invalid -- expected a string ' +
323 + 'React.createElement: type is invalid -- expected a string ' +
324 '(for built-in components) or a class/function (for composite ' +
325 'components) but got: <Foo />. Did you accidentally export a JSX literal ' +
326 'instead of a component?',
327 - 'Warning: React.createElement: type is invalid -- expected a string ' +
327 + 'React.createElement: type is invalid -- expected a string ' +
328 '(for built-in components) or a class/function (for composite ' +
329 'components) but got: <Context.Consumer />. Did you accidentally ' +
330 'export a JSX literal instead of a component?',
331 - 'Warning: React.createElement: type is invalid -- expected a string ' +
331 + 'React.createElement: type is invalid -- expected a string ' +
332 '(for built-in components) or a class/function (for composite ' +
333 'components) but got: object.',
334 ],
@@ -427,11 +427,11 @@ describe('ReactElementValidator', () => {
427 ? // We don't need these extra warnings because we already have the errors.
428 []
429 : [
430 - 'Warning: React.createElement: type is invalid -- expected a string ' +
430 + 'React.createElement: type is invalid -- expected a string ' +
431 '(for built-in components) or a class/function (for composite ' +
432 'components) but got: null.\n' +
433 ' in ParentComp (at **)',
434 - 'Warning: React.createElement: type is invalid -- expected a string ' +
434 + 'React.createElement: type is invalid -- expected a string ' +
435 '(for built-in components) or a class/function (for composite ' +
436 'components) but got: null.\n' +
437 ' in ParentComp (at **)',
@@ -515,7 +515,7 @@ describe('ReactElementValidator', () => {
515 expect(() => {
516 void (<Foo>{[<div />]}</Foo>);
517 }).toErrorDev(
518 - 'Warning: React.jsx: type is invalid -- expected a string ' +
518 + 'React.jsx: type is invalid -- expected a string ' +
519 '(for built-in components) or a class/function (for composite ' +
520 'components) but got: undefined. You likely forgot to export your ' +
521 "component from the file it's defined in, or you might have mixed up " +
packages/react/src/__tests__/ReactJSXElementValidator-test.js
+3 -3
@@ -221,7 +221,7 @@ describe('ReactJSXElementValidator', () => {
221 const True = true;
222 const Div = 'div';
223 expect(() => void (<Undefined />)).toErrorDev(
224 - 'Warning: React.jsx: type is invalid -- expected a string ' +
224 + 'React.jsx: type is invalid -- expected a string ' +
225 '(for built-in components) or a class/function (for composite ' +
226 'components) but got: undefined. You likely forgot to export your ' +
227 "component from the file it's defined in, or you might have mixed up " +
@@ -229,13 +229,13 @@ describe('ReactJSXElementValidator', () => {
229 {withoutStack: true},
230 );
231 expect(() => void (<Null />)).toErrorDev(
232 - 'Warning: React.jsx: type is invalid -- expected a string ' +
232 + 'React.jsx: type is invalid -- expected a string ' +
233 '(for built-in components) or a class/function (for composite ' +
234 'components) but got: null.',
235 {withoutStack: true},
236 );
237 expect(() => void (<True />)).toErrorDev(
238 - 'Warning: React.jsx: type is invalid -- expected a string ' +
238 + 'React.jsx: type is invalid -- expected a string ' +
239 '(for built-in components) or a class/function (for composite ' +
240 'components) but got: boolean.',
241 {withoutStack: true},
packages/react/src/__tests__/ReactJSXRuntime-test.js
+2 -2
@@ -297,7 +297,7 @@ describe('ReactJSXRuntime', () => {
297 root.render(JSXRuntime.jsx(Parent, {}));
298 });
299 }).toErrorDev(
300 - 'Warning: Each child in a list should have a unique "key" prop.\n\n' +
300 + 'Each child in a list should have a unique "key" prop.\n\n' +
301 'Check the render method of `Parent`. See https://react.dev/link/warning-keys for more information.\n' +
302 (gate(flags => flags.enableOwnerStacks)
303 ? ''
@@ -326,7 +326,7 @@ describe('ReactJSXRuntime', () => {
326 root.render(JSXRuntime.jsx(Parent, {}));
327 });
328 }).toErrorDev(
329 - 'Warning: A props object containing a "key" prop is being spread into JSX:\n' +
329 + 'A props object containing a "key" prop is being spread into JSX:\n' +
330 ' let props = {key: someKey, prop: ...};\n' +
331 ' <Child {...props} />\n' +
332 'React keys must be passed directly to JSX without using spread:\n' +
packages/react/src/__tests__/ReactPureComponent-test.js
+2 -2
@@ -95,7 +95,7 @@ describe('ReactPureComponent', () => {
95 root.render(<Component />);
96 });
97 }).toErrorDev(
98 - 'Warning: ' +
98 + '' +
99 'Component has a method called shouldComponentUpdate(). ' +
100 'shouldComponentUpdate should not be used when extending React.PureComponent. ' +
101 'Please extend React.Component if shouldComponentUpdate is used.',
@@ -138,7 +138,7 @@ describe('ReactPureComponent', () => {
138 root.render(<PureComponent />);
139 });
140 }).toErrorDev(
141 - 'Warning: ' +
141 + '' +
142 'PureComponent has a method called shouldComponentUpdate(). ' +
143 'shouldComponentUpdate should not be used when extending React.PureComponent. ' +
144 'Please extend React.Component if shouldComponentUpdate is used.',
packages/react/src/__tests__/ReactStrictMode-test.js
+11 -11
@@ -626,18 +626,18 @@ describe('Concurrent Mode', () => {
626 ).toErrorDev(
627 [
628 /* eslint-disable max-len */
629 - `Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
629 + `Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
630
631 * Move code with side effects to componentDidMount, and set initial state in the constructor.
632
633 Please update the following components: App`,
634 - `Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
634 + `Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
635
636 * Move data fetching code or side effects to componentDidUpdate.
637 * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://react.dev/link/derived-state
638
639 Please update the following components: Bar, Foo`,
640 - `Warning: Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
640 + `Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
641
642 * Move data fetching code or side effects to componentDidUpdate.
643
@@ -690,18 +690,18 @@ Please update the following components: App`,
690 ).toErrorDev(
691 [
692 /* eslint-disable max-len */
693 - `Warning: Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
693 + `Using UNSAFE_componentWillMount in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
694
695 * Move code with side effects to componentDidMount, and set initial state in the constructor.
696
697 Please update the following components: App`,
698 - `Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
698 + `Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
699
700 * Move data fetching code or side effects to componentDidUpdate.
701 * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://react.dev/link/derived-state
702
703 Please update the following components: Child`,
704 - `Warning: Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
704 + `Using UNSAFE_componentWillUpdate in strict mode is not recommended and may indicate bugs in your code. See https://react.dev/link/unsafe-component-lifecycles for details.
705
706 * Move data fetching code or side effects to componentDidUpdate.
707
@@ -713,20 +713,20 @@ Please update the following components: App`,
713 }).toWarnDev(
714 [
715 /* eslint-disable max-len */
716 - `Warning: componentWillMount has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
716 + `componentWillMount has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
717
718 * Move code with side effects to componentDidMount, and set initial state in the constructor.
719 * Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
720
721 Please update the following components: Parent`,
722 - `Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
722 + `componentWillReceiveProps has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
723
724 * Move data fetching code or side effects to componentDidUpdate.
725 * If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://react.dev/link/derived-state
726 * Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
727
728 Please update the following components: Parent`,
729 - `Warning: componentWillUpdate has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
729 + `componentWillUpdate has been renamed, and is not recommended for use. See https://react.dev/link/unsafe-component-lifecycles for details.
730
731 * Move data fetching code or side effects to componentDidUpdate.
732 * Rename componentWillUpdate to UNSAFE_componentWillUpdate to suppress this warning in non-strict mode. In React 18.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run \`npx react-codemod rename-unsafe-lifecycles\` in your project source folder.
@@ -997,7 +997,7 @@ describe('string refs', () => {
997 root.render(<OuterComponent />);
998 });
999 }).toErrorDev(
1000 - 'Warning: Component "OuterComponent" contains the string ref "somestring". ' +
1000 + 'Component "OuterComponent" contains the string ref "somestring". ' +
1001 'Support for string refs will be removed in a future major release. ' +
1002 'We recommend using useRef() or createRef() instead. ' +
1003 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
@@ -1083,7 +1083,7 @@ describe('context legacy', () => {
1083 root.render(<Root />);
1084 });
1085 }).toErrorDev(
1086 - 'Warning: Legacy context API has been detected within a strict-mode tree.' +
1086 + 'Legacy context API has been detected within a strict-mode tree.' +
1087 '\n\nThe old API will be supported in all 16.x releases, but applications ' +
1088 'using it should migrate to the new version.' +
1089 '\n\nPlease update the following components: ' +
packages/react/src/__tests__/ReactTypeScriptClass-test.ts
+6 -6
@@ -339,9 +339,9 @@ describe('ReactTypeScriptClass', function() {
339 ReactDOM.flushSync(() => root.render(React.createElement(Empty)))
340 }).toErrorDev([
341 // A failed component renders twice in DEV in concurrent mode
342 - 'Warning: No `render` method found on the Empty instance: ' +
342 + 'No `render` method found on the Empty instance: ' +
343 'you may have forgotten to define `render`.',
344 - 'Warning: No `render` method found on the Empty instance: ' +
344 + 'No `render` method found on the Empty instance: ' +
345 'you may have forgotten to define `render`.',
346 ]);
347 } finally {
@@ -644,7 +644,7 @@ describe('ReactTypeScriptClass', function() {
644 expect(() =>
645 test(React.createElement(MisspelledComponent1), 'SPAN', 'foo')
646 ).toErrorDev(
647 - 'Warning: ' +
647 + '' +
648 'MisspelledComponent1 has a method called componentShouldUpdate(). Did ' +
649 'you mean shouldComponentUpdate()? The name is phrased as a question ' +
650 'because the function is expected to return a value.'
@@ -655,7 +655,7 @@ describe('ReactTypeScriptClass', function() {
655 expect(() =>
656 test(React.createElement(MisspelledComponent2), 'SPAN', 'foo')
657 ).toErrorDev(
658 - 'Warning: ' +
658 + '' +
659 'MisspelledComponent2 has a method called componentWillRecieveProps(). ' +
660 'Did you mean componentWillReceiveProps()?'
661 );
@@ -665,7 +665,7 @@ describe('ReactTypeScriptClass', function() {
665 expect(() =>
666 test(React.createElement(MisspelledComponent3), 'SPAN', 'foo')
667 ).toErrorDev(
668 - 'Warning: ' +
668 + '' +
669 'MisspelledComponent3 has a method called UNSAFE_componentWillRecieveProps(). ' +
670 'Did you mean UNSAFE_componentWillReceiveProps()?'
671 );
@@ -700,7 +700,7 @@ describe('ReactTypeScriptClass', function() {
700 expect(() => {
701 test(React.createElement(ClassicRefs, {ref: ref}), 'DIV', 'foo');
702 }).toErrorDev([
703 - 'Warning: Component "ClassicRefs" contains the string ref "inner". ' +
703 + 'Component "ClassicRefs" contains the string ref "inner". ' +
704 'Support for string refs will be removed in a future major release. ' +
705 'We recommend using useRef() or createRef() instead. ' +
706 'Learn more about using refs safely here: https://react.dev/link/strict-mode-string-ref\n' +
packages/react/src/__tests__/createReactClassIntegration-test.js
+9 -9
@@ -63,7 +63,7 @@ describe('create-react-class-integration', () => {
63 },
64 }),
65 ).toErrorDev(
66 - 'Warning: Component: prop type `prop` is invalid; ' +
66 + 'Component: prop type `prop` is invalid; ' +
67 'it must be a function, usually from React.PropTypes.',
68 {withoutStack: true},
69 );
@@ -81,7 +81,7 @@ describe('create-react-class-integration', () => {
81 },
82 }),
83 ).toErrorDev(
84 - 'Warning: Component: context type `prop` is invalid; ' +
84 + 'Component: context type `prop` is invalid; ' +
85 'it must be a function, usually from React.PropTypes.',
86 {withoutStack: true},
87 );
@@ -99,7 +99,7 @@ describe('create-react-class-integration', () => {
99 },
100 }),
101 ).toErrorDev(
102 - 'Warning: Component: child context type `prop` is invalid; ' +
102 + 'Component: child context type `prop` is invalid; ' +
103 'it must be a function, usually from React.PropTypes.',
104 {withoutStack: true},
105 );
@@ -116,7 +116,7 @@ describe('create-react-class-integration', () => {
116 },
117 }),
118 ).toErrorDev(
119 - 'Warning: A component has a method called componentShouldUpdate(). Did you ' +
119 + 'A component has a method called componentShouldUpdate(). Did you ' +
120 'mean shouldComponentUpdate()? The name is phrased as a question ' +
121 'because the function is expected to return a value.',
122 {withoutStack: true},
@@ -133,7 +133,7 @@ describe('create-react-class-integration', () => {
133 },
134 }),
135 ).toErrorDev(
136 - 'Warning: NamedComponent has a method called componentShouldUpdate(). Did you ' +
136 + 'NamedComponent has a method called componentShouldUpdate(). Did you ' +
137 'mean shouldComponentUpdate()? The name is phrased as a question ' +
138 'because the function is expected to return a value.',
139 {withoutStack: true},
@@ -151,7 +151,7 @@ describe('create-react-class-integration', () => {
151 },
152 }),
153 ).toErrorDev(
154 - 'Warning: A component has a method called componentWillRecieveProps(). Did you ' +
154 + 'A component has a method called componentWillRecieveProps(). Did you ' +
155 'mean componentWillReceiveProps()?',
156 {withoutStack: true},
157 );
@@ -168,7 +168,7 @@ describe('create-react-class-integration', () => {
168 },
169 }),
170 ).toErrorDev(
171 - 'Warning: A component has a method called UNSAFE_componentWillRecieveProps(). ' +
171 + 'A component has a method called UNSAFE_componentWillRecieveProps(). ' +
172 'Did you mean UNSAFE_componentWillReceiveProps()?',
173 {withoutStack: true},
174 );
@@ -388,7 +388,7 @@ describe('create-react-class-integration', () => {
388 });
389
390 expect(() => expect(() => Component()).toThrow()).toErrorDev(
391 - 'Warning: Something is calling a React component directly. Use a ' +
391 + 'Something is calling a React component directly. Use a ' +
392 'factory or JSX instead. See: https://fb.me/react-legacyfactory',
393 {withoutStack: true},
394 );
@@ -796,7 +796,7 @@ describe('create-react-class-integration', () => {
796 root.render(<Component />);
797 });
798 }).toErrorDev(
799 - 'Warning: MyComponent: isMounted is deprecated. Instead, make sure to ' +
799 + 'MyComponent: isMounted is deprecated. Instead, make sure to ' +
800 'clean up subscriptions and pending requests in componentWillUnmount ' +
801 'to prevent memory leaks.',
802 {withoutStack: true},
packages/react/src/__tests__/forwardRef-test.js
+1 -1
@@ -427,7 +427,7 @@ describe('forwardRef', () => {
427 );
428 }).toErrorDev(
429 [
430 - 'Warning: forwardRef requires a render function but received a `memo` ' +
430 + 'forwardRef requires a render function but received a `memo` ' +
431 'component. Instead of forwardRef(memo(...)), use ' +
432 'memo(forwardRef(...)).',
433 ],
packages/shared/consoleWithStackDev.js
+1 -15
@@ -44,9 +44,6 @@ function printWarning(level, format, args, currentStack) {
44 // When changing this logic, you might want to also
45 // update consoleWithStackDev.www.js as well.
46 if (__DEV__) {
47 - const isErrorLogger =
48 - format === '%s\n\n%s\n' || format === '%o\n\n%s\n\n%s\n';
49 -
47 if (!supportsCreateTask && ReactSharedInternals.getCurrentStack) {
48 // We only add the current stack to the console when createTask is not supported.
49 // Since createTask requires DevTools to be open to work, this means that stacks
@@ -58,18 +55,7 @@ function printWarning(level, format, args, currentStack) {
55 }
56 }
57
61 - if (isErrorLogger) {
62 - // Don't prefix our default logging formatting in ReactFiberErrorLoggger.
63 - // Don't toString the arguments.
64 - args.unshift(format);
65 - } else {
66 - // TODO: Remove this prefix and stop toStringing in the wrapper and
67 - // instead do it at each callsite as needed.
68 - // Careful: RN currently depends on this prefix
69 - // eslint-disable-next-line react-internal/safe-string-coercion
70 - args = args.map(item => String(item));
71 - args.unshift('Warning: ' + format);
72 - }
58 + args.unshift(format);
59 // We intentionally don't use spread (or .apply) directly because it
60 // breaks IE9: https://github.com/facebook/react/issues/13610
61 // eslint-disable-next-line react-internal/no-production-logging