diff --git a/frameworks/native/appkit/ability_delegator/runner_runtime/js_test_runner.cpp b/frameworks/native/appkit/ability_delegator/runner_runtime/js_test_runner.cpp index ee8e444aa71cf659eeafbeabeca710a9c9836bae..a487bb6ba12624eb62ea1a3e87e0cfd1810d0a3c 100644 --- a/frameworks/native/appkit/ability_delegator/runner_runtime/js_test_runner.cpp +++ b/frameworks/native/appkit/ability_delegator/runner_runtime/js_test_runner.cpp @@ -23,6 +23,8 @@ namespace OHOS { namespace RunnerRuntime { +const int ABC_LENGTH = 4; + std::unique_ptr JsTestRunner::Create(const std::unique_ptr &runtime, const std::shared_ptr &args, const AppExecFwk::BundleInfo &bundleInfo, bool isFaJsModel) { @@ -240,14 +242,18 @@ void JsTestRunner::ReportStatus(const std::string &msg) std::string JsTestRunner::GetTestRunnerPath(const std::shared_ptr &args) { std::string result; + result.append(args->GetTestModuleName()); if (!args->GetTestRunnerClassName().empty()) { - result.append(args->GetTestModuleName()); if (args->GetTestRunnerClassName().find("/") == std::string::npos) { result.append(LOWERCASETESTRUNNER); } result.append(args->GetTestRunnerClassName()); } else { + result.append("/"); result.append(args->GetTestRunnerPath()); + if (result.compare(result.size() - ABC_LENGTH, ABC_LENGTH, ".ets") == 0) { + result.erase(result.size() - ABC_LENGTH); + } } return result; } diff --git a/test/unittest/runtime_test/js_runtime_test.cpp b/test/unittest/runtime_test/js_runtime_test.cpp index e3bf5fcb6964909caf542259c5bf543f70830274..17459ad6fad8f9f15540b011a9eead32419bf170 100755 --- a/test/unittest/runtime_test/js_runtime_test.cpp +++ b/test/unittest/runtime_test/js_runtime_test.cpp @@ -555,6 +555,7 @@ HWTEST_F(JsRuntimeTest, JsRuntimeStartDebugModeTest_0100, TestSize.Level2) debugOption.isDebugApp = true; debugOption.isStartWithNative = false; debugOption.isDeveloperMode = true; + debugOption.arkTSMode = "static"; jsRuntime->StartDebugMode(debugOption); EXPECT_TRUE(jsRuntime != nullptr);