Skip to content

Commit 5c9ee8e

Browse files
committed
Add test output channel
1 parent bc3222c commit 5c9ee8e

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/features/dotnetTest.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,16 @@ import * as vscode from 'vscode';
1111
import * as serverUtils from "../omnisharpUtils";
1212
import * as protocol from '../protocol';
1313

14+
let _testOutputChannel: vscode.OutputChannel = undefined;
15+
16+
function getTestOutputChannel(): vscode.OutputChannel {
17+
if (_testOutputChannel == undefined) {
18+
_testOutputChannel = vscode.window.createOutputChannel(".NET Test Log");
19+
}
20+
21+
return _testOutputChannel;
22+
}
23+
1424
export function registerDotNetTestRunCommand(server: OmnisharpServer): vscode.Disposable {
1525
return vscode.commands.registerCommand(
1626
'dotnet.test.run',
@@ -25,15 +35,17 @@ export function registerDotNetTestDebugCommand(server: OmnisharpServer): vscode.
2535

2636
// Run test through dotnet-test command. This function can be moved to a separate structure
2737
export function runDotnetTest(testMethod: string, fileName: string, server: OmnisharpServer) {
38+
getTestOutputChannel().show();
39+
getTestOutputChannel().appendLine('Running test ' + testMethod + '...');
2840
serverUtils
2941
.runDotNetTest(server, { FileName: fileName, MethodName: testMethod })
3042
.then(
3143
response => {
3244
if (response.Pass) {
33-
vscode.window.showInformationMessage('Test passed');
45+
getTestOutputChannel().appendLine('Test passed \n');
3446
}
3547
else {
36-
vscode.window.showErrorMessage('Test failed');
48+
getTestOutputChannel().appendLine('Test failed \n');
3749
}
3850
},
3951
reason => {

0 commit comments

Comments
 (0)