Skip to content

Commit 83618ae

Browse files
authored
Merge pull request #4602 from Toucan4Life/master
"testRunSettings" option is now available through solution
2 parents 132e236 + e96b99a commit 83618ae

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

src/features/dotnetTest.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import LaunchConfiguration from './launchConfiguration';
1919
import Disposable from '../Disposable';
2020
import CompositeDisposable from '../CompositeDisposable';
2121
import { LanguageMiddlewareFeature } from '../omnisharp/LanguageMiddlewareFeature';
22+
import OptionProvider from '../observers/OptionProvider';
2223

2324
const TelemetryReportingDelay = 2 * 60 * 1000; // two minutes
2425

@@ -29,7 +30,7 @@ export default class TestManager extends AbstractProvider {
2930
private _telemetryIntervalId: NodeJS.Timer = undefined;
3031
private _eventStream: EventStream;
3132

32-
constructor(server: OmniSharpServer, eventStream: EventStream, languageMiddlewareFeature: LanguageMiddlewareFeature) {
33+
constructor(private optionProvider: OptionProvider, server: OmniSharpServer, eventStream: EventStream, languageMiddlewareFeature: LanguageMiddlewareFeature) {
3334
super(server, languageMiddlewareFeature);
3435
this._eventStream = eventStream;
3536

@@ -192,7 +193,7 @@ export default class TestManager extends AbstractProvider {
192193
}
193194

194195
private _getRunSettings(filename: string): string | undefined {
195-
const testSettingsPath = vscode.workspace.getConfiguration('omnisharp').get<string>('testRunSettings');
196+
const testSettingsPath = this.optionProvider.GetLatestOptions().testRunSettings;
196197
if (!testSettingsPath) {
197198
return undefined;
198199
}

src/omnisharp/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ export async function activate(context: vscode.ExtensionContext, packageJSON: an
6767
languageMiddlewareFeature.register();
6868
disposables.add(languageMiddlewareFeature);
6969
let localDisposables: CompositeDisposable;
70-
const testManager = new TestManager(server, eventStream, languageMiddlewareFeature);
70+
const testManager = new TestManager(optionProvider, server, eventStream, languageMiddlewareFeature);
7171
const completionProvider = new CompletionProvider(server, languageMiddlewareFeature);
7272

7373
disposables.add(server.onServerStart(() => {

src/omnisharp/options.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ export class Options {
4040
public monoPath?: string,
4141
public dotnetPath?: string,
4242
public excludePaths?: string[],
43-
public maxProjectFileCountForDiagnosticAnalysis?: number | null) {
43+
public maxProjectFileCountForDiagnosticAnalysis?: number | null,
44+
public testRunSettings?: string) {
4445
}
4546

4647
public static Read(vscode: vscode): Options {
@@ -108,6 +109,8 @@ export class Options {
108109

109110
const maxProjectFileCountForDiagnosticAnalysis = csharpConfig.get<number | null>('maxProjectFileCountForDiagnosticAnalysis', 1000);
110111

112+
const testRunSettings = omnisharpConfig.get<string>('testRunSettings', undefined);
113+
111114
const excludePaths = this.getExcludedPaths(vscode);
112115

113116
return new Options(
@@ -144,7 +147,8 @@ export class Options {
144147
monoPath,
145148
dotnetPath,
146149
excludePaths,
147-
maxProjectFileCountForDiagnosticAnalysis
150+
maxProjectFileCountForDiagnosticAnalysis,
151+
testRunSettings
148152
);
149153
}
150154

test/unitTests/options.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ suite("Options tests", () => {
3434
options.enableEditorConfigSupport.should.equal(false);
3535
options.enableDecompilationSupport.should.equal(false);
3636
options.enableImportCompletion.should.equal(false);
37+
expect(options.testRunSettings).to.be.undefined;
3738
expect(options.defaultLaunchSolution).to.be.undefined;
3839
});
3940

@@ -143,4 +144,13 @@ suite("Options tests", () => {
143144

144145
options.defaultLaunchSolution.should.equal("some_valid_solution.sln");
145146
});
147+
148+
test('"omnisharp.testRunSettings" is used if set', () => {
149+
const vscode = getVSCodeWithConfig();
150+
updateConfig(vscode, 'omnisharp', 'testRunSettings', 'some_valid_path\\some_valid_runsettings_files.runsettings');
151+
152+
const options = Options.Read(vscode);
153+
154+
options.testRunSettings.should.equal("some_valid_path\\some_valid_runsettings_files.runsettings");
155+
});
146156
});

0 commit comments

Comments
 (0)