Skip to content

Commit

Permalink
Fix Run Current Test In Terminal for class line (#961)
Browse files Browse the repository at this point in the history
assign testItem from children only if matching child
  • Loading branch information
snutij authored Jan 5, 2024
1 parent cd3572b commit 91d8a61
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/testController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -400,15 +400,20 @@ export class TestController {
testItems.forEach((test) => {
if (testItem) return;

if (test.children.size > 0) {
testItem = this.findTestByActiveLine(editor, test.children);
} else if (
if (
test.uri?.toString() === editor.document.uri.toString() &&
test.range?.start.line! <= line &&
test.range?.end.line! >= line
) {
testItem = test;
}

if (test.children.size > 0) {
const childInRange = this.findTestByActiveLine(editor, test.children);
if (childInRange) {
testItem = childInRange;
}
}
});

return testItem;
Expand Down

0 comments on commit 91d8a61

Please sign in to comment.