Skip to content

Commit

Permalink
Add test for Hermes breakpoint persistence
Browse files Browse the repository at this point in the history
Summary:
Changelog: [Internal]

TSIA

bypass-github-export-checks

Reviewed By: huntie

Differential Revision: D53919695

fbshipit-source-id: 54792111f075d9834a2b61de91251614ad5ce770
  • Loading branch information
motiz88 authored and facebook-github-bot committed Feb 20, 2024
1 parent e699558 commit c02e83c
Showing 1 changed file with 40 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -533,4 +533,44 @@ TYPED_TEST(JsiIntegrationHermesTest, EvaluateExpressionInExecutionContext) {
std::to_string(executionContextId)));
}

TYPED_TEST(JsiIntegrationHermesTest, ResolveBreakpointAfterReload) {
this->connect();

InSequence s;

this->expectMessageFromPage(JsonParsed(AtJsonPtr("/id", 1)));
this->toPage_->sendMessage(R"({
"id": 1,
"method": "Debugger.setBreakpointByUrl",
"params": {"lineNumber": 2, "url": "breakpointTest.js"}
})");

this->reload();

this->expectMessageFromPage(JsonEq(R"({
"id": 2,
"result": {}
})"));
this->toPage_->sendMessage(R"({
"id": 2,
"method": "Debugger.enable"
})");

auto scriptInfo = this->expectMessageFromPage(JsonParsed(AllOf(
AtJsonPtr("/method", "Debugger.scriptParsed"),
AtJsonPtr("/params/url", "breakpointTest.js"))));
auto breakpointInfo = this->expectMessageFromPage(JsonParsed(AllOf(
AtJsonPtr("/method", "Debugger.breakpointResolved"),
AtJsonPtr("/params/location/lineNumber", 2))));
this->eval(R"( // line 0
globalThis.foo = function() { // line 1
Date.now(); // line 2
};
//# sourceURL=breakpointTest.js
)");
EXPECT_EQ(
breakpointInfo->value()["params"]["location"]["scriptId"],
scriptInfo->value()["params"]["scriptId"]);
}

} // namespace facebook::react::jsinspector_modern

0 comments on commit c02e83c

Please sign in to comment.