Skip to content

Commit

Permalink
Compare paths of testfiles with FileSystem.arePathsSame
Browse files Browse the repository at this point in the history
Fixes microsoft#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.
  • Loading branch information
Philipp Loose committed Dec 11, 2019
1 parent f43665c commit 985c548
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions news/2 Fixes/8627.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 4 additions & 2 deletions src/client/testing/display/picker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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>(ITestCollectionStorageService);
this.appShell = serviceRegistry.get<IApplicationShell>(IApplicationShell);
Expand Down Expand Up @@ -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>(IFileSystem);
const testFile = tests.testFiles.find(item => item.name === fileName || fs.arePathsSame(item.fullPath, fileName));
if (!testFile) {
return;
}
Expand Down

0 comments on commit 985c548

Please sign in to comment.