Skip to content

Commit 2b07450

Browse files
committed
Handle single testmethod run correctly
1 parent c493171 commit 2b07450

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/commonRunTestsHandler.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,18 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
114114

115115
// enqueue everything up front so user sees immediately which tests will run
116116
mapTestClasses.forEach((test) => {
117+
let methodTarget = "";
118+
if (request.include?.length === 1) {
119+
const idParts = request.include[0].id.split(":");
120+
if (idParts.length === 5) {
121+
methodTarget = request.include[0].id;
122+
}
123+
}
117124
test.children.forEach((methodTest) => {
125+
if (methodTarget && methodTarget !== methodTest.id) {
126+
// User specified a single test method to run, so skip all others
127+
return;
128+
}
118129
run.enqueued(methodTest);
119130
});
120131
});
@@ -253,7 +264,7 @@ export async function commonRunTestsHandler(controller: vscode.TestController, r
253264
if (request.include?.length === 1) {
254265
const idParts = request.include[0].id.split(":");
255266
if (idParts.length === 5) {
256-
testSpec = `${username}:${idParts[3]}:${idParts[4]}`;
267+
testSpec = `${username}\\${idParts[3].split(".").slice(0, -1).join("\\")}:${idParts[3]}:${idParts[4]}`;
257268
}
258269
}
259270

0 commit comments

Comments
 (0)