From 91d8a610da73b54dd1298ae1e21d777f40e5812f Mon Sep 17 00:00:00 2001 From: Justin Rabiller <38727166+snutij@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:18:06 +0100 Subject: [PATCH] Fix Run Current Test In Terminal for class line (#961) assign testItem from children only if matching child --- src/testController.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/testController.ts b/src/testController.ts index 400b9b817..d56fc4975 100644 --- a/src/testController.ts +++ b/src/testController.ts @@ -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;