diff --git a/src/client/testing/testController/common/resultResolver.ts b/src/client/testing/testController/common/resultResolver.ts index d2b8fcaa24a5..2ce6039adba0 100644 --- a/src/client/testing/testController/common/resultResolver.ts +++ b/src/client/testing/testController/common/resultResolver.ts @@ -258,7 +258,11 @@ export class PythonResultResolver implements ITestResultResolver { // clear since subtest items don't persist between runs clearAllChildren(parentTestItem); } - const subTestItem = this.testController?.createTestItem(subtestId, subtestId); + const subTestItem = this.testController?.createTestItem( + subtestId, + subtestId, + parentTestItem.uri, + ); // create a new test item for the subtest if (subTestItem) { const traceback = data.traceback ?? ''; @@ -293,7 +297,11 @@ export class PythonResultResolver implements ITestResultResolver { // clear since subtest items don't persist between runs clearAllChildren(parentTestItem); } - const subTestItem = this.testController?.createTestItem(subtestId, subtestId); + const subTestItem = this.testController?.createTestItem( + subtestId, + subtestId, + parentTestItem.uri, + ); // create a new test item for the subtest if (subTestItem) { parentTestItem.children.add(subTestItem); diff --git a/src/test/testing/testController/resultResolver.unit.test.ts b/src/test/testing/testController/resultResolver.unit.test.ts index 108edb45da7e..05d2ee1dd0f3 100644 --- a/src/test/testing/testController/resultResolver.unit.test.ts +++ b/src/test/testing/testController/resultResolver.unit.test.ts @@ -344,10 +344,12 @@ suite('Result Resolver tests', () => { resultResolver.runIdToTestItem.set(subtestName, mockSubtestItem); let generatedId: string | undefined; + let generatedUri: Uri | undefined; testControllerMock - .setup((t) => t.createTestItem(typemoq.It.isAny(), typemoq.It.isAny())) + .setup((t) => t.createTestItem(typemoq.It.isAny(), typemoq.It.isAny(), typemoq.It.isAny())) .callback((id: string) => { generatedId = id; + generatedUri = workspaceUri; traceLog('createTestItem function called with id:', id); }) .returns(() => ({ id: 'id_this', label: 'label_this', uri: workspaceUri } as TestItem)); @@ -373,6 +375,7 @@ suite('Result Resolver tests', () => { // verify that the passed function was called for the single test item assert.ok(generatedId); + assert.strictEqual(generatedUri, workspaceUri); assert.strictEqual(generatedId, '[subTest with spaces and [brackets]]'); }); test('resolveExecution handles failed tests correctly', async () => {