Skip to content

Commit

Permalink
Pass env variables on test debug
Browse files Browse the repository at this point in the history
  • Loading branch information
nohwnd committed Mar 31, 2022
1 parent 7689b0d commit 88b3a29
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/features/dotnetTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export default class TestManager extends AbstractProvider {
}
}

private _createLaunchConfiguration(program: string, args: string, cwd: string, debuggerEventsPipeName: string) {
private _createLaunchConfiguration(program: string, args: string, cwd: string, environmentVariables: Map<string, string>, debuggerEventsPipeName: string) {
let debugOptions = vscode.workspace.getConfiguration('csharp').get('unitTestDebuggingOptions');

// Get the initial set of options from the workspace setting
Expand All @@ -333,7 +333,8 @@ export default class TestManager extends AbstractProvider {
debuggerEventsPipeName: debuggerEventsPipeName,
program: program,
args: args,
cwd: cwd
cwd: cwd,
env: environmentVariables,
};

// Now fill in the rest of the options
Expand Down Expand Up @@ -369,6 +370,7 @@ export default class TestManager extends AbstractProvider {
response.FileName,
response.Arguments,
response.WorkingDirectory,
response.EnvironmentVariables,
debugEventListener.pipePath());
}
finally {
Expand Down Expand Up @@ -497,7 +499,7 @@ export default class TestManager extends AbstractProvider {

try {
let response = await serverUtils.debugTestClassGetStartInfo(this._server, request);
return this._createLaunchConfiguration(response.FileName, response.Arguments, response.WorkingDirectory, debugEventListener.pipePath());
return this._createLaunchConfiguration(response.FileName, response.Arguments, response.WorkingDirectory, response.EnvironmentVariables, debugEventListener.pipePath());
}
finally {
listener.dispose();
Expand Down Expand Up @@ -537,7 +539,7 @@ export default class TestManager extends AbstractProvider {
return null;
}

return this._createLaunchConfiguration(response.FileName, response.Arguments, response.WorkingDirectory, debugEventListener.pipePath());
return this._createLaunchConfiguration(response.FileName, response.Arguments, response.WorkingDirectory, response.EnvironmentVariables, debugEventListener.pipePath());
}
finally {
listener.dispose();
Expand Down

0 comments on commit 88b3a29

Please sign in to comment.