From 985c548a35dc949c91231b446aa28db4bf738b44 Mon Sep 17 00:00:00 2001 From: Philipp Loose Date: Mon, 18 Nov 2019 21:40:52 +0100 Subject: [PATCH] Compare paths of testfiles with FileSystem.arePathsSame Fixes #8627. When the path of an actual test file (given by vscode.Uri.fsPath) is later compared against the fullPath of a single item of tests.TestFiles the drive letter mismatches on Windows and aborts further actions despite the rest of the path is the same. As a result code lenses on parametrized tests do not open a dropdown for selecting single tests. --- news/2 Fixes/8627.md | 1 + src/client/testing/display/picker.ts | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 news/2 Fixes/8627.md diff --git a/news/2 Fixes/8627.md b/news/2 Fixes/8627.md new file mode 100644 index 000000000000..d5059bb6b8e9 --- /dev/null +++ b/news/2 Fixes/8627.md @@ -0,0 +1 @@ +Fixes that the test selection drop-down did not open when a code lens for a parameterized test was clicked on windows. diff --git a/src/client/testing/display/picker.ts b/src/client/testing/display/picker.ts index a00f5ee94336..a6c6335b8ab7 100644 --- a/src/client/testing/display/picker.ts +++ b/src/client/testing/display/picker.ts @@ -3,6 +3,7 @@ import * as path from 'path'; import { QuickPickItem, Uri } from 'vscode'; import { IApplicationShell, ICommandManager } from '../../common/application/types'; import * as constants from '../../common/constants'; +import { IFileSystem } from '../../common/platform/types'; import { IServiceContainer } from '../../ioc/types'; import { CommandSource } from '../common/constants'; import { FlattenedTestFunction, ITestCollectionStorageService, TestFile, TestFunction, Tests, TestStatus, TestsToRun } from '../common/types'; @@ -12,7 +13,7 @@ import { ITestDisplay } from '../types'; export class TestDisplay implements ITestDisplay { private readonly testCollectionStorage: ITestCollectionStorageService; private readonly appShell: IApplicationShell; - constructor(@inject(IServiceContainer) serviceRegistry: IServiceContainer, + constructor(@inject(IServiceContainer) private readonly serviceRegistry: IServiceContainer, @inject(ICommandManager) private readonly commandManager: ICommandManager) { this.testCollectionStorage = serviceRegistry.get(ITestCollectionStorageService); this.appShell = serviceRegistry.get(IApplicationShell); @@ -57,7 +58,8 @@ export class TestDisplay implements ITestDisplay { return; } const fileName = file.fsPath; - const testFile = tests.testFiles.find(item => item.name === fileName || item.fullPath === fileName); + const fs = this.serviceRegistry.get(IFileSystem); + const testFile = tests.testFiles.find(item => item.name === fileName || fs.arePathsSame(item.fullPath, fileName)); if (!testFile) { return; }