Skip to content

Commit

Permalink
Converted another ~70 test files to strictNullChecks (#65672)
Browse files Browse the repository at this point in the history
* Converted another ~70 test files to strictNullChecks

These are the remaining test files that didn't require any changes to non-test file types. I'll send those in separately.

Most changes were automatic and small (`!`s).
The only non-trival change is that `extHostSearch.ts` needs an interface for its test data.

Again used [TypeStat](https://github.com/JoshuaKGoldberg/TypeStat) when possible per #65581. I'm happy to split this up into smaller PRs if you'd prefer!

* Added missing `!`s to `commands.test.ts`
  • Loading branch information
Josh Goldberg authored and mjbvz committed Dec 28, 2018
1 parent 6b4f599 commit 373b441
Show file tree
Hide file tree
Showing 74 changed files with 737 additions and 659 deletions.
74 changes: 73 additions & 1 deletion src/tsconfig.strictNullChecks.json
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,79 @@
"./vs/workbench/test/common/editor/editorOptions.test.ts",
"./vs/workbench/test/common/notifications.test.ts",
"./vs/workbench/test/electron-browser/api/extHostTypes.test.ts",
"./vs/workbench/test/electron-browser/api/mock.ts"
"./vs/workbench/test/electron-browser/api/mock.ts",
"./vs/base/parts/quickopen/test/browser/quickopen.test.ts",
"./vs/base/parts/tree/test/browser/treeModel.test.ts",
"./vs/base/parts/tree/test/browser/treeViewModel.test.ts",
"./vs/editor/contrib/documentSymbols/test/outlineModel.test.ts",
"./vs/editor/contrib/snippet/test/snippetController2.old.test.ts",
"./vs/editor/contrib/snippet/test/snippetController2.test.ts",
"./vs/editor/contrib/suggest/test/suggestMemory.test.ts",
"./vs/editor/contrib/suggest/test/suggestModel.test.ts",
"./vs/editor/standalone/test/browser/standaloneLanguages.test.ts",
"./vs/platform/commands/test/commands.test.ts",
"./vs/platform/extensionManagement/test/electron-browser/extensionEnablementService.test.ts",
"./vs/platform/keybinding/test/common/abstractKeybindingService.test.ts",
"./vs/platform/storage/test/node/storageService.test.ts",
"./vs/platform/telemetry/test/electron-browser/commonProperties.test.ts",
"./vs/platform/theme/test/electron-browser/colorRegistry.releaseTest.ts",
"./vs/platform/workspaces/test/electron-main/workspacesMainService.test.ts",
"./vs/workbench/parts/debug/test/browser/debugANSIHandling.test.ts",
"./vs/workbench/parts/debug/test/node/debugger.test.ts",
"./vs/workbench/parts/experiments/test/electron-browser/experimentService.test.ts",
"./vs/workbench/parts/extensions/test/electron-browser/extensionsActions.test.ts",
"./vs/workbench/parts/extensions/test/electron-browser/extensionsTipsService.test.ts",
"./vs/workbench/parts/extensions/test/electron-browser/extensionsViews.test.ts",
"./vs/workbench/parts/extensions/test/electron-browser/extensionsWorkbenchService.test.ts",
"./vs/workbench/parts/files/test/electron-browser/explorerModel.test.ts",
"./vs/workbench/parts/search/test/browser/openFileHandler.test.ts",
"./vs/workbench/parts/search/test/browser/searchViewlet.test.ts",
"./vs/workbench/parts/search/test/common/queryBuilder.test.ts",
"./vs/workbench/parts/search/test/common/searchModel.test.ts",
"./vs/workbench/parts/search/test/common/searchResult.test.ts",
"./vs/workbench/parts/tasks/test/electron-browser/configuration.test.ts",
"./vs/workbench/services/backup/test/electron-browser/backupFileService.test.ts",
"./vs/workbench/services/configuration/test/electron-browser/configurationEditingService.test.ts",
"./vs/workbench/services/configuration/test/electron-browser/configurationService.test.ts",
"./vs/workbench/services/files/node/watcher/unix/test/chockidarWatcherService.test.ts",
"./vs/workbench/services/files/test/electron-browser/fileService.test.ts",
"./vs/workbench/services/group/test/browser/editorGroupsService.test.ts",
"./vs/workbench/services/keybinding/test/electron-browser/keybindingEditing.test.ts",
"./vs/workbench/services/keybinding/test/macLinuxKeyboardMapper.test.ts",
"./vs/workbench/services/preferences/test/common/keybindingsEditorModel.test.ts",
"./vs/workbench/services/preferences/test/common/preferencesModel.test.ts",
"./vs/workbench/services/progress/test/progressService.test.ts",
"./vs/workbench/services/search/test/node/rawSearchService.test.ts",
"./vs/workbench/services/search/test/node/search.test.ts",
"./vs/workbench/services/search/test/node/textSearch.integrationTest.ts",
"./vs/workbench/services/textfile/test/textFileService.test.ts",
"./vs/workbench/services/textmodelResolver/test/textModelResolverService.test.ts",
"./vs/workbench/test/browser/part.test.ts",
"./vs/workbench/test/browser/parts/editor/baseEditor.test.ts",
"./vs/workbench/test/browser/parts/editor/rangeDecorations.test.ts",
"./vs/workbench/test/browser/quickopen.test.ts",
"./vs/workbench/test/browser/viewlet.test.ts",
"./vs/workbench/test/common/editor/editorDiffModel.test.ts",
"./vs/workbench/test/common/editor/editorGroups.test.ts",
"./vs/workbench/test/common/editor/editorModel.test.ts",
"./vs/workbench/test/common/editor/resourceEditorInput.test.ts",
"./vs/workbench/test/common/editor/untitledEditor.test.ts",
"./vs/workbench/test/common/memento.test.ts",
"./vs/workbench/test/electron-browser/api/extHostCommands.test.ts",
"./vs/workbench/test/electron-browser/api/extHostDiagnostics.test.ts",
"./vs/workbench/test/electron-browser/api/extHostDocumentData.test.ts",
"./vs/workbench/test/electron-browser/api/extHostDocumentsAndEditors.test.ts",
"./vs/workbench/test/electron-browser/api/extHostDocumentSaveParticipant.test.ts",
"./vs/workbench/test/electron-browser/api/extHostFileSystemEventService.test.ts",
"./vs/workbench/test/electron-browser/api/extHostMessagerService.test.ts",
"./vs/workbench/test/electron-browser/api/extHostTextEditor.test.ts",
"./vs/workbench/test/electron-browser/api/extHostTextEditors.test.ts",
"./vs/workbench/test/electron-browser/api/extHostTypeConverter.test.ts",
"./vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts",
"./vs/workbench/test/electron-browser/api/mainThreadCommands.test.ts",
"./vs/workbench/test/electron-browser/api/mainThreadDiagnostics.test.ts",
"./vs/workbench/test/electron-browser/quickopen.perf.integrationTest.ts",
"./vs/workbench/test/electron-browser/textsearch.perf.integrationTest.ts"
],
"exclude": [
"./typings/require-monaco.d.ts"
Expand Down
8 changes: 4 additions & 4 deletions src/vs/base/parts/quickopen/test/browser/quickopen.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ suite('QuickOpen', () => {
model.addEntries([entry1, entry2, entry3]);

const ds = new DataSource(model);
assert.equal(entry1.getId(), ds.getId(null, entry1));
assert.equal(true, ds.hasChildren(null, model));
assert.equal(false, ds.hasChildren(null, entry1));
assert.equal(entry1.getId(), ds.getId(null!, entry1));
assert.equal(true, ds.hasChildren(null!, model));
assert.equal(false, ds.hasChildren(null!, entry1));

ds.getChildren(null, model).then((children: any[]) => {
ds.getChildren(null!, model).then((children: any[]) => {
assert.equal(3, children.length);
});
});
Expand Down
2 changes: 1 addition & 1 deletion src/vs/base/parts/tree/test/browser/treeModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class FakeRenderer {

class TreeContext implements _.ITreeContext {

public tree: _.ITree = null;
public tree: _.ITree = null!;
public options: _.ITreeOptions = { autoExpandSingleChildren: true };
public dataSource: _.IDataSource;
public renderer: _.IRenderer;
Expand Down
4 changes: 2 additions & 2 deletions src/vs/base/parts/tree/test/browser/treeViewModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function makeItem(id, height): any {
}

function makeItems(...args: any[]) {
var r = [];
var r: any[] = [];

for (var i = 0; i < args.length; i += 2) {
r.push(makeItem(args[i], args[i + 1]));
Expand Down Expand Up @@ -59,7 +59,7 @@ suite('TreeView - HeightMap', () => {

teardown(() => {
rangeMap.dispose();
rangeMap = null;
rangeMap = null!;
});

test('simple', () => {
Expand Down
24 changes: 12 additions & 12 deletions src/vs/editor/contrib/documentSymbols/test/outlineModel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,16 @@ suite('OutlineModel', function () {
}

function fakeMarker(range: Range): IMarker {
return { ...range, owner: 'ffff', message: 'test', severity: MarkerSeverity.Error, resource: null };
return { ...range, owner: 'ffff', message: 'test', severity: MarkerSeverity.Error, resource: null! };
}

test('OutlineElement - updateMarker', function () {

let e0 = new OutlineElement('foo1', null, fakeSymbolInformation(new Range(1, 1, 1, 10)));
let e1 = new OutlineElement('foo2', null, fakeSymbolInformation(new Range(2, 1, 5, 1)));
let e2 = new OutlineElement('foo3', null, fakeSymbolInformation(new Range(6, 1, 10, 10)));
let e0 = new OutlineElement('foo1', null!, fakeSymbolInformation(new Range(1, 1, 1, 10)));
let e1 = new OutlineElement('foo2', null!, fakeSymbolInformation(new Range(2, 1, 5, 1)));
let e2 = new OutlineElement('foo3', null!, fakeSymbolInformation(new Range(6, 1, 10, 10)));

let group = new OutlineGroup('group', null, null, 1);
let group = new OutlineGroup('group', null!, null!, 1);
group.children[e0.id] = e0;
group.children[e1.id] = e1;
group.children[e2.id] = e2;
Expand All @@ -113,11 +113,11 @@ suite('OutlineModel', function () {

test('OutlineElement - updateMarker, 2', function () {

let p = new OutlineElement('A', null, fakeSymbolInformation(new Range(1, 1, 11, 1)));
let c1 = new OutlineElement('A/B', null, fakeSymbolInformation(new Range(2, 4, 5, 4)));
let c2 = new OutlineElement('A/C', null, fakeSymbolInformation(new Range(6, 4, 9, 4)));
let p = new OutlineElement('A', null!, fakeSymbolInformation(new Range(1, 1, 11, 1)));
let c1 = new OutlineElement('A/B', null!, fakeSymbolInformation(new Range(2, 4, 5, 4)));
let c2 = new OutlineElement('A/C', null!, fakeSymbolInformation(new Range(6, 4, 9, 4)));

let group = new OutlineGroup('group', null, null, 1);
let group = new OutlineGroup('group', null!, null!, 1);
group.children[p.id] = p;
p.children[c1.id] = c1;
p.children[c2.id] = c2;
Expand Down Expand Up @@ -155,16 +155,16 @@ suite('OutlineModel', function () {

let model = new class extends OutlineModel {
constructor() {
super(null);
super(null!);
}
readyForTesting() {
this._groups = this.children as any;
}
};
model.children['g1'] = new OutlineGroup('g1', model, null, 1);
model.children['g1'] = new OutlineGroup('g1', model, null!, 1);
model.children['g1'].children['c1'] = new OutlineElement('c1', model.children['g1'], fakeSymbolInformation(new Range(1, 1, 11, 1)));

model.children['g2'] = new OutlineGroup('g2', model, null, 1);
model.children['g2'] = new OutlineGroup('g2', model, null!, 1);
model.children['g2'].children['c2'] = new OutlineElement('c2', model.children['g2'], fakeSymbolInformation(new Range(1, 1, 7, 1)));
model.children['g2'].children['c2'].children['c2.1'] = new OutlineElement('c2.1', model.children['g2'].children['c2'], fakeSymbolInformation(new Range(1, 3, 2, 19)));
model.children['g2'].children['c2'].children['c2.2'] = new OutlineElement('c2.2', model.children['g2'].children['c2'], fakeSymbolInformation(new Range(4, 1, 6, 10)));
Expand Down
Loading

0 comments on commit 373b441

Please sign in to comment.