diff --git a/packages/react-native/ReactCommon/jsinspector-modern/tests/ConsoleApiTest.cpp b/packages/react-native/ReactCommon/jsinspector-modern/tests/ConsoleApiTest.cpp index ce52946f8d00b4..1f30fcd2262c9f 100644 --- a/packages/react-native/ReactCommon/jsinspector-modern/tests/ConsoleApiTest.cpp +++ b/packages/react-native/ReactCommon/jsinspector-modern/tests/ConsoleApiTest.cpp @@ -281,6 +281,31 @@ TEST_P(ConsoleApiTest, testConsoleError) { eval("console.error('uh oh');"); } +TEST_P(ConsoleApiTest, testConsoleLogWithErrorObject) { + InSequence s; + expectConsoleApiCall(AllOf( + AtJsonPtr("/type", "log"), + AtJsonPtr("/args/0/type", "object"), + AtJsonPtr("/args/0/subtype", "error"), + AtJsonPtr("/args/0/className", "Error"), + AtJsonPtr( + "/args/0/description", + "Error: wut\n" + " at secondFunction (:6:28)\n" + " at firstFunction (:3:21)\n" + " at anonymous (:8:18)\n" + " at global (:9:5)"))); + eval(R"((() => { + function firstFunction() { + secondFunction(); + } + function secondFunction() { + console.log(new Error('wut')); + } + firstFunction(); + })())"); +} + TEST_P(ConsoleApiTest, testConsoleWarn) { InSequence s; expectConsoleApiCall(AllOf(