diff --git a/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js b/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js index fedcbc9770436..1ee1bcf2b5662 100644 --- a/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js +++ b/packages/internal-test-utils/__tests__/ReactInternalTestUtils-test.js @@ -2427,7 +2427,17 @@ describe('ReactInternalTestUtils console assertions', () => { ], ]); }); - expect(message).toMatchInlineSnapshot(`"message.replace is not a function"`); + expect(message).toMatchInlineSnapshot(` + "assertConsoleErrorDev(expected) + + Unexpected error(s) recorded. + + - Expected errors + + Received errors + + - Hello + + Bye " + `); }); }); diff --git a/packages/internal-test-utils/consoleMock.js b/packages/internal-test-utils/consoleMock.js index 3b9ef2f8c0e53..45a59d2b4cb29 100644 --- a/packages/internal-test-utils/consoleMock.js +++ b/packages/internal-test-utils/consoleMock.js @@ -464,7 +464,12 @@ export function createLogAssertion( function printDiff() { return `${diff( expectedMessages - .map(message => message.replace('\n', ' ')) + .map(messageOrTuple => { + const message = Array.isArray(messageOrTuple) + ? messageOrTuple[0] + : messageOrTuple; + return message.replace('\n', ' '); + }) .join('\n'), receivedLogs.map(message => message.replace('\n', ' ')).join('\n'), {