fix(run): resolve Java launches in attached projects

Цей коміт міститься в:
l0ng-ai committed 2026-11-23 21:58:42 +08:00
1 джерело d4b5581441
коміт b6c7c519f3
13 files changed
+312 -95

No files matched your search

+22
Переглянути файл
@@ -68,6 +68,7 @@ beforeEach(() => {
afterEach(() => {
resetRuns();
_resetI18nForTests();
useProject.setState({ project: null });
});
it.each(["sibling", "/outside/modules"])("runs from %s using the stored module's classpath", async (cwd) => {
@@ -142,6 +143,27 @@ it("finds the source module for an old saved configuration without a module", as
);
});
it.each([null, "/elsewhere"])("recovers an attached module from its indexed path with cwd %s", async (cwd) => {
const root = "/p";
const member = "/other/spring";
const module = `${member}/web`;
useProject.setState({
project: { root, workspace: { version: 1, name: "demo", projects: [root, member] } } as never,
});
ipc.findFiles.mockResolvedValueOnce({
status: "ok",
data: [{ path: `${module}/src/main/java/a/Main.java`, relPath: "spring/web/src/main/java/a/Main.java" }],
});
const session = await startRun({ ...config, cwd });
expect(session?.status).toBe("running");
expect(ipc.javaResolveLaunch).toHaveBeenCalledWith(module, false, "automatic", expect.any(Number));
expect(ipc.runStart).toHaveBeenCalledWith(
expect.objectContaining({ cwd: cwd ?? module, module }),
expect.anything(),
expect.any(Number),
);
});
it.each([["-cp", "lib/*"], []])("colours Spring Boot runs without classpath resolution (%j)", async (...classpath) => {
const args = ["-Xmx256m", ...classpath, "a.Main", "--spring.profiles.active=dev"];
const boot = { ...config, kind: "spring-boot", args };