Skip to content

Commit

Permalink
Expanding visibility of tslint and adding some additional fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Puszkiewicz committed Apr 7, 2018
1 parent 8803b80 commit 2341751
Show file tree
Hide file tree
Showing 19 changed files with 16 additions and 62 deletions.
9 changes: 4 additions & 5 deletions gulpfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
import * as gulp from 'gulp';
import * as optionsSchemaGenerator from './src/tools/GenerateOptionsSchema';
import * as packageDependencyUpdater from './src/tools/UpdatePackageDependencies';

import tslint from 'gulp-tslint';
import { PlatformInformation } from './src/platform';
import { PackageManager } from './src/packages';

require('./tasks/testTasks');
require('./tasks/onlinePackagingTasks');
Expand All @@ -29,9 +26,11 @@ gulp.task('updatePackageDependencies', () => {

gulp.task('tslint', () => {
gulp.src([
'src/**/*.ts',
'**/*.ts',
'!**/*.d.ts',
'!**/typings**'
'!**/typings**',
'!node_modules/**',
'!vsix/**'
])
.pipe(tslint({
program: require('tslint').Linter.createProgram("./tsconfig.json"),
Expand Down
11 changes: 1 addition & 10 deletions tasks/onlinePackagingTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,11 @@

'use strict';

import * as debugUtil from '../src/coreclr-debug/util';
import * as del from 'del';
import * as fs from 'fs';
import * as gulp from 'gulp';
import * as path from 'path';
import * as unzip from 'unzip2';
import * as util from '../src/common';
import { offlineVscodeignorePath, onlineVscodeignorePath, rootPath, unpackedVsixPath, vscePath, vscodeignorePath } from './projectPaths';
import { CsharpLoggerObserver } from '../src/observers/CsharpLoggerObserver';
import { EventStream } from '../src/EventStream';
import { Logger } from '../src/logger';
import { PackageManager } from '../src/packages';
import { PlatformInformation } from '../src/platform';
import { onlineVscodeignorePath, unpackedVsixPath, vscePath, vscodeignorePath } from './projectPaths';
import { getPackageJSON } from './packageJson';
import spawnNode from './spawnNode';

Expand All @@ -26,7 +18,6 @@ gulp.task('vsix:release:unpackage', () => {
const name = packageJSON.name;
const version = packageJSON.version;
const packageName = `${name}-${version}.vsix`;
const packagePath = path.join(rootPath, packageName);

del.sync(unpackedVsixPath);
fs.createReadStream(packageName).pipe(unzip.Extract({ path: unpackedVsixPath }));
Expand Down
1 change: 0 additions & 1 deletion tasks/projectPaths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

'use strict';

import * as gulp from 'gulp';
import * as path from 'path';
import { execFile, spawn } from 'child_process';
import { commandLineOptions } from './commandLineArguments';
Expand Down
2 changes: 1 addition & 1 deletion tasks/spawnNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

'use strict';

import { SpawnOptions, ChildProcess, spawn } from "child_process";
import { SpawnOptions, spawn } from "child_process";
import { join, Result } from "async-child-process";
import { nodePath, rootPath } from "./projectPaths";

Expand Down
2 changes: 1 addition & 1 deletion tasks/testTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import * as gulp from 'gulp';
import * as path from 'path';

import { codeExtensionPath, nodePath, nycPath, rootPath, testAssetsRootPath, testRootPath, unitTestCoverageRootPath, mochaPath, vscodeTestHostPath } from './projectPaths';
import { codeExtensionPath, nycPath, rootPath, testAssetsRootPath, testRootPath, unitTestCoverageRootPath, mochaPath, vscodeTestHostPath } from './projectPaths';
import { execFile, spawn } from 'child_process';

import spawnNode from './spawnNode';
Expand Down
14 changes: 0 additions & 14 deletions test/coverageWritingTestRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,10 @@
* Copyright (C) Microsoft Corporation. All rights reserved.
*--------------------------------------------------------*/

import shelljs = require("async-shelljs");
import path = require('path');
const fs = require('async-file');
import Mocha = require('mocha');
import istanbul = require('istanbul');
const loadCoverage = require('remap-istanbul/lib/loadCoverage');
const remap = require('remap-istanbul/lib/remap');
const writeReport = require('remap-istanbul/lib/writeReport');

declare var __coverage__: any;
let glob = require('glob');
let remapIstanbul = require('remap-istanbul');

export default class CoverageWritingTestRunner {
constructor(private baseRunner: any) {
Expand Down Expand Up @@ -65,12 +57,6 @@ export default class CoverageWritingTestRunner {

await fs.writeTextFile(rawCoverageJsonPath, JSON.stringify(__coverage__));

let result = await shelljs.asyncExec(`${nodePath}node ${remapIstanbulPath} -i ${rawCoverageJsonPath} -o ${remappedCoverageJsonPath}`, {
cwd: outFolderPath
});



let remappedResult = JSON.parse(await fs.readTextFile(remappedCoverageJsonPath));

let finalResult = <{[details: string] : { path: string }}>{};
Expand Down
2 changes: 0 additions & 2 deletions test/featureTests/OmnisharpDownloader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
import * as path from 'path';
import * as tmp from 'tmp';
import * as util from '../../src/common';
import { should } from 'chai';
import { Logger } from '../../src/logger';
import { OmnisharpDownloader } from '../../src/omnisharp/OmnisharpDownloader';
import { rimraf } from 'async-file';
import { PlatformInformation } from '../../src/platform';
Expand Down
2 changes: 0 additions & 2 deletions test/featureTests/OmnisharpManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { PlatformInformation } from "../../src/platform";
import { rimraf } from 'async-file';
import { GetTestOmnisharpDownloader } from './OmnisharpDownloader.test';
import { OmnisharpManager } from '../../src/omnisharp/OmnisharpManager';
import { OmnisharpDownloader } from '../../src/omnisharp/OmnisharpDownloader';
import { EventStream } from '../../src/EventStream';

const chai = require("chai");
Expand Down Expand Up @@ -72,7 +71,6 @@ suite('GetExperimentalOmnisharpPath : Returns Omnisharp experiment path dependin
});

test('Downloads package from given url and installs them at the specified path', async () => {
let launchPath = await manager.GetOmnisharpPath("1.2.3", useMono, serverUrl, versionFilepathInServer, installPath, extensionPath);
let exists = await util.fileExists(path.resolve(extensionPath, `.omnisharp/experimental/1.2.3/install_check_1.2.3.txt`));
exists.should.equal(true);
});
Expand Down
5 changes: 1 addition & 4 deletions test/integrationTests/codeActionRename.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as fs from 'async-file';
import * as vscode from 'vscode';

import poll from './poll';
import { should, expect } from 'chai';
import testAssetWorkspace from './testAssets/testAssetWorkspace';

Expand Down Expand Up @@ -35,7 +32,7 @@ suite(`Code Action Rename ${testAssetWorkspace.description}`, function() {
(s) => { return s.title == "Rename file to C.cs"; }
);
expect(command, "Didn't find rename class command");
await vscode.commands.executeCommand(command.command, ...command.arguments)
await vscode.commands.executeCommand(command.command, ...command.arguments);
expect(vscode.window.activeTextEditor.document.fileName).contains("C.cs");
});

Expand Down
4 changes: 0 additions & 4 deletions test/integrationTests/hoverProvider.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,11 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import * as fs from 'async-file';
import * as vscode from 'vscode';
import * as path from 'path';

import poll from './poll';
import { should, expect } from 'chai';
import testAssetWorkspace from './testAssets/testAssetWorkspace';
import { OmniSharpServer } from '../../src/omnisharp/server';
import { omnisharp } from '../../src/omnisharp/extension';

const chai = require('chai');
chai.use(require('chai-arrays'));
Expand Down
2 changes: 0 additions & 2 deletions test/integrationTests/signatureHelp.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
import * as vscode from 'vscode';
import * as path from 'path';

import poll from './poll';
import { should, expect } from 'chai';
import testAssetWorkspace from './testAssets/testAssetWorkspace';
import { omnisharp } from '../../src/omnisharp/extension';

const chai = require('chai');
chai.use(require('chai-arrays'));
Expand Down
2 changes: 1 addition & 1 deletion test/integrationTests/testAssets/testAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export class TestAssetWorkspace {

invokeGit(args: string, workingDirectory: string): Promise<{ stdout: string, stderr: string }> {
return new Promise((resolve, reject) => {
let child = cp.exec('git ' + args, { cwd: path.dirname(workingDirectory) },
cp.exec('git ' + args, { cwd: path.dirname(workingDirectory) },
(err, stdout, stderr) => {
return err ? reject(err) : resolve({
stdout: stdout,
Expand Down
1 change: 0 additions & 1 deletion test/releaseTests/testAssets/testAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/

import * as cp from 'child_process';
import * as path from 'path';

export function invokeNode(args: string[]){
let proc = cp.spawnSync('node', args);
Expand Down
2 changes: 1 addition & 1 deletion test/unitTests/logging/DotnetChannelObserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { should, expect } from 'chai';
import { DotNetChannelObserver } from "../../../src/observers/DotnetChannelObserver";
import { getNullChannel } from './Fakes';
import { CommandDotNetRestoreStart, BaseEvent } from '../../../src/omnisharp/loggingEvents';
import { CommandDotNetRestoreStart } from '../../../src/omnisharp/loggingEvents';

suite("DotnetChannelObserver", () => {
suiteSetup(() => should());
Expand Down
4 changes: 1 addition & 3 deletions test/unitTests/logging/OmnisharpChannelObserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
import { should, expect } from 'chai';
import { getNullChannel } from './Fakes';
import { OmnisharpChannelObserver } from '../../../src/observers/OmnisharpChannelObserver';
import { BaseEvent, OmnisharpFailure, CommandShowOutput } from '../../../src/omnisharp/loggingEvents';
import * as vscode from '../../../src/vscodeAdapter';
import { ViewColumn } from 'vscode';
import { OmnisharpFailure } from '../../../src/omnisharp/loggingEvents';

suite("OmnisharpChannelObserver", () => {
suiteSetup(() => should());
Expand Down
1 change: 0 additions & 1 deletion test/unitTests/logging/OmnisharpLoggerObserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { should, expect } from 'chai';
import { getNullChannel } from './Fakes';
import { OmnisharpLoggerObserver } from '../../../src/observers/OmnisharpLoggerObserver';
import { OmnisharpServerMsBuildProjectDiagnostics, EventWithMessage, OmnisharpServerOnStdErr, OmnisharpServerMessage, OmnisharpServerOnServerError, OmnisharpInitialisation, OmnisharpLaunch, OmnisharpServerOnError, OmnisharpFailure, OmnisharpEventPacketReceived } from '../../../src/omnisharp/loggingEvents';
import { MSBuildDiagnosticsMessage } from '../../../src/omnisharp/protocol';

suite("OmnisharpLoggerObserver", () => {
suiteSetup(() => should());
Expand Down
6 changes: 2 additions & 4 deletions test/unitTests/logging/OmnisharpStatusBarObserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,18 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { DocumentSelector, StatusBarItem } from '../../../src/vscodeAdapter';
import { OmnisharpOnBeforeServerInstall, OmnisharpOnBeforeServerStart, OmnisharpOnMultipleLaunchTargets, OmnisharpServerOnServerError, OmnisharpServerOnStart, OmnisharpServerOnStop } from '../../../src/omnisharp/loggingEvents';
import { StatusBarItem } from '../../../src/vscodeAdapter';
import { OmnisharpOnBeforeServerInstall, OmnisharpOnBeforeServerStart, OmnisharpServerOnServerError, OmnisharpServerOnStart, OmnisharpServerOnStop } from '../../../src/omnisharp/loggingEvents';
import { expect, should } from 'chai';
import { OmnisharpStatusBarObserver } from '../../../src/observers/OmnisharpStatusBarObserver';
import { getFakeVsCode, getWorkspaceInformationUpdated, getMSBuildWorkspaceInformation } from './Fakes';

suite('OmnisharpStatusBarObserver', () => {
suiteSetup(() => should());
let output = '';
let showCalled: boolean;
let hideCalled: boolean;

setup(() => {
output = '';
showCalled = false;
hideCalled = false;
});
Expand Down
6 changes: 2 additions & 4 deletions test/unitTests/logging/ProjectStatusBarObserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
*--------------------------------------------------------------------------------------------*/

import { expect, should } from 'chai';
import { getFakeVsCode, getWorkspaceInformationUpdated, getMSBuildWorkspaceInformation } from './Fakes';
import { vscode, StatusBarItem } from '../../../src/vscodeAdapter';
import { getWorkspaceInformationUpdated, getMSBuildWorkspaceInformation } from './Fakes';
import { StatusBarItem } from '../../../src/vscodeAdapter';
import { ProjectStatusBarObserver } from '../../../src/observers/ProjectStatusBarObserver';
import { OmnisharpOnMultipleLaunchTargets, OmnisharpServerOnStop } from '../../../src/omnisharp/loggingEvents';

suite('ProjectStatusBarObserver', () => {
suiteSetup(() => should());

let output = '';
let showCalled: boolean;
let hideCalled: boolean;
let statusBarItem = <StatusBarItem>{
Expand All @@ -22,7 +21,6 @@ suite('ProjectStatusBarObserver', () => {
let observer = new ProjectStatusBarObserver(statusBarItem);

setup(() => {
output = '';
showCalled = false;
hideCalled = false;
});
Expand Down
2 changes: 1 addition & 1 deletion test/unitTests/logging/WarningMessageObserver.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as rx from 'rx';
import { MessageItemWithCommand, WarningMessageObserver } from '../../../src/observers/WarningMessageObserver';
import { WarningMessageObserver } from '../../../src/observers/WarningMessageObserver';
import { use as chaiUse, expect, should } from 'chai';
import { getFakeVsCode, getMSBuildDiagnosticsMessage, getOmnisharpMSBuildProjectDiagnosticsEvent, getOmnisharpServerOnErrorEvent } from './Fakes';
import { BaseEvent } from '../../../src/omnisharp/loggingEvents';
Expand Down

0 comments on commit 2341751

Please sign in to comment.