vscode-go: make all context properties optional

To simplify test setup, given that the context is unused in all
integration tests, all the properties on the context are made
optional.

Change-Id: I2d75b08e3633f67c89a702823ac2c62338e55df4
Reviewed-on: https://go-review.googlesource.com/c/vscode-go/+/406034
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
TryBot-Result: kokoro <noreply+kokoro@google.com>
Run-TryBot: Jamal Carvalho <jamal@golang.org>
diff --git a/src/context.ts b/src/context.ts
index a577b92..05405db 100644
--- a/src/context.ts
+++ b/src/context.ts
@@ -23,11 +23,11 @@
 	serverInfo?: ServerInfo;
 	// lastUserAction is the time of the last user-triggered change.
 	// A user-triggered change is a didOpen, didChange, didSave, or didClose event.
-	lastUserAction: Date;
+	lastUserAction?: Date;
 	serverTraceChannel?: vscode.OutputChannel;
-	crashCount: number;
+	crashCount?: number;
 	// Some metrics for automated issue reports:
-	restartHistory: Restart[];
+	restartHistory?: Restart[];
 	buildDiagnosticCollection?: vscode.DiagnosticCollection;
 	lintDiagnosticCollection?: vscode.DiagnosticCollection;
 	vetDiagnosticCollection?: vscode.DiagnosticCollection;
diff --git a/src/goDeveloperSurvey.ts b/src/goDeveloperSurvey.ts
index d581e77..106bfb0 100644
--- a/src/goDeveloperSurvey.ts
+++ b/src/goDeveloperSurvey.ts
@@ -53,9 +53,9 @@
 	}
 	const callback = async () => {
 		const currentTime = new Date();
-
+		const { lastUserAction = new Date() } = goCtx;
 		// Make sure the user has been idle for at least a minute.
-		if (minutesBetween(goCtx.lastUserAction, currentTime) < 1) {
+		if (minutesBetween(lastUserAction, currentTime) < 1) {
 			setTimeout(callback, 5 * timeMinute);
 			return;
 		}
diff --git a/src/goMain.ts b/src/goMain.ts
index b102d6a..00f5f11 100644
--- a/src/goMain.ts
+++ b/src/goMain.ts
@@ -69,11 +69,7 @@
 import { GoExtensionContext } from './context';
 import * as commands from './commands';
 
-const goCtx: GoExtensionContext = {
-	lastUserAction: new Date(),
-	crashCount: 0,
-	restartHistory: []
-};
+const goCtx: GoExtensionContext = {};
 
 export async function activate(ctx: vscode.ExtensionContext): Promise<ExtensionAPI | undefined> {
 	if (process.env['VSCODE_GO_IN_TEST'] === '1') {
diff --git a/src/goSurvey.ts b/src/goSurvey.ts
index 8a0912d..35559a8 100644
--- a/src/goSurvey.ts
+++ b/src/goSurvey.ts
@@ -67,9 +67,9 @@
 	}
 	const callback = async () => {
 		const currentTime = new Date();
-
+		const { lastUserAction = new Date() } = goCtx;
 		// Make sure the user has been idle for at least a minute.
-		if (minutesBetween(goCtx.lastUserAction, currentTime) < 1) {
+		if (minutesBetween(lastUserAction, currentTime) < 1) {
 			setTimeout(callback, 5 * timeMinute);
 			return;
 		}
diff --git a/src/language/goLanguageServer.ts b/src/language/goLanguageServer.ts
index 7202f34..25bd2f5 100644
--- a/src/language/goLanguageServer.ts
+++ b/src/language/goLanguageServer.ts
@@ -81,6 +81,7 @@
 
 export function updateRestartHistory(goCtx: GoExtensionContext, reason: RestartReason, enabled: boolean) {
 	// Keep the history limited to 10 elements.
+	goCtx.restartHistory = goCtx.restartHistory ?? [];
 	while (goCtx.restartHistory.length > 10) {
 		goCtx.restartHistory = goCtx.restartHistory.slice(1);
 	}
@@ -89,7 +90,7 @@
 
 function formatRestartHistory(goCtx: GoExtensionContext): string {
 	const result: string[] = [];
-	for (const restart of goCtx.restartHistory) {
+	for (const restart of goCtx.restartHistory ?? []) {
 		result.push(`${restart.timestamp.toUTCString()}: ${restart.reason} (enabled: ${restart.enabled})`);
 	}
 	return result.join('\n');
@@ -404,7 +405,8 @@
 				},
 				closed: (): CloseAction => {
 					// Allow 5 crashes before shutdown.
-					goCtx.crashCount++;
+					const { crashCount = 0 } = goCtx;
+					goCtx.crashCount = crashCount + 1;
 					if (goCtx.crashCount < 5) {
 						return CloseAction.Restart;
 					}
diff --git a/test/gopls/extension.test.ts b/test/gopls/extension.test.ts
index 5a9b9e4..0d89e18 100644
--- a/test/gopls/extension.test.ts
+++ b/test/gopls/extension.test.ts
@@ -16,7 +16,6 @@
 } from '../../src/language/goLanguageServer';
 import sinon = require('sinon');
 import { getGoVersion, GoVersion } from '../../src/util';
-import { GoExtensionContext } from '../../src/context';
 
 // FakeOutputChannel is a fake output channel used to buffer
 // the output of the tested language client in an in-memory
@@ -93,11 +92,6 @@
 	}
 
 	public async setup(filePath: string) {
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
 		// file path to open.
 		this.fakeOutputChannel = new FakeOutputChannel();
 		const pkgLoadingDone = this.onMessageInTrace('Finished loading packages.', 60_000);
@@ -110,7 +104,7 @@
 		});
 		const cfg: BuildLanguageClientOption = buildLanguageServerConfig(goConfig);
 		cfg.outputChannel = this.fakeOutputChannel; // inject our fake output channel.
-		this.languageClient = await buildLanguageClient(goCtx, cfg);
+		this.languageClient = await buildLanguageClient({}, cfg);
 		if (!this.languageClient) {
 			throw new Error('Language client not initialized.');
 		}
diff --git a/test/gopls/survey.test.ts b/test/gopls/survey.test.ts
index f8bbf7a..bb90a32 100644
--- a/test/gopls/survey.test.ts
+++ b/test/gopls/survey.test.ts
@@ -9,7 +9,6 @@
 import goLanguageServer = require('../../src/language/goLanguageServer');
 import goSurvey = require('../../src/goSurvey');
 import goDeveloperSurvey = require('../../src/goDeveloperSurvey');
-import { GoExtensionContext } from '../../src/context';
 
 suite('gopls survey tests', () => {
 	test('prompt for survey', () => {
@@ -219,17 +218,12 @@
 
 	testCases.map(async ([testConfig, choice, wantCount], i) => {
 		test(`opt out: ${i}`, async () => {
-			const goCtx: GoExtensionContext = {
-				lastUserAction: new Date(),
-				crashCount: 0,
-				restartHistory: []
-			};
 			const stub = sandbox.stub(vscode.window, 'showInformationMessage').resolves({ title: choice });
 			const getGoplsOptOutConfigStub = sandbox.stub(goLanguageServer, 'getGoplsOptOutConfig').returns(testConfig);
 			const flushGoplsOptOutConfigStub = sandbox.stub(goLanguageServer, 'flushGoplsOptOutConfig');
 			sandbox.stub(vscode.env, 'openExternal').resolves(true);
 
-			await goLanguageServer.promptAboutGoplsOptOut(goCtx);
+			await goLanguageServer.promptAboutGoplsOptOut({});
 			assert.strictEqual(stub.callCount, wantCount, 'unexpected call count');
 			sandbox.assert.called(getGoplsOptOutConfigStub);
 			sandbox.assert.calledOnce(flushGoplsOptOutConfigStub);
diff --git a/test/integration/codelens.test.ts b/test/integration/codelens.test.ts
index 30d0d0f..ddd09cc 100644
--- a/test/integration/codelens.test.ts
+++ b/test/integration/codelens.test.ts
@@ -11,7 +11,6 @@
 import sinon = require('sinon');
 import vscode = require('vscode');
 import { updateGoVarsFromConfig } from '../../src/goInstallTools';
-import { GoExtensionContext } from '../../src/context';
 import { GoRunTestCodeLensProvider } from '../../src/goRunTestCodelens';
 import { subTestAtCursor } from '../../src/goTest';
 import { getCurrentGoPath, getGoVersion } from '../../src/util';
@@ -25,20 +24,15 @@
 	let fixturePath: string;
 	let fixtureSourcePath: string;
 
-	let goConfig: vscode.WorkspaceConfiguration;
 	let document: vscode.TextDocument;
 
+	// eslint-disable-next-line @typescript-eslint/no-explicit-any
 	const ctx = new MockExtensionContext() as any;
-	const goCtx: GoExtensionContext = {
-		lastUserAction: new Date(),
-		crashCount: 0,
-		restartHistory: []
-	};
 	const cancellationTokenSource = new vscode.CancellationTokenSource();
-	const codeLensProvider = new GoRunTestCodeLensProvider(goCtx);
+	const codeLensProvider = new GoRunTestCodeLensProvider({});
 
 	suiteSetup(async () => {
-		await updateGoVarsFromConfig(goCtx);
+		await updateGoVarsFromConfig({});
 
 		gopath = getCurrentGoPath();
 		if (!gopath) {
@@ -70,21 +64,21 @@
 	test('Subtests - runs a test with cursor on t.Run line', async () => {
 		const editor = await vscode.window.showTextDocument(document);
 		editor.selection = new vscode.Selection(7, 4, 7, 4);
-		const result = await subTestAtCursor(ctx, goCtx)([]);
+		const result = await subTestAtCursor(ctx, {})([]);
 		assert.equal(result, true);
 	});
 
 	test('Subtests - runs a test with cursor within t.Run function', async () => {
 		const editor = await vscode.window.showTextDocument(document);
 		editor.selection = new vscode.Selection(8, 4, 8, 4);
-		const result = await subTestAtCursor(ctx, goCtx)([]);
+		const result = await subTestAtCursor(ctx, {})([]);
 		assert.equal(result, true);
 	});
 
 	test('Subtests - returns false for a failing test', async () => {
 		const editor = await vscode.window.showTextDocument(document);
 		editor.selection = new vscode.Selection(11, 4, 11, 4);
-		const result = await subTestAtCursor(ctx, goCtx)([]);
+		const result = await subTestAtCursor(ctx, {})([]);
 		assert.equal(result, false);
 	});
 
@@ -92,7 +86,7 @@
 		const editor = await vscode.window.showTextDocument(document);
 		editor.selection = new vscode.Selection(17, 4, 17, 4);
 		sinon.stub(vscode.window, 'showInputBox').onFirstCall().resolves(undefined);
-		const result = await subTestAtCursor(ctx, goCtx)([]);
+		const result = await subTestAtCursor(ctx, {})([]);
 		assert.equal(result, undefined);
 	});
 
@@ -100,21 +94,21 @@
 		const editor = await vscode.window.showTextDocument(document);
 		editor.selection = new vscode.Selection(17, 4, 17, 4);
 		sinon.stub(vscode.window, 'showInputBox').onFirstCall().resolves('dynamic test name');
-		const result = await subTestAtCursor(ctx, goCtx)([]);
+		const result = await subTestAtCursor(ctx, {})([]);
 		assert.equal(result, false);
 	});
 
 	test('Subtests - does nothing when cursor outside of a test function', async () => {
 		const editor = await vscode.window.showTextDocument(document);
 		editor.selection = new vscode.Selection(5, 0, 5, 0);
-		const result = await subTestAtCursor(ctx, goCtx)([]);
+		const result = await subTestAtCursor(ctx, {})([]);
 		assert.equal(result, undefined);
 	});
 
 	test('Subtests - does nothing when no test function covers the cursor and a function name is passed in', async () => {
 		const editor = await vscode.window.showTextDocument(document);
 		editor.selection = new vscode.Selection(5, 0, 5, 0);
-		const result = await subTestAtCursor(ctx, goCtx)({ functionName: 'TestMyFunction' });
+		const result = await subTestAtCursor(ctx, {})({ functionName: 'TestMyFunction' });
 		assert.equal(result, undefined);
 	});
 
diff --git a/test/integration/coverage.test.ts b/test/integration/coverage.test.ts
index 750fa1d..ef03be3 100644
--- a/test/integration/coverage.test.ts
+++ b/test/integration/coverage.test.ts
@@ -13,7 +13,6 @@
 import path = require('path');
 import sinon = require('sinon');
 import vscode = require('vscode');
-import { GoExtensionContext } from '../../src/context';
 
 // The ideal test would check that each open editor containing a file with coverage
 // information is displayed correctly. We cannot see the applied decorations, so the
@@ -26,12 +25,7 @@
 	let coverFilePath: string;
 
 	suiteSetup(async () => {
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		await updateGoVarsFromConfig(goCtx);
+		await updateGoVarsFromConfig({});
 
 		// Set up the test fixtures.
 		fixtureSourcePath = path.join(__dirname, '..', '..', '..', 'test', 'testdata', 'coverage');
diff --git a/test/integration/extension.test.ts b/test/integration/extension.test.ts
index 2a6f93e..27aee2e 100644
--- a/test/integration/extension.test.ts
+++ b/test/integration/extension.test.ts
@@ -45,7 +45,6 @@
 } from '../../src/util';
 import cp = require('child_process');
 import os = require('os');
-import { GoExtensionContext } from '../../src/context';
 import { MockExtensionContext } from '../mocks/MockContext';
 
 const testAll = (isModuleMode: boolean) => {
@@ -66,12 +65,7 @@
 		previousEnv = Object.assign({}, process.env);
 		process.env.GO111MODULE = isModuleMode ? 'on' : 'off';
 
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		await updateGoVarsFromConfig(goCtx);
+		await updateGoVarsFromConfig({});
 
 		gopath = getCurrentGoPath();
 		if (!gopath) {
@@ -474,12 +468,7 @@
 		);
 
 		const diagnosticCollection = vscode.languages.createDiagnosticCollection('linttest');
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		handleDiagnosticErrors(goCtx, file2, warnings, diagnosticCollection);
+		handleDiagnosticErrors({}, file2, warnings, diagnosticCollection);
 
 		// The first diagnostic message for each file should be about the use of MixedCaps in package name.
 		// Both files belong to the same package name, and we want them to be identical.
@@ -523,16 +512,7 @@
 
 		// `check` itself doesn't run deDupeDiagnostics, so we expect all vet/lint errors.
 		const expected = [...expectedLintErrors, ...expectedBuildVetErrors];
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		const diagnostics = await check(
-			goCtx,
-			vscode.Uri.file(path.join(fixturePath, 'errorsTest', 'errors.go')),
-			config
-		);
+		const diagnostics = await check({}, vscode.Uri.file(path.join(fixturePath, 'errorsTest', 'errors.go')), config);
 		const sortedDiagnostics = ([] as ICheckResult[]).concat
 			.apply(
 				[],
@@ -568,12 +548,7 @@
 		const document = await vscode.workspace.openTextDocument(uri);
 		await vscode.window.showTextDocument(document);
 		const ctx = new MockExtensionContext() as any;
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		await generateTestCurrentFile(ctx, goCtx)();
+		await generateTestCurrentFile(ctx, {})();
 
 		const testFileGenerated = fs.existsSync(path.join(generateTestsSourcePath, 'generatetests_test.go'));
 		assert.equal(testFileGenerated, true, 'Test file not generated.');
@@ -591,12 +566,7 @@
 		const editor = await vscode.window.showTextDocument(document);
 		editor.selection = new vscode.Selection(5, 0, 6, 0);
 		const ctx = new MockExtensionContext() as any;
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		await generateTestCurrentFunction(ctx, goCtx)();
+		await generateTestCurrentFunction(ctx, {})();
 
 		const testFileGenerated = fs.existsSync(path.join(generateTestsSourcePath, 'generatetests_test.go'));
 		assert.equal(testFileGenerated, true, 'Test file not generated.');
@@ -613,12 +583,7 @@
 		const document = await vscode.workspace.openTextDocument(uri);
 		await vscode.window.showTextDocument(document);
 		const ctx = new MockExtensionContext() as any;
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		await generateTestCurrentPackage(ctx, goCtx)();
+		await generateTestCurrentPackage(ctx, {})();
 
 		const testFileGenerated = fs.existsSync(path.join(generateTestsSourcePath, 'generatetests_test.go'));
 		assert.equal(testFileGenerated, true, 'Test file not generated.');
@@ -712,12 +677,7 @@
 		const document = await vscode.workspace.openTextDocument(uri);
 		await vscode.window.showTextDocument(document);
 		const ctx = new MockExtensionContext() as any;
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		const result = await testCurrentFile(false, () => config)(ctx, goCtx)([]);
+		const result = await testCurrentFile(false, () => config)(ctx, {})([]);
 		assert.equal(result, true);
 	});
 
@@ -768,12 +728,7 @@
 	test('Test Outline document symbols', async () => {
 		const uri = vscode.Uri.file(path.join(fixturePath, 'outlineTest', 'test.go'));
 		const document = await vscode.workspace.openTextDocument(uri);
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		const symbolProvider = GoDocumentSymbolProvider(goCtx);
+		const symbolProvider = GoDocumentSymbolProvider({});
 
 		const outlines = await symbolProvider.provideDocumentSymbols(document, dummyCancellationSource.token);
 		const packages = outlines.filter((x) => x.kind === vscode.SymbolKind.Package);
@@ -1477,12 +1432,7 @@
 				buildTags: { value: tags }
 			}) as vscode.WorkspaceConfiguration;
 
-			const goCtx: GoExtensionContext = {
-				lastUserAction: new Date(),
-				crashCount: 0,
-				restartHistory: []
-			};
-			const diagnostics = await check(goCtx, fileUri, cfg);
+			const diagnostics = await check({}, fileUri, cfg);
 			return ([] as string[]).concat(
 				...diagnostics.map<string[]>((d) => {
 					return d.errors.map((e) => e.msg) as string[];
@@ -1555,22 +1505,17 @@
 		const document = await vscode.workspace.openTextDocument(uri);
 		await vscode.window.showTextDocument(document);
 		const ctx = new MockExtensionContext() as any;
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
 
-		const result1 = await testCurrentFile(false, () => config1)(ctx, goCtx)([]);
+		const result1 = await testCurrentFile(false, () => config1)(ctx, {})([]);
 		assert.equal(result1, true);
 
-		const result2 = await testCurrentFile(false, () => config2)(ctx, goCtx)([]);
+		const result2 = await testCurrentFile(false, () => config2)(ctx, {})([]);
 		assert.equal(result2, true);
 
-		const result3 = await testCurrentFile(false, () => config3)(ctx, goCtx)([]);
+		const result3 = await testCurrentFile(false, () => config3)(ctx, {})([]);
 		assert.equal(result3, true);
 
-		const result4 = await testCurrentFile(false, () => config4)(ctx, goCtx)([]);
+		const result4 = await testCurrentFile(false, () => config4)(ctx, {})([]);
 		assert.equal(result4, false);
 	});
 
@@ -1661,12 +1606,7 @@
 		const selection = new vscode.Selection(12, 15, 12, 15);
 		editor.selection = selection;
 		const ctx = new MockExtensionContext() as any;
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		await runFillStruct(ctx, goCtx)(editor);
+		await runFillStruct(ctx, {})(editor);
 		assert.equal(vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.getText(), golden);
 	});
 
@@ -1680,12 +1620,7 @@
 		const selection = new vscode.Selection(7, 0, 7, 10);
 		editor.selection = selection;
 		const ctx = new MockExtensionContext() as any;
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		await runFillStruct(ctx, goCtx)(editor);
+		await runFillStruct(ctx, {})(editor);
 		assert.equal(vscode.window.activeTextEditor && vscode.window.activeTextEditor.document.getText(), golden);
 	});
 };
diff --git a/test/integration/goDebugConfiguration.test.ts b/test/integration/goDebugConfiguration.test.ts
index 2865674..3c1095b 100644
--- a/test/integration/goDebugConfiguration.test.ts
+++ b/test/integration/goDebugConfiguration.test.ts
@@ -14,7 +14,6 @@
 import goEnv = require('../../src/goEnv');
 import { MockCfg } from '../mocks/MockCfg';
 import { extensionId } from '../../src/const';
-import { GoExtensionContext } from '../../src/context';
 
 suite('Debug Environment Variable Merge Test', () => {
 	const debugConfigProvider = new GoDebugConfigurationProvider();
@@ -24,12 +23,7 @@
 	const filePath = path.join(fixtureSourcePath, 'baseTest', 'test.go');
 
 	suiteSetup(async () => {
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		await updateGoVarsFromConfig(goCtx);
+		await updateGoVarsFromConfig({});
 		await vscode.workspace.openTextDocument(vscode.Uri.file(filePath));
 	});
 
diff --git a/test/integration/goTest.explore.test.ts b/test/integration/goTest.explore.test.ts
index 7ee4b0f..f99cbe5 100644
--- a/test/integration/goTest.explore.test.ts
+++ b/test/integration/goTest.explore.test.ts
@@ -15,7 +15,6 @@
 import { GoTestResolver } from '../../src/goTest/resolve';
 import * as testUtils from '../../src/testUtils';
 import { GoTest } from '../../src/goTest/utils';
-import { GoExtensionContext } from '../../src/context';
 
 type Files = Record<string, string | { contents: string; language: string }>;
 
@@ -31,12 +30,7 @@
 ) {
 	const ws = MockTestWorkspace.from(folders, files);
 	const ctrl = new MockTestController();
-	const goCtx: GoExtensionContext = {
-		lastUserAction: new Date(),
-		crashCount: 0,
-		restartHistory: []
-	};
-	const expl = new ctor(goCtx, ws, ctrl, new MockMemento(), getSymbols_Regex);
+	const expl = new ctor({}, ws, ctrl, new MockMemento(), getSymbols_Regex);
 	populateModulePathCache(ws);
 	return { ctrl, expl, ws };
 }
@@ -199,17 +193,11 @@
 	suite('stretchr', () => {
 		const fixtureDir = path.join(__dirname, '..', '..', '..', 'test', 'testdata', 'stretchrTestSuite');
 		const ctx = MockExtensionContext.new();
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-
 		let document: TextDocument;
 		let testExplorer: GoTestExplorer;
 
 		suiteSetup(async () => {
-			testExplorer = GoTestExplorer.setup(ctx, goCtx);
+			testExplorer = GoTestExplorer.setup(ctx, {});
 
 			const uri = Uri.file(path.join(fixtureDir, 'suite_test.go'));
 			document = await forceDidOpenTextDocument(workspace, testExplorer, uri);
diff --git a/test/integration/goTest.run.test.ts b/test/integration/goTest.run.test.ts
index c4619cf..2e894b1 100644
--- a/test/integration/goTest.run.test.ts
+++ b/test/integration/goTest.run.test.ts
@@ -7,7 +7,6 @@
 import { GoTestExplorer } from '../../src/goTest/explore';
 import { MockExtensionContext } from '../mocks/MockContext';
 import { GoTest } from '../../src/goTest/utils';
-import { GoExtensionContext } from '../../src/context';
 
 suite('Go Test Runner', () => {
 	const fixtureDir = path.join(__dirname, '..', '..', '..', 'test', 'testdata');
@@ -17,17 +16,12 @@
 	suite('Profile', () => {
 		const sandbox = sinon.createSandbox();
 		const ctx = MockExtensionContext.new();
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
 
 		let uri: Uri;
 		let stub: sinon.SinonStub<[testUtils.TestConfig], Promise<boolean>>;
 
 		suiteSetup(async () => {
-			testExplorer = GoTestExplorer.setup(ctx, goCtx);
+			testExplorer = GoTestExplorer.setup(ctx, {});
 
 			uri = Uri.file(path.join(fixtureDir, 'codelens', 'codelens2_test.go'));
 			await forceDidOpenTextDocument(workspace, testExplorer, uri);
@@ -104,17 +98,12 @@
 		const sandbox = sinon.createSandbox();
 		const subTestDir = path.join(fixtureDir, 'subTest');
 		const ctx = MockExtensionContext.new();
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
 
 		let uri: Uri;
 		let spy: sinon.SinonSpy<[testUtils.TestConfig], Promise<boolean>>;
 
 		suiteSetup(async () => {
-			testExplorer = GoTestExplorer.setup(ctx, goCtx);
+			testExplorer = GoTestExplorer.setup(ctx, {});
 
 			uri = Uri.file(path.join(subTestDir, 'sub_test.go'));
 			await forceDidOpenTextDocument(workspace, testExplorer, uri);
diff --git a/test/integration/statusbar.test.ts b/test/integration/statusbar.test.ts
index 0954bfe..9b123d9 100644
--- a/test/integration/statusbar.test.ts
+++ b/test/integration/statusbar.test.ts
@@ -26,17 +26,11 @@
 import { MockMemento } from '../mocks/MockMemento';
 
 import ourutil = require('../../src/util');
-import { GoExtensionContext } from '../../src/context';
 import { setGOROOTEnvVar } from '../../src/goEnv';
 
 describe('#initGoStatusBar()', function () {
 	this.beforeAll(async () => {
-		const goCtx: GoExtensionContext = {
-			lastUserAction: new Date(),
-			crashCount: 0,
-			restartHistory: []
-		};
-		await updateGoVarsFromConfig(goCtx); // should initialize the status bar.
+		await updateGoVarsFromConfig({}); // should initialize the status bar.
 	});
 
 	this.afterAll(() => {