Skip to content

Commit 9312fb2

Browse files
authored
fix launch config retrieval (#471)
1 parent 45158a6 commit 9312fb2

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/commands/runTest.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,19 @@ function getExistingLaunchConfig(
3232
"launch",
3333
args.workspaceFolder,
3434
);
35-
const testConfig = launchJson.configurations.findLast(
36-
(e: { name: string }) => e.name === "mix test",
35+
const configurations = launchJson.get<vscode.DebugConfiguration[]>(
36+
"configurations",
3737
);
38+
let testConfig: vscode.DebugConfiguration | undefined;
39+
if (Array.isArray(configurations)) {
40+
for (let i = configurations.length - 1; i >= 0; i--) {
41+
const c = configurations[i];
42+
if (c?.name === "mix test") {
43+
testConfig = c;
44+
break;
45+
}
46+
}
47+
}
3848

3949
if (testConfig === undefined) {
4050
return undefined;

0 commit comments

Comments
 (0)