Skip to content

Commit 9de9f70

Browse files
authored
Fix #1284 debugging parameterized tests (#1299)
1 parent cf7723e commit 9de9f70

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/client/unittests/display/picker.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export class TestDisplay {
5555
testFunctions.some(testFunc => testFunc.nameToRun === fn.testFunction.nameToRun);
5656
});
5757

58-
window.showQuickPick(buildItemsForFunctions(rootDirectory, flattenedFunctions),
58+
window.showQuickPick(buildItemsForFunctions(rootDirectory, flattenedFunctions, undefined, undefined, debug),
5959
{ matchOnDescription: true, matchOnDetail: true }).then(testItem => {
6060
return onItemSelected(testItem, debug);
6161
});
@@ -72,7 +72,8 @@ enum Type {
7272
RunMethod = 6,
7373
ViewTestOutput = 7,
7474
Null = 8,
75-
SelectAndRunMethod = 9
75+
SelectAndRunMethod = 9,
76+
DebugMethod = 10
7677
}
7778
const statusIconMapping = new Map<TestStatus, string>();
7879
statusIconMapping.set(TestStatus.Pass, constants.Octicons.Test_Pass);
@@ -130,7 +131,7 @@ statusSortPrefix[TestStatus.Fail] = '2';
130131
statusSortPrefix[TestStatus.Skipped] = '3';
131132
statusSortPrefix[TestStatus.Pass] = '4';
132133

133-
function buildItemsForFunctions(rootDirectory: string, tests: FlattenedTestFunction[], sortBasedOnResults: boolean = false, displayStatusIcons: boolean = false): TestItem[] {
134+
function buildItemsForFunctions(rootDirectory: string, tests: FlattenedTestFunction[], sortBasedOnResults: boolean = false, displayStatusIcons: boolean = false, debug: boolean = false): TestItem[] {
134135
let functionItems: TestItem[] = [];
135136
tests.forEach(fn => {
136137
let icon = '';
@@ -142,7 +143,7 @@ function buildItemsForFunctions(rootDirectory: string, tests: FlattenedTestFunct
142143
description: '',
143144
detail: path.relative(rootDirectory, fn.parentTestFile.fullPath),
144145
label: icon + fn.testFunction.name,
145-
type: Type.RunMethod,
146+
type: debug === true ? Type.DebugMethod : Type.RunMethod,
146147
fn: fn
147148
});
148149
});
@@ -219,7 +220,13 @@ function onItemSelected(selection: TestItem, debug?: boolean) {
219220
args.push(selection.fn);
220221
break;
221222
}
223+
case Type.DebugMethod: {
224+
cmd = constants.Commands.Tests_Debug;
225+
args.push(selection.fn);
226+
args.push(true);
227+
break;
228+
}
222229
}
223230

224231
vscode.commands.executeCommand(cmd, ...args);
225-
}
232+
}

0 commit comments

Comments
 (0)