diff --git a/package-lock.json b/package-lock.json index b3cbf6b78..9f4be7dc6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -454,9 +454,9 @@ "dev": true }, "@types/mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-YeDiSEzznwZwwp766SJ6QlrTyBYUGPSIwmREHVTmktUYiT/WADdWtpt9iH0KuUSf8lZLdI4lP0X6PBzPo5//JQ==", + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-5.2.5.tgz", + "integrity": "sha512-lAVp+Kj54ui/vLUFxsJTMtWvZraZxum3w3Nwkble2dNuV5VnPA+Mi2oGX9XYJAaIvZi3tn3cbjS/qcJXRb6Bww==", "dev": true }, "@types/mz": { @@ -538,7 +538,6 @@ "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, - "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -3635,7 +3634,6 @@ "version": "0.1.4", "bundled": true, "dev": true, - "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -4792,8 +4790,7 @@ "longest": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "loose-envify": { "version": "1.3.1", diff --git a/package.json b/package.json index 6dfa9059a..c14807f53 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,7 @@ "@types/chai-as-promised": "7.1.0", "@types/glob": "5.0.35", "@types/lodash": "4.14.116", - "@types/mocha": "5.2.0", + "@types/mocha": "5.2.5", "@types/mz": "0.0.31", "@types/node": "7.0.63", "@types/object-hash": "1.2.0", diff --git a/src/test/typescript-service-helpers.ts b/src/test/typescript-service-helpers.ts index 097e0c834..4f553c4ad 100644 --- a/src/test/typescript-service-helpers.ts +++ b/src/test/typescript-service-helpers.ts @@ -1,7 +1,7 @@ import * as chai from 'chai' import chaiAsPromised = require('chai-as-promised') import { applyReducer, Operation } from 'fast-json-patch' -import { IBeforeAndAfterContext, ISuiteCallbackContext, ITestCallbackContext } from 'mocha' +import { Context } from 'mocha' import { Observable } from 'rxjs' import * as sinon from 'sinon' import * as ts from 'typescript' @@ -63,7 +63,7 @@ export const initializeTypeScriptService = ( files: Map, clientCapabilities: ClientCapabilities = DEFAULT_CAPABILITIES ) => - async function(this: TestContext & IBeforeAndAfterContext): Promise { + async function(this: TestContext & Context): Promise { // Stub client this.client = sinon.createStubInstance(RemoteLanguageClient) this.client.textDocumentXcontent.callsFake( @@ -107,7 +107,7 @@ export const initializeTypeScriptService = ( /** * Shuts the TypeScriptService down (to be used in `afterEach()`) */ -export async function shutdownTypeScriptService(this: TestContext & IBeforeAndAfterContext): Promise { +export async function shutdownTypeScriptService(this: Context): Promise { await this.service.shutdown().toPromise() } @@ -121,7 +121,7 @@ export function describeTypeScriptService( shutdownService = shutdownTypeScriptService, rootUri: string ): void { - describe('Workspace without project files', function(this: TestContext & ISuiteCallbackContext): void { + describe('Workspace without project files', () => { beforeEach( initializeTypeScriptService( createService, @@ -152,8 +152,8 @@ export function describeTypeScriptService( afterEach(shutdownService) - describe('textDocumentDefinition()', function(this: TestContext & ISuiteCallbackContext): void { - specify('in same file', async function(this: TestContext & ITestCallbackContext): Promise { + describe('textDocumentDefinition()', () => { + specify('in same file', async function(this: TestContext & Context): Promise { const result: Location[] = await this.service .textDocumentDefinition({ textDocument: { @@ -182,7 +182,7 @@ export function describeTypeScriptService( }, ]) }) - specify('on keyword (non-null)', async function(this: TestContext & ITestCallbackContext): Promise { + specify('on keyword (non-null)', async function(this: TestContext & Context): Promise { const result: Location[] = await this.service .textDocumentDefinition({ textDocument: { @@ -197,7 +197,7 @@ export function describeTypeScriptService( .toPromise() assert.deepEqual(result, []) }) - specify('in other file', async function(this: TestContext & ITestCallbackContext): Promise { + specify('in other file', async function(this: TestContext & Context): Promise { const result: Location[] = await this.service .textDocumentDefinition({ textDocument: { @@ -228,8 +228,8 @@ export function describeTypeScriptService( }) }) - describe('textDocumentTypeDefinition()', function(this: TestContext & ISuiteCallbackContext): void { - specify('in other file', async function(this: TestContext & ITestCallbackContext): Promise { + describe('textDocumentTypeDefinition()', () => { + specify('in other file', async function(this: TestContext & Context): Promise { const result: Location[] = await this.service .textDocumentTypeDefinition({ textDocument: { @@ -258,7 +258,7 @@ export function describeTypeScriptService( }, ]) }) - specify('in same file', async function(this: TestContext & ITestCallbackContext): Promise { + specify('in same file', async function(this: TestContext & Context): Promise { const result: Location[] = await this.service .textDocumentTypeDefinition({ textDocument: { @@ -289,10 +289,8 @@ export function describeTypeScriptService( }) }) - describe('textDocumentXdefinition()', function(this: TestContext & ISuiteCallbackContext): void { - specify('on interface field reference', async function( - this: TestContext & ITestCallbackContext - ): Promise { + describe('textDocumentXdefinition()', () => { + specify('on interface field reference', async function(this: TestContext & Context): Promise { const result: SymbolLocationInformation[] = await this.service .textDocumentXdefinition({ textDocument: { @@ -330,7 +328,7 @@ export function describeTypeScriptService( }, ]) }) - specify('in same file', async function(this: TestContext & ITestCallbackContext): Promise { + specify('in same file', async function(this: TestContext & Context): Promise { const result: SymbolLocationInformation[] = await this.service .textDocumentXdefinition({ textDocument: { @@ -369,8 +367,8 @@ export function describeTypeScriptService( ]) }) }) - describe('textDocumentHover()', function(this: TestContext & ISuiteCallbackContext): void { - specify('in same file', async function(this: TestContext & ITestCallbackContext): Promise { + describe('textDocumentHover()', () => { + specify('in same file', async function(this: TestContext & Context): Promise { const result: Hover = await this.service .textDocumentHover({ textDocument: { @@ -398,7 +396,7 @@ export function describeTypeScriptService( }) }) specify('local function with callback argument', async function( - this: TestContext & ITestCallbackContext + this: TestContext & Context ): Promise { const result: Hover = await this.service .textDocumentHover({ @@ -429,7 +427,7 @@ export function describeTypeScriptService( ], }) }) - specify('in other file', async function(this: TestContext & ITestCallbackContext): Promise { + specify('in other file', async function(this: TestContext & Context): Promise { const result: Hover = await this.service .textDocumentHover({ textDocument: { @@ -456,7 +454,7 @@ export function describeTypeScriptService( contents: [{ language: 'typescript', value: 'class Foo\nimport Foo' }, '**alias**'], }) }) - specify('over keyword (non-null)', async function(this: TestContext & ITestCallbackContext): Promise { + specify('over keyword (non-null)', async function(this: TestContext & Context): Promise { const result: Hover = await this.service .textDocumentHover({ textDocument: { @@ -471,7 +469,7 @@ export function describeTypeScriptService( .toPromise() assert.deepEqual(result, { contents: [] }) }) - specify('over non-existent file', async function(this: TestContext & ITestCallbackContext): Promise { + specify('over non-existent file', async function(this: TestContext & Context): Promise { await Promise.resolve( assert.isRejected( this.service @@ -491,7 +489,7 @@ export function describeTypeScriptService( }) }) - describe('Workspace with typings directory', function(this: TestContext & ISuiteCallbackContext): void { + describe('Workspace with typings directory', () => { beforeEach( initializeTypeScriptService( createService, @@ -522,8 +520,8 @@ export function describeTypeScriptService( afterEach(shutdownService) - describe('textDocumentDefinition()', function(this: TestContext & ISuiteCallbackContext): void { - specify('with tsd.d.ts', async function(this: TestContext & ITestCallbackContext): Promise { + describe('textDocumentDefinition()', () => { + specify('with tsd.d.ts', async function(this: TestContext & Context): Promise { const result: Location[] = await this.service .textDocumentDefinition({ textDocument: { @@ -552,8 +550,8 @@ export function describeTypeScriptService( }, ]) }) - describe('on file in project root', function(this: TestContext & ISuiteCallbackContext): void { - specify('on import alias', async function(this: TestContext & ITestCallbackContext): Promise { + describe('on file in project root', () => { + specify('on import alias', async function(this: TestContext & Context): Promise { const result: Location[] = await this.service .textDocumentDefinition({ textDocument: { @@ -582,7 +580,7 @@ export function describeTypeScriptService( }, ]) }) - specify('on module name', async function(this: TestContext & ITestCallbackContext): Promise { + specify('on module name', async function(this: TestContext & Context): Promise { const result: Location[] = await this.service .textDocumentDefinition({ textDocument: { @@ -615,7 +613,7 @@ export function describeTypeScriptService( }) }) - describe('DefinitelyTyped', function(this: TestContext & ISuiteCallbackContext): void { + describe('DefinitelyTyped', () => { beforeEach( initializeTypeScriptService( createService, @@ -718,9 +716,9 @@ export function describeTypeScriptService( afterEach(shutdownService) - describe('workspaceSymbol()', function(this: TestContext & ISuiteCallbackContext): void { + describe('workspaceSymbol()', () => { it('should find a symbol by SymbolDescriptor query with name and package name', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: SymbolInformation[] = await this.service .workspaceSymbol({ symbol: { name: 'resolveCallback', package: { name: '@types/resolve' } }, @@ -748,7 +746,7 @@ export function describeTypeScriptService( ]) }) it('should find a symbol by SymbolDescriptor query with name, containerKind and package name', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: SymbolInformation[] = await this.service .workspaceSymbol({ symbol: { @@ -782,7 +780,7 @@ export function describeTypeScriptService( }) }) - describe('Workspace with root package.json', function(this: TestContext & ISuiteCallbackContext): void { + describe('Workspace with root package.json', () => { beforeEach( initializeTypeScriptService( createService, @@ -803,10 +801,10 @@ export function describeTypeScriptService( afterEach(shutdownService) - describe('workspaceSymbol()', function(this: TestContext & ISuiteCallbackContext): void { - describe('with SymbolDescriptor query', function(this: TestContext & ISuiteCallbackContext): void { + describe('workspaceSymbol()', () => { + describe('with SymbolDescriptor query', () => { it('should find a symbol by name, kind and package name', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: SymbolInformation[] = await this.service .workspaceSymbol({ symbol: { @@ -838,7 +836,7 @@ export function describeTypeScriptService( }) }) it('should find a symbol by name, kind, package name and ignore package version', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: SymbolInformation[] = await this.service .workspaceSymbol({ symbol: { name: 'a', kind: 'class', package: { name: 'mypkg', version: '203940234' } }, @@ -863,9 +861,7 @@ export function describeTypeScriptService( name: 'a', }) }) - it('should find a symbol by name', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + it('should find a symbol by name', async function(this: TestContext & Context): Promise { const result: SymbolInformation[] = await this.service .workspaceSymbol({ symbol: { @@ -895,7 +891,7 @@ export function describeTypeScriptService( ]) }) it('should return no result if the PackageDescriptor does not match', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: SymbolInformation[] = await this.service .workspaceSymbol({ symbol: { @@ -911,8 +907,8 @@ export function describeTypeScriptService( assert.deepEqual(result, []) }) }) - describe('with text query', function(this: TestContext & ISuiteCallbackContext): void { - it('should find a symbol', async function(this: TestContext & ITestCallbackContext): Promise { + describe('with text query', () => { + it('should find a symbol', async function(this: TestContext & Context): Promise { const result: SymbolInformation[] = await this.service .workspaceSymbol({ query: 'a' }) .reduce(applyReducer, null as any) @@ -938,7 +934,7 @@ export function describeTypeScriptService( ]) }) it('should return all symbols for an empty query excluding dependencies', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: SymbolInformation[] = await this.service .workspaceSymbol({ query: '' }) .reduce(applyReducer, null as any) @@ -1107,9 +1103,8 @@ export function describeTypeScriptService( }) }) - describe('workspaceXreferences()', function(this: TestContext & ISuiteCallbackContext): void { - it('should return all references to a method', async function(this: TestContext & - ITestCallbackContext): Promise { + describe('workspaceXreferences()', () => { + it('should return all references to a method', async function(this: TestContext & Context): Promise { const result: ReferenceInformation[] = await this.service .workspaceXreferences({ query: { name: 'foo', kind: 'method', containerName: 'a' } }) .reduce(applyReducer, null as any) @@ -1140,7 +1135,7 @@ export function describeTypeScriptService( ]) }) it('should return all references to a method with hinted dependee package name', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: ReferenceInformation[] = await this.service .workspaceXreferences({ query: { @@ -1180,7 +1175,7 @@ export function describeTypeScriptService( ]) }) it('should return no references to a method if hinted dependee package name was not found', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result = await this.service .workspaceXreferences({ query: { @@ -1197,7 +1192,7 @@ export function describeTypeScriptService( assert.deepEqual(result, []) }) it('should return all references to a symbol from a dependency', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: ReferenceInformation[] = await this.service .workspaceXreferences({ query: { name: 'x' } }) .reduce(applyReducer, null as any) @@ -1228,7 +1223,7 @@ export function describeTypeScriptService( ]) }) it('should return all references to a symbol from a dependency with PackageDescriptor query', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: ReferenceInformation[] = await this.service .workspaceXreferences({ query: { name: 'x', package: { name: 'dep' } } }) .reduce(applyReducer, null as any) @@ -1264,7 +1259,7 @@ export function describeTypeScriptService( ]) }) it('should return all references to all symbols if empty SymbolDescriptor query is passed', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: ReferenceInformation[] = await this.service .workspaceXreferences({ query: {} }) .reduce(applyReducer, null as any) @@ -1473,7 +1468,7 @@ export function describeTypeScriptService( }) }) - describe('Dependency detection', function(this: TestContext & ISuiteCallbackContext): void { + describe('Dependency detection', () => { beforeEach( initializeTypeScriptService( createService, @@ -1528,10 +1523,8 @@ export function describeTypeScriptService( afterEach(shutdownService) - describe('workspaceXdependencies()', function(this: TestContext & ISuiteCallbackContext): void { - it('should account for all dependencies', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + describe('workspaceXdependencies()', () => { + it('should account for all dependencies', async function(this: TestContext & Context): Promise { const result: DependencyReference[] = await this.service .workspaceXdependencies() .reduce(applyReducer, null as any) @@ -1630,10 +1623,8 @@ export function describeTypeScriptService( ]) }) }) - describe('workspaceXpackages()', function(this: TestContext & ISuiteCallbackContext): void { - it('should accournt for all packages', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + describe('workspaceXpackages()', () => { + it('should accournt for all packages', async function(this: TestContext & Context): Promise { const result: PackageInformation[] = await this.service .workspaceXpackages() .reduce(applyReducer, null as any) @@ -1747,16 +1738,14 @@ export function describeTypeScriptService( }) }) - describe('TypeScript library', function(this: TestContext & ISuiteCallbackContext): void { + describe('TypeScript library', () => { beforeEach( initializeTypeScriptService(createService, rootUri, new Map([[rootUri + 'a.ts', 'let parameters = [];']])) ) afterEach(shutdownService) - specify('type of parameters should be any[]', async function( - this: TestContext & ITestCallbackContext - ): Promise { + specify('type of parameters should be any[]', async function(this: TestContext & Context): Promise { const result: Hover = await this.service .textDocumentHover({ textDocument: { @@ -1785,7 +1774,7 @@ export function describeTypeScriptService( }) }) - describe('Live updates', function(this: TestContext & ISuiteCallbackContext): void { + describe('Live updates', () => { beforeEach( initializeTypeScriptService(createService, rootUri, new Map([[rootUri + 'a.ts', 'let parameters = [];']])) ) @@ -1793,7 +1782,7 @@ export function describeTypeScriptService( afterEach(shutdownService) it('should handle didChange when configuration is not yet initialized', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const hoverParams = { textDocument: { uri: rootUri + 'a.ts', @@ -1838,7 +1827,7 @@ export function describeTypeScriptService( }) it('should handle didClose when configuration is not yet initialized', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const hoverParams = { textDocument: { uri: rootUri + 'a.ts', @@ -1876,7 +1865,7 @@ export function describeTypeScriptService( }) }) - it('should reflect updated content', async function(this: TestContext & ITestCallbackContext): Promise { + it('should reflect updated content', async function(this: TestContext & Context): Promise { const hoverParams = { textDocument: { uri: rootUri + 'a.ts', @@ -1971,7 +1960,7 @@ export function describeTypeScriptService( }) }) - describe('Diagnostics', function(this: TestContext & ISuiteCallbackContext): void { + describe('Diagnostics', () => { beforeEach( initializeTypeScriptService( createService, @@ -1982,9 +1971,7 @@ export function describeTypeScriptService( afterEach(shutdownService) - it('should publish diagnostics on didOpen', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + it('should publish diagnostics on didOpen', async function(this: TestContext & Context): Promise { await this.service.textDocumentDidOpen({ textDocument: { uri: rootUri + 'src/errors.ts', @@ -2009,9 +1996,7 @@ export function describeTypeScriptService( }) }) - it('should publish diagnostics on didChange', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + it('should publish diagnostics on didChange', async function(this: TestContext & Context): Promise { await this.service.textDocumentDidOpen({ textDocument: { uri: rootUri + 'src/errors.ts', @@ -2047,7 +2032,7 @@ export function describeTypeScriptService( }) it('should publish empty diagnostics on didChange if error was fixed', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { await this.service.textDocumentDidOpen({ textDocument: { uri: rootUri + 'src/errors.ts', @@ -2074,9 +2059,7 @@ export function describeTypeScriptService( }) }) - it('should clear diagnostics on didClose', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + it('should clear diagnostics on didClose', async function(this: TestContext & Context): Promise { await this.service.textDocumentDidClose({ textDocument: { uri: rootUri + 'src/errors.ts', @@ -2091,7 +2074,7 @@ export function describeTypeScriptService( }) }) - describe('References and imports', function(this: TestContext & ISuiteCallbackContext): void { + describe('References and imports', () => { beforeEach( initializeTypeScriptService( createService, @@ -2129,9 +2112,9 @@ export function describeTypeScriptService( afterEach(shutdownService) - describe('textDocumentDefinition()', function(this: TestContext & ISuiteCallbackContext): void { + describe('textDocumentDefinition()', () => { it('should resolve symbol imported with tripe-slash reference', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: Location[] = await this.service .textDocumentDefinition({ textDocument: { @@ -2169,7 +2152,7 @@ export function describeTypeScriptService( ]) }) it('should resolve symbol imported with import statement', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: Location[] = await this.service .textDocumentDefinition({ textDocument: { @@ -2198,8 +2181,9 @@ export function describeTypeScriptService( }, ]) }) - it('should resolve definition with missing reference', async function(this: TestContext & - ITestCallbackContext): Promise { + it('should resolve definition with missing reference', async function(this: TestContext & Context): Promise< + void + > { const result: Location[] = await this.service .textDocumentDefinition({ textDocument: { @@ -2228,9 +2212,7 @@ export function describeTypeScriptService( }, ]) }) - it('should resolve deep definitions', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + it('should resolve deep definitions', async function(this: TestContext & Context): Promise { // This test passes only because we expect no response from LSP server // for definition located in file references with depth 3 or more (a -> b -> c -> d (...)) // This test will fail once we'll increase (or remove) depth limit @@ -2265,7 +2247,7 @@ export function describeTypeScriptService( }) }) - describe('TypeScript libraries', function(this: TestContext & ISuiteCallbackContext): void { + describe('TypeScript libraries', () => { beforeEach( initializeTypeScriptService( createService, @@ -2286,10 +2268,8 @@ export function describeTypeScriptService( afterEach(shutdownService) - describe('textDocumentHover()', function(this: TestContext & ISuiteCallbackContext): void { - it('should load local library file', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + describe('textDocumentHover()', () => { + it('should load local library file', async function(this: TestContext & Context): Promise { const result: Hover = await this.service .textDocumentHover({ textDocument: { @@ -2336,9 +2316,8 @@ export function describeTypeScriptService( }) }) }) - describe('textDocumentDefinition()', function(this: TestContext & ISuiteCallbackContext): void { - it('should resolve TS libraries to github URL', async function(this: TestContext & - ITestCallbackContext): Promise { + describe('textDocumentDefinition()', () => { + it('should resolve TS libraries to github URL', async function(this: TestContext & Context): Promise { assert.deepEqual( await this.service .textDocumentDefinition({ @@ -2415,7 +2394,7 @@ export function describeTypeScriptService( }) }) - describe('textDocumentReferences()', function(this: TestContext & ISuiteCallbackContext): void { + describe('textDocumentReferences()', () => { beforeEach( initializeTypeScriptService( createService, @@ -2452,7 +2431,7 @@ export function describeTypeScriptService( afterEach(shutdownService) it('should provide an empty response when no reference is found', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result = await this.service .textDocumentReferences({ textDocument: { @@ -2469,8 +2448,7 @@ export function describeTypeScriptService( assert.deepEqual(result, []) }) - it('should include the declaration if requested', async function(this: TestContext & - ITestCallbackContext): Promise { + it('should include the declaration if requested', async function(this: TestContext & Context): Promise { const result = await this.service .textDocumentReferences({ textDocument: { @@ -2501,8 +2479,9 @@ export function describeTypeScriptService( ]) }) - it('should provide a reference within the same file', async function(this: TestContext & - ITestCallbackContext): Promise { + it('should provide a reference within the same file', async function(this: TestContext & Context): Promise< + void + > { const result = await this.service .textDocumentReferences({ textDocument: { @@ -2532,8 +2511,7 @@ export function describeTypeScriptService( }, ]) }) - it('should provide two references from imports', async function(this: TestContext & - ITestCallbackContext): Promise { + it('should provide two references from imports', async function(this: TestContext & Context): Promise { const result = await this.service .textDocumentReferences({ textDocument: { @@ -2578,7 +2556,7 @@ export function describeTypeScriptService( }) }) - describe('textDocumentSignatureHelp()', function(this: TestContext & ISuiteCallbackContext): void { + describe('textDocumentSignatureHelp()', () => { beforeEach( initializeTypeScriptService( createService, @@ -2623,7 +2601,7 @@ export function describeTypeScriptService( afterEach(shutdownService) it('should provide a valid empty response when no signature is found', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: SignatureHelp = await this.service .textDocumentSignatureHelp({ textDocument: { @@ -2644,7 +2622,7 @@ export function describeTypeScriptService( }) it('should provide signature help with parameters in the same file', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: SignatureHelp = await this.service .textDocumentSignatureHelp({ textDocument: { @@ -2679,8 +2657,9 @@ export function describeTypeScriptService( }) }) - it('should provide signature help from imported symbols', async function(this: TestContext & - ITestCallbackContext): Promise { + it('should provide signature help from imported symbols', async function(this: TestContext & Context): Promise< + void + > { const result: SignatureHelp = await this.service .textDocumentSignatureHelp({ textDocument: { @@ -2707,7 +2686,7 @@ export function describeTypeScriptService( }) }) - describe('textDocumentCompletion() with snippets', function(this: TestContext & ISuiteCallbackContext): void { + describe('textDocumentCompletion() with snippets', () => { beforeEach( initializeTypeScriptService( createService, @@ -2746,7 +2725,7 @@ export function describeTypeScriptService( afterEach(shutdownService) - it('should produce completions', async function(this: TestContext & ITestCallbackContext): Promise { + it('should produce completions', async function(this: TestContext & Context): Promise { const result: CompletionList = await this.service .textDocumentCompletion({ textDocument: { @@ -2804,8 +2783,7 @@ export function describeTypeScriptService( ]) }) - it('should resolve completions with snippets', async function(this: TestContext & - ITestCallbackContext): Promise { + it('should resolve completions with snippets', async function(this: TestContext & Context): Promise { const result: CompletionList = await this.service .textDocumentCompletion({ textDocument: { @@ -2880,7 +2858,7 @@ export function describeTypeScriptService( }) }) - describe('textDocumentCompletion()', function(this: TestContext & ISuiteCallbackContext): void { + describe('textDocumentCompletion()', () => { beforeEach( initializeTypeScriptService( createService, @@ -2920,9 +2898,7 @@ export function describeTypeScriptService( afterEach(shutdownService) - it('produces completions in the same file', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + it('produces completions in the same file', async function(this: TestContext & Context): Promise { const result: CompletionList = await this.service .textDocumentCompletion({ textDocument: { @@ -2980,9 +2956,7 @@ export function describeTypeScriptService( ]) }) - it('resolves completions in the same file', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + it('resolves completions in the same file', async function(this: TestContext & Context): Promise { const result: CompletionList = await this.service .textDocumentCompletion({ textDocument: { @@ -3049,8 +3023,7 @@ export function describeTypeScriptService( ]) }) - it('produces completions for imported symbols', async function(this: TestContext & - ITestCallbackContext): Promise { + it('produces completions for imported symbols', async function(this: TestContext & Context): Promise { const result: CompletionList = await this.service .textDocumentCompletion({ textDocument: { @@ -3079,8 +3052,7 @@ export function describeTypeScriptService( ], }) }) - it('produces completions for referenced symbols', async function(this: TestContext & - ITestCallbackContext): Promise { + it('produces completions for referenced symbols', async function(this: TestContext & Context): Promise { const result: CompletionList = await this.service .textDocumentCompletion({ textDocument: { @@ -3109,9 +3081,7 @@ export function describeTypeScriptService( ], }) }) - it('produces completions for empty files', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + it('produces completions for empty files', async function(this: TestContext & Context): Promise { this.timeout(10000) const result: CompletionList = await this.service .textDocumentCompletion({ @@ -3129,7 +3099,7 @@ export function describeTypeScriptService( }) }) - describe('textDocumentRename()', function(this: TestContext & ISuiteCallbackContext): void { + describe('textDocumentRename()', () => { beforeEach( initializeTypeScriptService( createService, @@ -3161,9 +3131,7 @@ export function describeTypeScriptService( afterEach(shutdownService) - it('should error on an invalid symbol', async function(this: TestContext & ITestCallbackContext): Promise< - void - > { + it('should error on an invalid symbol', async function(this: TestContext & Context): Promise { await Promise.resolve( assert.isRejected( this.service @@ -3184,7 +3152,7 @@ export function describeTypeScriptService( ) }) it('should return a correct WorkspaceEdit to rename a class', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: WorkspaceEdit = await this.service .textDocumentRename({ textDocument: { @@ -3232,7 +3200,7 @@ export function describeTypeScriptService( }) }) it('should return a correct WorkspaceEdit to rename an imported function', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result: WorkspaceEdit = await this.service .textDocumentRename({ textDocument: { @@ -3296,7 +3264,7 @@ export function describeTypeScriptService( }) }) - describe('textDocumentCodeAction()', function(this: TestContext & ISuiteCallbackContext): void { + describe('textDocumentCodeAction()', () => { beforeEach( initializeTypeScriptService( createService, @@ -3320,7 +3288,7 @@ export function describeTypeScriptService( afterEach(shutdownService) - it('suggests a missing this', async function(this: TestContext & ITestCallbackContext): Promise { + it('suggests a missing this', async function(this: TestContext & Context): Promise { await this.service.textDocumentDidOpen({ textDocument: { uri: rootUri + 'a.ts', @@ -3380,7 +3348,7 @@ export function describeTypeScriptService( }) }) - describe('workspaceExecuteCommand()', function(this: TestContext & ISuiteCallbackContext): void { + describe('workspaceExecuteCommand()', () => { beforeEach( initializeTypeScriptService( createService, @@ -3406,7 +3374,7 @@ export function describeTypeScriptService( describe('codeFix', () => { it('should apply a WorkspaceEdit for the passed FileTextChanges', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { await this.service .workspaceExecuteCommand({ command: 'codeFix', @@ -3452,7 +3420,7 @@ export function describeTypeScriptService( }) }) - describe('Special file names', function(this: TestContext & ISuiteCallbackContext): void { + describe('Special file names', () => { beforeEach( initializeTypeScriptService( createService, @@ -3469,8 +3437,9 @@ export function describeTypeScriptService( afterEach(shutdownService) - it('should accept files with TypeScript keywords in path', async function(this: TestContext & - ITestCallbackContext): Promise { + it('should accept files with TypeScript keywords in path', async function(this: TestContext & Context): Promise< + void + > { const result: Hover = await this.service .textDocumentHover({ textDocument: { @@ -3497,8 +3466,9 @@ export function describeTypeScriptService( contents: [{ language: 'typescript', value: 'function a(): void' }, '**function** _(exported)_'], }) }) - it('should accept files with special characters in path', async function(this: TestContext & - ITestCallbackContext): Promise { + it('should accept files with special characters in path', async function(this: TestContext & Context): Promise< + void + > { const result: Hover = await this.service .textDocumentHover({ textDocument: { @@ -3526,7 +3496,7 @@ export function describeTypeScriptService( }) }) it('should handle Windows-style paths in triple slash references', async function(this: TestContext & - ITestCallbackContext): Promise { + Context): Promise { const result = await this.service .textDocumentDefinition({ textDocument: {