Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1606,7 +1606,7 @@ describe('ReactInternalTestUtils console assertions', () => {
it('fails if component stack is passed twice', () => {
const message = expectToThrowFailure(() => {
console.warn('Hi %s%s', '\n in div', '\n in div');
assertConsoleWarnDev(['Hi']);
assertConsoleWarnDev(['Hi \n in div (at **)']);
});
expect(message).toMatchInlineSnapshot(`
"assertConsoleWarnDev(expected)
Expand All @@ -1621,7 +1621,10 @@ describe('ReactInternalTestUtils console assertions', () => {
const message = expectToThrowFailure(() => {
console.warn('Hi %s%s', '\n in div', '\n in div');
console.warn('Bye %s%s', '\n in div', '\n in div');
assertConsoleWarnDev(['Hi', 'Bye']);
assertConsoleWarnDev([
'Hi \n in div (at **)',
'Bye \n in div (at **)',
]);
});
expect(message).toMatchInlineSnapshot(`
"assertConsoleWarnDev(expected)
Expand Down Expand Up @@ -2678,7 +2681,7 @@ describe('ReactInternalTestUtils console assertions', () => {
it('fails if component stack is passed twice', () => {
const message = expectToThrowFailure(() => {
console.error('Hi %s%s', '\n in div', '\n in div');
assertConsoleErrorDev(['Hi']);
assertConsoleErrorDev(['Hi \n in div (at **)']);
});
expect(message).toMatchInlineSnapshot(`
"assertConsoleErrorDev(expected)
Expand All @@ -2693,7 +2696,10 @@ describe('ReactInternalTestUtils console assertions', () => {
const message = expectToThrowFailure(() => {
console.error('Hi %s%s', '\n in div', '\n in div');
console.error('Bye %s%s', '\n in div', '\n in div');
assertConsoleErrorDev(['Hi', 'Bye']);
assertConsoleErrorDev([
'Hi \n in div (at **)',
'Bye \n in div (at **)',
]);
});
expect(message).toMatchInlineSnapshot(`
"assertConsoleErrorDev(expected)
Expand Down
19 changes: 15 additions & 4 deletions packages/react-dom/src/__tests__/ReactDOM-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -548,16 +548,23 @@ describe('ReactDOM', () => {
' in App (at **)',
// ReactDOM(App > div > ServerEntry) >>> ReactDOMServer(Child) >>> ReactDOMServer(App2) >>> ReactDOMServer(blink)
'Invalid ARIA attribute `ariaTypo2`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' +
' in blink (at **)',
' in blink (at **)\n' +
' in App2 (at **)\n' +
' in Child (at **)\n' +
' in ServerEntry (at **)',
// ReactDOM(App > div > ServerEntry) >>> ReactDOMServer(Child) >>> ReactDOMServer(App2 > Child2 > span)
'Invalid ARIA attribute `ariaTypo3`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' +
' in span (at **)\n' +
' in Child2 (at **)\n' +
' in App2 (at **)',
' in App2 (at **)\n' +
' in Child (at **)\n' +
' in ServerEntry (at **)',
// ReactDOM(App > div > ServerEntry) >>> ReactDOMServer(Child > span)
'Invalid ARIA attribute `ariaTypo4`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' +
' in span (at **)\n' +
' in Child (at **)',
' in Child (at **)\n' +
' in ServerEntry (at **)',

// ReactDOM(App > div > font)
'Invalid ARIA attribute `ariaTypo5`. ARIA attributes follow the pattern aria-* and must be lowercase.\n' +
' in font (at **)\n' +
Expand Down Expand Up @@ -775,7 +782,11 @@ describe('ReactDOM', () => {

// @TODO remove this warning check when we loosen the tag nesting restrictions to allow arbitrary tags at the
// root of the application
assertConsoleErrorDev(['In HTML, <head> cannot be a child of <main>']);
assertConsoleErrorDev([
'In HTML, <head> cannot be a child of <main>.\nThis will cause a hydration error.\n' +
' in head (at **)\n' +
' in App (at **)',
]);

await act(() => {
root.render(<App phase={1} />);
Expand Down
9 changes: 6 additions & 3 deletions packages/react-dom/src/__tests__/ReactDOMSrcObject-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,11 +120,14 @@ describe('ReactDOMSrcObject', () => {

assertConsoleErrorDev([
'Passing Blob, MediaSource or MediaStream to <source src> is not supported. ' +
'Pass it directly to <img src>, <video src> or <audio src> instead.',
'Pass it directly to <img src>, <video src> or <audio src> instead.' +
'\n in source (at **)',
'Passing Blob, MediaSource or MediaStream to <source src> is not supported. ' +
'Pass it directly to <img src>, <video src> or <audio src> instead.',
'Pass it directly to <img src>, <video src> or <audio src> instead.' +
'\n in source (at **)',
'Passing Blob, MediaSource or MediaStream to <source src> is not supported. ' +
'Pass it directly to <img src>, <video src> or <audio src> instead.',
'Pass it directly to <img src>, <video src> or <audio src> instead.' +
'\n in source (at **)',
]);
expect(videoRef.current.firstChild.src).not.toMatch(/^blob:/);
expect(videoRef.current.firstChild.src).toContain('[object%20Blob]'); // toString:ed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ describe('ReactFlushSync', () => {
assertConsoleErrorDev([
'flushSync was called from inside a lifecycle method. React ' +
'cannot flush when React is already rendering. Consider moving this ' +
'call to a scheduler task or micro task.',
'call to a scheduler task or micro task.' +
'\n in App',
]);

await waitForPaint([]);
Expand Down
9 changes: 8 additions & 1 deletion packages/react/src/__tests__/ReactChildren-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,14 @@ describe('ReactChildren', () => {
'Check the render method of `ComponentRenderingMappedChildren`.' +
' See https://react.dev/link/warning-keys for more information.\n' +
' in div (at **)\n' +
' in **/ReactChildren-test.js:**:** (at **)',
' in **/ReactChildren-test.js:**:** (at **)\n' +
(gate('build') === 'development'
? ' in **/ReactChildren.js:**:** (at **)\n'
: 'in **/react.development.js:**:** (at **)\n') +
' in mapIntoArray (at **)\n' +
' in mapIntoArray (at **)\n' +
' in Object.mapChildren (at **)\n' +
' in ComponentRenderingMappedChildren (at **)',
]);
});

Expand Down
Loading