From 23417513a3bdfdfa6c0720b5e65bce6de1062a8a Mon Sep 17 00:00:00 2001 From: Piotr Puszkiewicz Date: Fri, 6 Apr 2018 16:22:27 -0700 Subject: [PATCH] Expanding visibility of tslint and adding some additional fixes --- gulpfile.ts | 9 ++++----- tasks/onlinePackagingTasks.ts | 11 +---------- tasks/projectPaths.ts | 1 - tasks/spawnNode.ts | 2 +- tasks/testTasks.ts | 2 +- test/coverageWritingTestRunner.ts | 14 -------------- test/featureTests/OmnisharpDownloader.test.ts | 2 -- test/featureTests/OmnisharpManager.test.ts | 2 -- .../codeActionRename.integration.test.ts | 5 +---- .../hoverProvider.integration.test.ts | 4 ---- .../signatureHelp.integration.test.ts | 2 -- test/integrationTests/testAssets/testAssets.ts | 2 +- test/releaseTests/testAssets/testAssets.ts | 1 - .../logging/DotnetChannelObserver.test.ts | 2 +- .../logging/OmnisharpChannelObserver.test.ts | 4 +--- .../logging/OmnisharpLoggerObserver.test.ts | 1 - .../logging/OmnisharpStatusBarObserver.test.ts | 6 ++---- .../logging/ProjectStatusBarObserver.test.ts | 6 ++---- .../logging/WarningMessageObserver.test.ts | 2 +- 19 files changed, 16 insertions(+), 62 deletions(-) diff --git a/gulpfile.ts b/gulpfile.ts index aeb7424c3..7b29c4c97 100644 --- a/gulpfile.ts +++ b/gulpfile.ts @@ -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'); @@ -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"), diff --git a/tasks/onlinePackagingTasks.ts b/tasks/onlinePackagingTasks.ts index 1e2bbafbf..e56685ae1 100644 --- a/tasks/onlinePackagingTasks.ts +++ b/tasks/onlinePackagingTasks.ts @@ -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'; @@ -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 })); diff --git a/tasks/projectPaths.ts b/tasks/projectPaths.ts index d6ef61bae..d12f21306 100644 --- a/tasks/projectPaths.ts +++ b/tasks/projectPaths.ts @@ -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'; diff --git a/tasks/spawnNode.ts b/tasks/spawnNode.ts index 52e655514..5fb0168e9 100644 --- a/tasks/spawnNode.ts +++ b/tasks/spawnNode.ts @@ -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"; diff --git a/tasks/testTasks.ts b/tasks/testTasks.ts index c54d178d1..070cf8319 100644 --- a/tasks/testTasks.ts +++ b/tasks/testTasks.ts @@ -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'; diff --git a/test/coverageWritingTestRunner.ts b/test/coverageWritingTestRunner.ts index e82254cf2..81f14fade 100644 --- a/test/coverageWritingTestRunner.ts +++ b/test/coverageWritingTestRunner.ts @@ -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) { @@ -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 }}>{}; diff --git a/test/featureTests/OmnisharpDownloader.test.ts b/test/featureTests/OmnisharpDownloader.test.ts index 069728cf2..f57e626fc 100644 --- a/test/featureTests/OmnisharpDownloader.test.ts +++ b/test/featureTests/OmnisharpDownloader.test.ts @@ -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'; diff --git a/test/featureTests/OmnisharpManager.test.ts b/test/featureTests/OmnisharpManager.test.ts index 4e87d8be6..cb9d767e3 100644 --- a/test/featureTests/OmnisharpManager.test.ts +++ b/test/featureTests/OmnisharpManager.test.ts @@ -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"); @@ -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); }); diff --git a/test/integrationTests/codeActionRename.integration.test.ts b/test/integrationTests/codeActionRename.integration.test.ts index efdd84a03..f7b404364 100644 --- a/test/integrationTests/codeActionRename.integration.test.ts +++ b/test/integrationTests/codeActionRename.integration.test.ts @@ -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'; @@ -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"); }); diff --git a/test/integrationTests/hoverProvider.integration.test.ts b/test/integrationTests/hoverProvider.integration.test.ts index df39c28a7..cbfb3ebd7 100644 --- a/test/integrationTests/hoverProvider.integration.test.ts +++ b/test/integrationTests/hoverProvider.integration.test.ts @@ -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')); diff --git a/test/integrationTests/signatureHelp.integration.test.ts b/test/integrationTests/signatureHelp.integration.test.ts index f9ba5697e..62ceabf05 100644 --- a/test/integrationTests/signatureHelp.integration.test.ts +++ b/test/integrationTests/signatureHelp.integration.test.ts @@ -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')); diff --git a/test/integrationTests/testAssets/testAssets.ts b/test/integrationTests/testAssets/testAssets.ts index 6e690edb1..379c2d481 100644 --- a/test/integrationTests/testAssets/testAssets.ts +++ b/test/integrationTests/testAssets/testAssets.ts @@ -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, diff --git a/test/releaseTests/testAssets/testAssets.ts b/test/releaseTests/testAssets/testAssets.ts index 26616481d..1906b6b10 100644 --- a/test/releaseTests/testAssets/testAssets.ts +++ b/test/releaseTests/testAssets/testAssets.ts @@ -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); diff --git a/test/unitTests/logging/DotnetChannelObserver.test.ts b/test/unitTests/logging/DotnetChannelObserver.test.ts index d1c437bd9..c8bd8c54f 100644 --- a/test/unitTests/logging/DotnetChannelObserver.test.ts +++ b/test/unitTests/logging/DotnetChannelObserver.test.ts @@ -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()); diff --git a/test/unitTests/logging/OmnisharpChannelObserver.test.ts b/test/unitTests/logging/OmnisharpChannelObserver.test.ts index 8f38284d8..cd0e1a161 100644 --- a/test/unitTests/logging/OmnisharpChannelObserver.test.ts +++ b/test/unitTests/logging/OmnisharpChannelObserver.test.ts @@ -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()); diff --git a/test/unitTests/logging/OmnisharpLoggerObserver.test.ts b/test/unitTests/logging/OmnisharpLoggerObserver.test.ts index d906ed21f..d092ba970 100644 --- a/test/unitTests/logging/OmnisharpLoggerObserver.test.ts +++ b/test/unitTests/logging/OmnisharpLoggerObserver.test.ts @@ -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()); diff --git a/test/unitTests/logging/OmnisharpStatusBarObserver.test.ts b/test/unitTests/logging/OmnisharpStatusBarObserver.test.ts index 35b56199a..7b05cbf95 100644 --- a/test/unitTests/logging/OmnisharpStatusBarObserver.test.ts +++ b/test/unitTests/logging/OmnisharpStatusBarObserver.test.ts @@ -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; }); diff --git a/test/unitTests/logging/ProjectStatusBarObserver.test.ts b/test/unitTests/logging/ProjectStatusBarObserver.test.ts index 7b9ba5147..b78e01cd8 100644 --- a/test/unitTests/logging/ProjectStatusBarObserver.test.ts +++ b/test/unitTests/logging/ProjectStatusBarObserver.test.ts @@ -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 = { @@ -22,7 +21,6 @@ suite('ProjectStatusBarObserver', () => { let observer = new ProjectStatusBarObserver(statusBarItem); setup(() => { - output = ''; showCalled = false; hideCalled = false; }); diff --git a/test/unitTests/logging/WarningMessageObserver.test.ts b/test/unitTests/logging/WarningMessageObserver.test.ts index e29e332a5..72e52305f 100644 --- a/test/unitTests/logging/WarningMessageObserver.test.ts +++ b/test/unitTests/logging/WarningMessageObserver.test.ts @@ -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';