Skip to content

Commit

Permalink
Support list of projects in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
deitry committed Dec 12, 2022
1 parent a891b44 commit 0263f91
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 7 deletions.
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,17 @@
"description": "Whether to enable anonymous usage collection."
},
"dotnet-test-explorer.testProjectPath": {
"type": "string",
"anyOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
],
"default": "",
"description": "Glob pattern that points to path of .NET Core test project(s).",
"examples": [
Expand Down
15 changes: 9 additions & 6 deletions src/testDirectories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@ export class TestDirectories {
return;
}

const testDirectoryGlob = Utility.getConfiguration().get<string>("testProjectPath");
const testProjectsConfiguration = Utility.getConfiguration().get("testProjectPath");
const testProjectsArray = [].concat(testProjectsConfiguration);

const matchingDirs = [];

vscode.workspace.workspaceFolders.forEach((folder) => {

const globPattern = folder.uri.fsPath.replace("\\", "/") + "/" + testDirectoryGlob;
testProjectsArray.forEach(testProjectGlob => {
const globPattern = folder.uri.fsPath.replace("\\", "/") + "/" + testProjectGlob;

Logger.Log(`Finding projects for pattern ${globPattern}`);
Logger.Log(`Finding projects for pattern ${globPattern}`);

const matchingDirsForWorkspaceFolder = glob.sync(globPattern);
const matchingDirsForWorkspaceFolder = glob.sync(globPattern);

matchingDirs.push(...matchingDirsForWorkspaceFolder);
matchingDirs.push(...matchingDirsForWorkspaceFolder);

Logger.Log(`Found ${matchingDirsForWorkspaceFolder.length} matches for pattern in folder ${folder.uri.fsPath}`);
Logger.Log(`Found ${matchingDirsForWorkspaceFolder.length} matches for pattern in folder ${folder.uri.fsPath}`);
})
});

this.directories = evaluateTestDirectories(matchingDirs);
Expand Down

0 comments on commit 0263f91

Please sign in to comment.