Skip to content

Commit

Permalink
Validate Indentation for OmnisharpProcess messages (#2119)
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Puszkiewicz authored Mar 16, 2018
1 parent 7cc2291 commit 341d646
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 19 deletions.
17 changes: 16 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 17 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,21 @@
"cov:merge-html": "istanbul-combine -d ./coverage -r html ./.nyc_output/*.json",
"cov:report": "npm run cov:merge && codecov"
},
"nyc": {
"include": [
"src/**/*.ts",
"src/**/*.tsx"
],
"extension": [
".ts",
".tsx"
],
"require": [
"ts-node/register",
"source-map-support/register"
],
"sourceMap": true,
"instrument": true
"nyc": {
"include": [
"src/**/*.ts",
"src/**/*.tsx"
],
"extension": [
".ts",
".tsx"
],
"require": [
"ts-node/register",
"source-map-support/register"
],
"sourceMap": true,
"instrument": true
},
"dependencies": {
"fs-extra": "^5.0.0",
Expand All @@ -81,6 +81,7 @@
"devDependencies": {
"@types/chai": "4.0.8",
"@types/chai-arrays": "1.0.2",
"@types/chai-string": "^1.4.0",
"@types/fs-extra": "4.0.5",
"@types/mkdirp": "0.5.1",
"@types/mocha": "2.2.32",
Expand All @@ -95,6 +96,7 @@
"chai-arrays": "2.0.0",
"chai-as-promised": "7.1.1",
"chai-fs": "2.0.0",
"chai-string": "^1.4.0",
"codecov": "^3.0.0",
"copyfiles": "^1.2.0",
"cross-env": "5.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src/observers/OmnisharpDebugModeLoggerObserver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class OmnisharpDebugModeLoggerObserver extends BaseLoggerObserver {
this.handleOmnisharpServerDequeueRequest(<OmnisharpServerDequeueRequest>event);
break;
case OmnisharpServerProcessRequestStart.name:
this.handleOmnisharpProcessRequestStart(<OmnisharpServerEnqueueRequest>event);
this.handleOmnisharpProcessRequestStart(<OmnisharpServerProcessRequestStart>event);
break;
case OmnisharpServerProcessRequestComplete.name:
this.logger.decreaseIndent();
Expand Down
18 changes: 16 additions & 2 deletions test/unitTests/logging/OmnisharpDebugModeLoggerObserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@
* 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 { use, should, expect } from 'chai';
import { getNullChannel } from './Fakes';
import { OmnisharpServerVerboseMessage, EventWithMessage, OmnisharpRequestMessage, OmnisharpServerEnqueueRequest, OmnisharpServerDequeueRequest, OmnisharpServerProcessRequestStart, OmnisharpEventPacketReceived } from '../../../src/omnisharp/loggingEvents';
import { OmnisharpServerVerboseMessage, EventWithMessage, OmnisharpRequestMessage, OmnisharpServerEnqueueRequest, OmnisharpServerDequeueRequest, OmnisharpServerProcessRequestStart, OmnisharpEventPacketReceived, OmnisharpServerProcessRequestComplete } from '../../../src/omnisharp/loggingEvents';
import { OmnisharpDebugModeLoggerObserver } from '../../../src/observers/OmnisharpDebugModeLoggerObserver';

use(require("chai-string"));

suite("OmnisharpLoggerObserver", () => {
suiteSetup(() => should());
let logOutput = "";
Expand Down Expand Up @@ -69,6 +71,18 @@ suite("OmnisharpLoggerObserver", () => {
expect(logOutput).to.contain(event.name);
});

test(`OmnisharpServer messages increase and decrease indent`, () => {
observer.post(new OmnisharpServerVerboseMessage("!indented_1"));
observer.post(new OmnisharpServerProcessRequestStart("name"));
observer.post(new OmnisharpServerVerboseMessage("indented"));
observer.post(new OmnisharpServerProcessRequestComplete());
observer.post(new OmnisharpServerVerboseMessage("!indented_2"));

expect(logOutput).to.startWith(" !indented_1");
expect(logOutput).to.contain("\n indented");
expect(logOutput).to.contain("\n !indented_2");
});

[
new OmnisharpEventPacketReceived("TRACE", "foo", "someMessage"),
new OmnisharpEventPacketReceived("DEBUG", "foo", "someMessage"),
Expand Down

0 comments on commit 341d646

Please sign in to comment.