omnisharp-vscode/test/unitTests/logging/OmnisharpLoggerObserver.tes...

184 строки
8.6 KiB
TypeScript
Исходник Постоянная ссылка Обычный вид История

Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { should, expect } from 'chai';
import { getNullChannel } from '../testAssets/Fakes';
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
import { OmnisharpLoggerObserver } from '../../../src/observers/OmnisharpLoggerObserver';
import { OmnisharpServerMsBuildProjectDiagnostics, EventWithMessage, OmnisharpServerOnStdErr, OmnisharpServerMessage, OmnisharpServerOnServerError, OmnisharpInitialisation, OmnisharpLaunch, OmnisharpServerOnError, OmnisharpFailure, OmnisharpEventPacketReceived } from '../../../src/omnisharp/loggingEvents';
suite("OmnisharpLoggerObserver", () => {
suiteSetup(() => should());
let logOutput = "";
let observer = new OmnisharpLoggerObserver({
...getNullChannel(),
append: (text: string) => { logOutput += text; },
});
setup(() => {
logOutput = "";
});
suite('OmnisharpServerMsBuildProjectDiagnostics', () => {
test("Logged message is empty if there are no warnings and erros", () => {
let event = new OmnisharpServerMsBuildProjectDiagnostics({
FileName: "someFile",
Warnings: [],
Errors: []
});
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
observer.post(event);
expect(logOutput).to.be.empty;
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
});
test(`Logged message contains the Filename if there is atleast one error or warning`, () => {
let event = new OmnisharpServerMsBuildProjectDiagnostics({
FileName: "someFile",
Warnings: [{ FileName: "warningFile", LogLevel: "", Text: "", StartLine: 0, EndLine: 0, StartColumn: 0, EndColumn: 0 }],
Errors: []
});
observer.post(event);
expect(logOutput).to.contain(event.diagnostics.FileName);
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
});
[
new OmnisharpServerMsBuildProjectDiagnostics({
FileName: "someFile",
Warnings: [{ FileName: "warningFile", LogLevel: "", Text: "someWarningText", StartLine: 1, EndLine: 2, StartColumn: 3, EndColumn: 4 }],
Errors: [{ FileName: "errorFile", LogLevel: "", Text: "someErrorText", StartLine: 5, EndLine: 6, StartColumn: 7, EndColumn: 8 }]
})
].forEach((event: OmnisharpServerMsBuildProjectDiagnostics) => {
test(`Logged message contains the Filename, StartColumn, StartLine and Text for the diagnostic warnings`, () => {
observer.post(event);
event.diagnostics.Warnings.forEach(element => {
expect(logOutput).to.contain(element.FileName);
expect(logOutput).to.contain(element.StartLine);
expect(logOutput).to.contain(element.StartColumn);
expect(logOutput).to.contain(element.Text);
});
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
});
test(`Logged message contains the Filename, StartColumn, StartLine and Text for the diagnostics errors`, () => {
observer.post(event);
event.diagnostics.Errors.forEach(element => {
expect(logOutput).to.contain(element.FileName);
expect(logOutput).to.contain(element.StartLine);
expect(logOutput).to.contain(element.StartColumn);
expect(logOutput).to.contain(element.Text);
});
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
});
});
});
[
new OmnisharpServerOnStdErr("on std error message"),
new OmnisharpServerMessage("server message"),
].forEach((event: EventWithMessage) => {
test(`${event.constructor.name}: Message is logged`, () => {
observer.post(event);
expect(logOutput).to.contain(event.message);
});
});
Refactoring status using rxjs (#2133) * hack * Refactored status into 4 separate observers * Resolved warning and information messages * Deleted status.ts * Changes to retain this context * Created fascade for statusbar and texteditor * Subscribe to event stream * Working! * Nits * Mocking warning message * Tried mocking setTimeOut * warning message changes * warning message correct definition * virtual time running * done called multiple time * renamed observer and subject * changes * some changes * refactor^2 * merge conflicts * using rx debounce * Warning Message Observer tests * Remove loadsh.debounce and renamed observer * Move the workspace info invocation to server * Clean up * More test to statusBarObserver * Clean up tests * Fixed ttd * Use vscode commands instead of calling into commands.ts * Added test for information message observer * Tests for status bar obsever * project status observer * Changes to show two observers * some more changes * Lot of questions! * build issues * Remove usings * comments * Remove unnecessary cases * Changes * Remove usings * Dipsose the disposables after the server stop event * Remove the cake thing * Project Status Bar * Clean up the tests * Changed to dcoument * Remove unnecessary functions from the adapter * remove unnecessary change * Remove some changes * changes * Test for server error * Removed comment and modified the initialisation * Empty disposable * Corrected the usage of the disposables * Added comments for debouncer * disposable try
2018-04-06 02:03:15 +03:00
test(`OmnisharpServerOnServerError: Message is logged`, () => {
let event = new OmnisharpServerOnServerError("on server error message");
observer.post(event);
expect(logOutput).to.contain(event.err);
});
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
[
new OmnisharpInitialisation(new Date(5), "somePath"),
].forEach((event: OmnisharpInitialisation) => {
test(`${event.constructor.name}: TimeStamp and SolutionPath are logged`, () => {
observer.post(event);
expect(logOutput).to.contain(event.timeStamp.toLocaleString());
expect(logOutput).to.contain(event.solutionPath);
});
});
test('OmnisharpFailure: Failure message is logged', () => {
let event = new OmnisharpFailure("failureMessage", new Error("errorMessage"));
observer.post(event);
expect(logOutput).to.contain(event.message);
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
});
suite('OmnisharpEventPacketReceived', () => {
[
new OmnisharpEventPacketReceived("TRACE", "foo", "someMessage"),
new OmnisharpEventPacketReceived("DEBUG", "foo", "someMessage"),
new OmnisharpEventPacketReceived("INFORMATION", "foo", "someMessage"),
new OmnisharpEventPacketReceived("WARNING", "foo", "someMessage"),
new OmnisharpEventPacketReceived("ERROR", "foo", "someMessage"),
new OmnisharpEventPacketReceived("CRITICAL", "foo", "someMessage"),
].forEach((event: OmnisharpEventPacketReceived) => {
test(`${event.logLevel} messages are logged with name and the message`, () => {
observer.post(event);
expect(logOutput).to.contain(event.name);
expect(logOutput).to.contain(event.message);
});
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
});
test('Throws error on unknown log level', () => {
let event = new OmnisharpEventPacketReceived("random log level", "foo", "someMessage");
let fn = function () { observer.post(event); };
expect(fn).to.throw(Error);
});
test(`Information messages with name OmniSharp.Middleware.LoggingMiddleware and follow pattern /^\/[\/\w]+: 200 \d+ms/ are not logged`, () => {
let event = new OmnisharpEventPacketReceived("INFORMATION", "OmniSharp.Middleware.LoggingMiddleware", "/codecheck: 200 339ms");
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
observer.post(event);
expect(logOutput).to.be.empty;
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
});
});
suite('OmnisharpLaunch', () => {
[
{ 'event': new OmnisharpLaunch("5.8.0", undefined, "someCommand", 4), 'expected': "OmniSharp server started with Mono 5.8.0." },
{ 'event': new OmnisharpLaunch(undefined, undefined, "someCommand", 4), 'expected': "OmniSharp server started." },
{ 'event': new OmnisharpLaunch("5.8.0", "path to mono", "someCommand", 4), 'expected': "OmniSharp server started with Mono 5.8.0 (path to mono)." },
{ 'event': new OmnisharpLaunch(undefined, "path to mono", "someCommand", 4), 'expected': "OmniSharp server started." },
].forEach((data: { event: OmnisharpLaunch, expected: string }) => {
const event = data.event;
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
test(`Command and Pid are displayed`, () => {
observer.post(event);
expect(logOutput).to.contain(event.command);
expect(logOutput).to.contain(event.pid);
});
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
test(`Message is displayed depending on monoVersion and monoPath value`, () => {
observer.post(event);
expect(logOutput).to.contain(data.expected);
});
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
});
});
suite('OmnisharpServerOnError', () => {
test(`Doesnot throw error if FileName is null`, () => {
let event = new OmnisharpServerOnError({ Text: "someText", FileName: null, Line: 1, Column: 2 });
let fn = function () { observer.post(event); };
expect(fn).to.not.throw(Error);
});
[
new OmnisharpServerOnError({ Text: "someText", FileName: "someFile", Line: 1, Column: 2 }),
].forEach((event: OmnisharpServerOnError) => {
test(`Contains the error message text`, () => {
observer.post(event);
expect(logOutput).to.contain(event.errorMessage.Text);
});
test(`Contains the error message FileName, Line and column if FileName is not null`, () => {
observer.post(event);
if (event.errorMessage.FileName) {
expect(logOutput).to.contain(event.errorMessage.FileName);
expect(logOutput).to.contain(event.errorMessage.Line);
expect(logOutput).to.contain(event.errorMessage.Column);
}
});
});
Refactor logger, reporter and channel into a unified EventStream using Rx Observable (#2084) * Changes to refactor logging in server * Adding packages * Changes * Remove reporter from CSharpExtDownloader * remove telemtery reporter from server.ts * remove reporter from definitionProvider * Remove reporter from dotnetTest.ts * Debugger Activation + Commands * reduce message types * remove reporter from commands.ts * remove channel from status.ts * Remove reporter & logger from extension.ts * Build issues * Add missing rx dependency * Changed to download progress * Removed using and pass platformInfo * Moved files in observer folder * Renamed the files and added omnisharp channel observer * Remove unnecessary format * Changes in main.ts * Remove channel from global declaration * Preserving the context in onNext invocations * Pulled platformInfo out of server * Remove unnecessary variable * Formatting * Renamed observers * Add mocha+wallaby tests eventually the feature tests should be removed and most of our tests should become unit tests that are runnable from the command line or via wallaby. npm run tdd will enable using mocha's command line tdd capability * Code clean up * Fix `tdd` command * Fix test paths * Add initial DotnetChannelObserver test * Testing the download messages * Remove logger from requestQueue.ts * Fix builds * Use package manager factory * Remove Lines * Remove extra appendLine * Added test for csharp logger and channel * Extracted base class for observers * Test having dependency on vscode * vscode adapter changes * Changes for adapter * Refactored Omnisharp Manager * Moved from interfaces to classes * Renamed onNext to post * Created class EventStream * Removed comment * Added missing break * Added test for Omnisharp Logger * Test for OmnisharpLoggerObserver * Test for telemetry reporter observer * Added test for all the observers * minor nits * Changes * Remove unnecessary imports * remove import * Modified failing test * Make tests pass * Renamed platformInfo * CR feedback
2018-03-15 00:19:01 +03:00
});
});