Fixing no implicit any in some tests

This commit is contained in:
Matt Bierner
2019-03-21 09:06:12 -07:00
parent b4528f0a82
commit 53704af475
18 changed files with 33 additions and 32 deletions
@@ -7,7 +7,7 @@ import * as assert from 'assert';
import { ArrayIterator } from 'vs/base/common/iterator';
import { HeightMap, IViewItem } from 'vs/base/parts/tree/browser/treeViewModel';
function makeItem(id, height): any {
function makeItem(id: any, height: any): any {
return {
id: id,
getHeight: function () { return height; },
@@ -59,7 +59,7 @@ class TestView implements IView {
}
function getSashes(splitview: SplitView): Sash[] {
return (splitview as any).sashItems.map(i => i.sash) as Sash[];
return (splitview as any).sashItems.map((i: any) => i.sash) as Sash[];
}
suite('Splitview', () => {
+3 -3
View File
@@ -143,12 +143,12 @@ suite('Paths (Node Implementation)', () => {
]
)
]);
joinTests.forEach((test) => {
joinTests.forEach((test: any[]) => {
if (!Array.isArray(test[0])) {
test[0] = [test[0]];
}
test[0].forEach((join) => {
test[1].forEach((test) => {
test[0].forEach((join: any) => {
test[1].forEach((test: any) => {
const actual = join.apply(null, test[0]);
const expected = test[1];
// For non-Windows specific tests with the Windows join(), we need to try
@@ -132,13 +132,13 @@ suite('Encoding', () => {
assert.equal(mimes.encoding, 'windows1252');
});
async function readAndDecodeFromDisk(path, _encoding) {
async function readAndDecodeFromDisk(path: string, fileEncoding: string | null) {
return new Promise<string>((resolve, reject) => {
fs.readFile(path, (err, data) => {
if (err) {
reject(err);
} else {
resolve(encoding.decode(data, _encoding));
resolve(encoding.decode(data, fileEncoding!));
}
});
});
+6 -6
View File
@@ -431,7 +431,7 @@ suite('Glob', () => {
test('expression support (single)', function () {
let siblings = ['test.html', 'test.txt', 'test.ts', 'test.js'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
// { "**/*.js": { "when": "$(basename).ts" } }
let expression: glob.IExpression = {
@@ -467,7 +467,7 @@ suite('Glob', () => {
test('expression support (multiple)', function () {
let siblings = ['test.html', 'test.txt', 'test.ts', 'test.js'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
// { "**/*.js": { "when": "$(basename).ts" } }
let expression: glob.IExpression = {
@@ -717,7 +717,7 @@ suite('Glob', () => {
};
let siblings = ['foo.ts', 'foo.js', 'foo', 'bar'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
assert.strictEqual(glob.match(expr, 'bar', hasSibling), '**/bar');
assert.strictEqual(glob.match(expr, 'foo', hasSibling), null);
@@ -774,7 +774,7 @@ suite('Glob', () => {
let expr = { '**/*.js': { when: '$(basename).ts' } };
let siblings = ['foo.ts', 'foo.js'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
assert.strictEqual(glob.parse(expr)('bar/baz.js', 'baz.js', hasSibling), null);
assert.strictEqual(glob.parse(expr)('bar/foo.js', 'foo.js', hasSibling), '**/*.js');
@@ -818,7 +818,7 @@ suite('Glob', () => {
]);
const siblings = ['baz', 'baz.zip', 'nope'];
const hasSibling = name => siblings.indexOf(name) !== -1;
const hasSibling = (name: string) => siblings.indexOf(name) !== -1;
testOptimizationForBasenames({
'**/foo/**': { when: '$(basename).zip' },
'**/bar/**': true
@@ -924,7 +924,7 @@ suite('Glob', () => {
]);
const siblings = ['baz', 'baz.zip', 'nope'];
let hasSibling = name => siblings.indexOf(name) !== -1;
let hasSibling = (name: string) => siblings.indexOf(name) !== -1;
testOptimizationForPaths({
'**/foo/123/**': { when: '$(basename).zip' },
'**/bar/123/**': true
@@ -293,7 +293,7 @@ suite('SQLite Storage Library', () => {
return set;
}
async function testDBBasics(path, logError?: (error) => void) {
async function testDBBasics(path: string, logError?: (error: Error) => void) {
let options!: ISQLiteStorageDatabaseOptions;
if (logError) {
options = {
@@ -67,7 +67,7 @@ suite('FindController', () => {
getBoolean: (key: string) => !!queryState[key],
getNumber: (key: string) => undefined,
store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); },
remove: (key) => undefined
remove: () => undefined
} as any);
if (platform.isMacintosh) {
@@ -442,7 +442,7 @@ suite('FindController query options persistence', () => {
getBoolean: (key: string) => !!queryState[key],
getNumber: (key: string) => undefined,
store: (key: string, value: any) => { queryState[key] = value; return Promise.resolve(); },
remove: (key) => undefined
remove: () => undefined
} as any);
test('matchCase', () => {
@@ -11,7 +11,7 @@ import { parseExtensionHostPort, parseUserDataDir } from 'vs/platform/environmen
suite('EnvironmentService', () => {
test('parseExtensionHostPort when built', () => {
const parse = a => parseExtensionHostPort(parseArgs(a), true);
const parse = (a: string[]) => parseExtensionHostPort(parseArgs(a), true);
assert.deepEqual(parse([]), { port: null, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost']), { port: null, break: false, debugId: undefined });
@@ -28,7 +28,7 @@ suite('EnvironmentService', () => {
});
test('parseExtensionHostPort when unbuilt', () => {
const parse = a => parseExtensionHostPort(parseArgs(a), false);
const parse = (a: string[]) => parseExtensionHostPort(parseArgs(a), false);
assert.deepEqual(parse([]), { port: 5870, break: false, debugId: undefined });
assert.deepEqual(parse(['--debugPluginHost']), { port: 5870, break: false, debugId: undefined });
@@ -45,7 +45,7 @@ suite('EnvironmentService', () => {
});
test('userDataPath', () => {
const parse = (a, b: { cwd: () => string, env: { [key: string]: string } }) => parseUserDataDir(parseArgs(a), <any>b);
const parse = (a: string[], b: { cwd: () => string, env: { [key: string]: string } }) => parseUserDataDir(parseArgs(a), <any>b);
assert.equal(parse(['--user-data-dir', './dir'], { cwd: () => '/foo', env: {} }), path.resolve('/foo/dir'),
'should use cwd when --user-data-dir is specified');
@@ -71,7 +71,7 @@ class Service1Consumer {
class Target2Dep {
constructor(@IService1 service1: IService1, @IService2 service2) {
constructor(@IService1 service1: IService1, @IService2 service2: Service2) {
assert.ok(service1 instanceof Service1);
assert.ok(service2 instanceof Service2);
}
@@ -99,7 +99,7 @@ class TargetOptional {
}
class DependentServiceTarget {
constructor(@IDependentService d) {
constructor(@IDependentService d: IDependentService) {
assert.ok(d);
assert.equal(d.name, 'farboo');
}
@@ -85,7 +85,7 @@ suite('StorageService', () => {
test('Migrate Data', async () => {
class StorageTestEnvironmentService extends EnvironmentService {
constructor(private workspaceStorageFolderPath: string, private _extensionsPath) {
constructor(private workspaceStorageFolderPath: string, private _extensionsPath: string) {
super(parseArgs(process.argv), process.execPath);
}
@@ -40,7 +40,7 @@ suite('Debug - Source', () => {
});
test('get encoded debug data', () => {
const checkData = (uri: uri, expectedName, expectedPath, expectedSourceReference, expectedSessionId) => {
const checkData = (uri: uri, expectedName: string, expectedPath: string, expectedSourceReference: number | undefined, expectedSessionId?: number) => {
let { name, path, sourceReference, sessionId } = Source.getEncodedDebugData(uri);
assert.equal(name, expectedName);
assert.equal(path, expectedPath);
@@ -27,7 +27,7 @@ import { LanguageId, LanguageIdentifier } from 'vs/editor/common/modes';
//
class MockGrammarContributions implements IGrammarContributions {
private scopeName;
private scopeName: string;
constructor(scopeName: string) {
this.scopeName = scopeName;
@@ -69,9 +69,9 @@ suite('ExtensionsWorkbenchServiceTest', () => {
instantiationService.stub(ISharedProcessService, TestSharedProcessService);
instantiationService.stub(IWorkspaceContextService, new TestContextService());
instantiationService.stub(IConfigurationService, {
instantiationService.stub(IConfigurationService, <Partial<IConfigurationService>>{
onDidChangeConfiguration: () => { return undefined!; },
getValue: (key?) => {
getValue: (key?: string) => {
return (key === AutoCheckUpdatesConfigurationKey || key === AutoUpdateConfigurationKey) ? true : undefined;
}
});
@@ -18,7 +18,7 @@ function getMockTheme(type: ThemeType): ITheme {
selector: '',
label: '',
type: type,
getColor: (colorId: ColorIdentifier) => themingRegistry.resolveDefaultColor(colorId, theme),
getColor: (colorId: ColorIdentifier): Color | undefined => themingRegistry.resolveDefaultColor(colorId, theme),
defines: () => true
};
return theme;
@@ -40,7 +40,7 @@ import { IWorkspaceIdentifier } from 'vs/workbench/services/configuration/node/c
class SettingsTestEnvironmentService extends EnvironmentService {
constructor(args: ParsedArgs, _execPath: string, private customAppSettingsHome) {
constructor(args: ParsedArgs, _execPath: string, private customAppSettingsHome: string) {
super(args, _execPath);
}
@@ -561,7 +561,7 @@ suite('ExtHostLanguageFeatureCommands', function () {
test('Parameter Hints, back and forth', async () => {
disposables.push(extHost.registerSignatureHelpProvider(nullExtensionDescription, defaultSelector, new class implements vscode.SignatureHelpProvider {
provideSignatureHelp(_document, _position, _token, context: vscode.SignatureHelpContext): vscode.SignatureHelp {
provideSignatureHelp(_document: vscode.TextDocument, _position: vscode.Position, _token: vscode.CancellationToken, context: vscode.SignatureHelpContext): vscode.SignatureHelp {
return {
activeSignature: 0,
activeParameter: 1,
@@ -11,6 +11,7 @@ import { mock } from 'vs/workbench/test/electron-browser/api/mock';
import { IModelService } from 'vs/editor/common/services/modelService';
import { IEditorWorkerService } from 'vs/editor/common/services/editorWorkerService';
import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCProtocol';
import { TextEdit } from 'vs/editor/common/modes';
suite('MainThreadDocumentContentProviders', function () {
@@ -21,13 +22,13 @@ suite('MainThreadDocumentContentProviders', function () {
let providers = new MainThreadDocumentContentProviders(new TestRPCProtocol(), null!, null!,
new class extends mock<IModelService>() {
getModel(_uri) {
getModel(_uri: URI) {
assert.equal(uri.toString(), _uri.toString());
return model;
}
},
new class extends mock<IEditorWorkerService>() {
computeMoreMinimalEdits(_uri, data) {
computeMoreMinimalEdits(_uri: URI, data: TextEdit[] | null | undefined) {
assert.equal(model.getValue(), '1');
return Promise.resolve(data);
}
@@ -1018,7 +1018,7 @@ export class TestFileService implements IFileService {
onDidChangeFileSystemProviderRegistrations = Event.None;
registerProvider(_scheme: string, _provider) {
registerProvider(_scheme: string) {
return { dispose() { } };
}