Skip to content

Commit ebff3af

Browse files
committed
Strict null supressions in tests
1 parent 14e4835 commit ebff3af

7 files changed

Lines changed: 93 additions & 93 deletions

File tree

src/vs/workbench/api/electron-browser/mainThreadConfiguration.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,17 +46,17 @@ export class MainThreadConfiguration implements MainThreadConfigurationShape {
4646
this._configurationListener.dispose();
4747
}
4848

49-
$updateConfigurationOption(target: ConfigurationTarget, key: string, value: any, resourceUriComponenets: UriComponents): Promise<void> {
49+
$updateConfigurationOption(target: ConfigurationTarget | null, key: string, value: any, resourceUriComponenets: UriComponents | null): Promise<void> {
5050
const resource = resourceUriComponenets ? URI.revive(resourceUriComponenets) : null;
5151
return this.writeConfiguration(target, key, value, resource);
5252
}
5353

54-
$removeConfigurationOption(target: ConfigurationTarget, key: string, resourceUriComponenets: UriComponents): Promise<void> {
54+
$removeConfigurationOption(target: ConfigurationTarget | null, key: string, resourceUriComponenets: UriComponents | null): Promise<void> {
5555
const resource = resourceUriComponenets ? URI.revive(resourceUriComponenets) : null;
5656
return this.writeConfiguration(target, key, undefined, resource);
5757
}
5858

59-
private writeConfiguration(target: ConfigurationTarget, key: string, value: any, resource: URI | null): Promise<void> {
59+
private writeConfiguration(target: ConfigurationTarget | null, key: string, value: any, resource: URI | null): Promise<void> {
6060
target = target !== null && target !== undefined ? target : this.deriveConfigurationTarget(key, resource);
6161
return this.configurationService.updateValue(key, value, { resource }, target, true);
6262
}

src/vs/workbench/contrib/debug/test/browser/baseDebugView.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,10 @@ suite('Debug - Base Debug View', () => {
5555
test('render variable', () => {
5656
const session = new MockSession();
5757
const thread = new Thread(session, 'mockthread', 1);
58-
const stackFrame = new StackFrame(thread, 1, null, 'app.js', 'normal', { startLineNumber: 1, startColumn: 1, endLineNumber: undefined, endColumn: undefined }, 0);
58+
const stackFrame = new StackFrame(thread, 1, null!, 'app.js', 'normal', { startLineNumber: 1, startColumn: 1, endLineNumber: undefined!, endColumn: undefined! }, 0);
5959
const scope = new Scope(stackFrame, 1, 'local', 1, false, 10, 10);
6060

61-
let variable = new Variable(session, scope, 2, 'foo', 'bar.foo', undefined, 0, 0, {}, 'string');
61+
let variable = new Variable(session, scope, 2, 'foo', 'bar.foo', undefined!, 0, 0, {}, 'string');
6262
let expression = $('.');
6363
let name = $('.');
6464
let value = $('.');

src/vs/workbench/contrib/debug/test/browser/linkDetector.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ suite('Debug - Link Detector', () => {
5858

5959
assert.equal(1, output.children.length);
6060
assert.equal('SPAN', output.tagName);
61-
assert.equal('A', output.firstElementChild.tagName);
61+
assert.equal('A', output.firstElementChild!.tagName);
6262
assert(expectedOutput.test(output.outerHTML));
63-
assertElementIsLink(output.firstElementChild);
64-
assert.equal(isWindows ? 'C:/foo/bar.js:12:34' : '/Users/foo/bar.js:12:34', output.firstElementChild.textContent);
63+
assertElementIsLink(output.firstElementChild!);
64+
assert.equal(isWindows ? 'C:/foo/bar.js:12:34' : '/Users/foo/bar.js:12:34', output.firstElementChild!.textContent);
6565
});
6666

6767
test('relativeLink', () => {

src/vs/workbench/services/panel/common/panelService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export interface IPanelService {
3030
/**
3131
* Returns the current active panel or null if none
3232
*/
33-
getActivePanel(): IPanel;
33+
getActivePanel(): IPanel | null;
3434

3535
/**
3636
* * Returns all built-in panels following the default order (Problems - Output - Debug Console - Terminal)

src/vs/workbench/test/electron-browser/api/extHostWorkspace.test.ts

Lines changed: 71 additions & 71 deletions
Large diffs are not rendered by default.

src/vs/workbench/test/electron-browser/api/mainThreadDocumentsAndEditors.test.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ suite('MainThreadDocumentsAndEditors', () => {
2929
let deltas: IDocumentsAndEditorsDelta[] = [];
3030
const hugeModelString = new Array(2 + (50 * 1024 * 1024)).join('-');
3131

32-
function myCreateTestCodeEditor(model: ITextModel): TestCodeEditor {
32+
function myCreateTestCodeEditor(model: ITextModel | undefined): TestCodeEditor {
3333
return createTestCodeEditor({
3434
model: model,
3535
serviceCollection: new ServiceCollection(
@@ -68,12 +68,12 @@ suite('MainThreadDocumentsAndEditors', () => {
6868
textFileService,
6969
workbenchEditorService,
7070
codeEditorService,
71-
null,
71+
null!,
7272
fileService,
73-
null,
74-
null,
73+
null!,
74+
null!,
7575
editorGroupService,
76-
null,
76+
null!,
7777
new class extends mock<IPanelService>() implements IPanelService {
7878
_serviceBrand: any;
7979
onDidPanelOpen = Event.None;
@@ -95,7 +95,7 @@ suite('MainThreadDocumentsAndEditors', () => {
9595
assert.equal(deltas.length, 1);
9696
const [delta] = deltas;
9797

98-
assert.equal(delta.addedDocuments.length, 1);
98+
assert.equal(delta.addedDocuments!.length, 1);
9999
assert.equal(delta.removedDocuments, undefined);
100100
assert.equal(delta.addedEditors, undefined);
101101
assert.equal(delta.removedEditors, undefined);
@@ -146,7 +146,7 @@ suite('MainThreadDocumentsAndEditors', () => {
146146
});
147147

148148
test('ignore editor w/o model', () => {
149-
const editor = myCreateTestCodeEditor(null);
149+
const editor = myCreateTestCodeEditor(undefined);
150150
assert.equal(deltas.length, 1);
151151
const [delta] = deltas;
152152
assert.equal(delta.newActiveEditor, null);
@@ -166,13 +166,13 @@ suite('MainThreadDocumentsAndEditors', () => {
166166

167167
assert.equal(deltas.length, 2);
168168
const [first, second] = deltas;
169-
assert.equal(first.addedDocuments.length, 1);
169+
assert.equal(first.addedDocuments!.length, 1);
170170
assert.equal(first.newActiveEditor, null);
171171
assert.equal(first.removedDocuments, undefined);
172172
assert.equal(first.addedEditors, undefined);
173173
assert.equal(first.removedEditors, undefined);
174174

175-
assert.equal(second.addedEditors.length, 1);
175+
assert.equal(second.addedEditors!.length, 1);
176176
assert.equal(second.addedDocuments, undefined);
177177
assert.equal(second.removedDocuments, undefined);
178178
assert.equal(second.removedEditors, undefined);
@@ -194,8 +194,8 @@ suite('MainThreadDocumentsAndEditors', () => {
194194
const [first] = deltas;
195195

196196
assert.equal(first.newActiveEditor, null);
197-
assert.equal(first.removedEditors.length, 1);
198-
assert.equal(first.removedDocuments.length, 1);
197+
assert.equal(first.removedEditors!.length, 1);
198+
assert.equal(first.removedDocuments!.length, 1);
199199
assert.equal(first.addedDocuments, undefined);
200200
assert.equal(first.addedEditors, undefined);
201201

src/vs/workbench/test/workbenchTestServices.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
6262
import { IDecorationsService, IResourceDecorationChangeEvent, IDecoration, IDecorationData, IDecorationsProvider } from 'vs/workbench/services/decorations/browser/decorations';
6363
import { IDisposable, toDisposable, Disposable } from 'vs/base/common/lifecycle';
6464
import { IEditorGroupsService, IEditorGroup, GroupsOrder, GroupsArrangement, GroupDirection, IAddGroupOptions, IMergeGroupOptions, IMoveEditorOptions, ICopyEditorOptions, IEditorReplacement, IGroupChangeEvent, EditorsOrder, IFindGroupScope, EditorGroupLayout } from 'vs/workbench/services/editor/common/editorGroupsService';
65-
import { IEditorService, IOpenEditorOverrideHandler } from 'vs/workbench/services/editor/common/editorService';
65+
import { IEditorService, IOpenEditorOverrideHandler, IActiveEditor } from 'vs/workbench/services/editor/common/editorService';
6666
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
6767
import { ICodeEditor, IDiffEditor } from 'vs/editor/browser/editorBrowser';
6868
import { IDecorationRenderOptions } from 'vs/editor/common/editorCommon';
@@ -730,7 +730,7 @@ export class TestEditorService implements EditorServiceImpl {
730730
onDidCloseEditor: Event<IEditorCloseEvent> = Event.None;
731731
onDidOpenEditorFail: Event<IEditorIdentifier> = Event.None;
732732

733-
activeControl: IEditor;
733+
activeControl: IActiveEditor;
734734
activeTextEditorWidget: any;
735735
activeEditor: IEditorInput;
736736
editors: ReadonlyArray<IEditorInput> = [];

0 commit comments

Comments
 (0)