diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts
index 9768e68139a81d07fd4849d116729ccb6647af40..cbd92020803d071b8b7366016c0fb6351d3a7677 100644
--- a/lib/platform/azure/index.ts
+++ b/lib/platform/azure/index.ts
@@ -19,6 +19,8 @@ import {
   BranchStatusConfig,
   FindPRConfig,
   EnsureCommentConfig,
+  EnsureIssueResult,
+  BranchStatus,
 } from '../common';
 import { sanitize } from '../../util/sanitize';
 import { smartTruncate } from '../utils/pr-body';
@@ -29,6 +31,7 @@ import {
   BRANCH_STATUS_PENDING,
   BRANCH_STATUS_SUCCESS,
 } from '../../constants/branch-constants';
+import { RenovateConfig } from '../../config';
 
 interface Config {
   storage: GitStorage;
@@ -55,10 +58,7 @@ const defaults: any = {
 export function initPlatform({
   endpoint,
   token,
-}: {
-  endpoint: string;
-  token: string;
-}): PlatformConfig {
+}: RenovateConfig): Promise<PlatformConfig> {
   if (!endpoint) {
     throw new Error('Init: You must configure an Azure DevOps endpoint');
   }
@@ -74,7 +74,7 @@ export function initPlatform({
   const platformConfig: PlatformConfig = {
     endpoint: defaults.endpoint,
   };
-  return platformConfig;
+  return Promise.resolve(platformConfig);
 }
 
 export async function getRepos(): Promise<string[]> {
@@ -163,14 +163,14 @@ export async function initRepo({
   return repoConfig;
 }
 
-export function getRepoForceRebase(): boolean {
-  return false;
+export function getRepoForceRebase(): Promise<boolean> {
+  return Promise.resolve(config.repoForceRebase === true);
 }
 
 // Search
 
 export /* istanbul ignore next */ function getFileList(
-  branchName: string
+  branchName?: string
 ): Promise<string[]> {
   return config.storage.getFileList(branchName);
 }
@@ -389,7 +389,7 @@ export /* istanbul ignore next */ function getCommitMessages(): Promise<
 export async function getBranchStatusCheck(
   branchName: string,
   context?: string
-): Promise<string> {
+): Promise<BranchStatus> {
   logger.trace(`getBranchStatusCheck(${branchName}, ${context})`);
   const azureApiGit = await azureApi.gitApi();
   const branch = await azureApiGit.getBranch(
@@ -405,7 +405,7 @@ export async function getBranchStatusCheck(
 export async function getBranchStatus(
   branchName: string,
   requiredStatusChecks: any
-): Promise<string> {
+): Promise<BranchStatus> {
   logger.debug(`getBranchStatus(${branchName})`);
   if (!requiredStatusChecks) {
     // null means disable status checks, so it always succeeds
@@ -499,7 +499,7 @@ export async function ensureComment({
   number,
   topic,
   content,
-}: EnsureCommentConfig): Promise<void> {
+}: EnsureCommentConfig): Promise<boolean> {
   logger.debug(`ensureComment(${number}, ${topic}, content)`);
   const header = topic ? `### ${topic}\n\n` : '';
   const body = `${header}${sanitize(content)}`;
@@ -554,6 +554,8 @@ export async function ensureComment({
       'Comment is already update-to-date'
     );
   }
+
+  return true;
 }
 
 export async function ensureCommentRemoval(
@@ -591,15 +593,16 @@ export function setBranchStatus({
   description,
   state,
   url: targetUrl,
-}: BranchStatusConfig): void {
+}: BranchStatusConfig): Promise<void> {
   logger.debug(
     `setBranchStatus(${branchName}, ${context}, ${description}, ${state}, ${targetUrl}) - Not supported by Azure DevOps (yet!)`
   );
+  return Promise.resolve();
 }
 
-export async function mergePr(pr: number): Promise<void> {
+export function mergePr(pr: number, branchName: string): Promise<boolean> {
   logger.debug(`mergePr(pr)(${pr}) - Not supported by Azure DevOps (yet!)`);
-  await Promise.resolve();
+  return Promise.resolve(false);
 }
 
 export function getPrBody(input: string): string {
@@ -616,22 +619,24 @@ export function getPrBody(input: string): string {
     .replace('</details>', '');
 }
 
-export /* istanbul ignore next */ function findIssue(): Issue | null {
+export /* istanbul ignore next */ function findIssue(): Promise<Issue | null> {
   logger.warn(`findIssue() is not implemented`);
   return null;
 }
 
-export /* istanbul ignore next */ function ensureIssue(): void {
+export /* istanbul ignore next */ function ensureIssue(): Promise<EnsureIssueResult | null> {
   logger.warn(`ensureIssue() is not implemented`);
+  return Promise.resolve(null);
 }
 
-// eslint-disable-next-line @typescript-eslint/no-empty-function
-export /* istanbul ignore next */ function ensureIssueClosing(): void {}
+export /* istanbul ignore next */ function ensureIssueClosing(): Promise<void> {
+  return Promise.resolve();
+}
 
-export /* istanbul ignore next */ function getIssueList(): Issue[] {
+export /* istanbul ignore next */ function getIssueList(): Promise<Issue[]> {
   logger.debug(`getIssueList()`);
   // TODO: Needs implementation
-  return [];
+  return Promise.resolve([]);
 }
 
 /**
@@ -726,21 +731,22 @@ export /* istanbul ignore next */ async function deleteLabel(
 }
 
 // to become async?
-export function getPrFiles(prNo: number): string[] {
+export function getPrFiles(prNo: number): Promise<string[]> {
   logger.debug(
     `getPrFiles(prNo)(${prNo}) - Not supported by Azure DevOps (yet!)`
   );
-  return [];
+  return Promise.resolve([]);
 }
 
 export function getVulnerabilityAlerts(): Promise<VulnerabilityAlert[]> {
   return Promise.resolve([]);
 }
 
-export function cleanRepo(): void {
+export function cleanRepo(): Promise<void> {
   // istanbul ignore if
   if (config.storage && config.storage.cleanRepo) {
     config.storage.cleanRepo();
   }
   config = {} as any;
+  return Promise.resolve();
 }
diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts
index 1c8a70c1aeabf92a9eb4db2466fd33e876526ca1..d6f35472ab6a928c5750f1b6b29f04e834050d46 100644
--- a/lib/platform/bitbucket-server/index.ts
+++ b/lib/platform/bitbucket-server/index.ts
@@ -18,6 +18,9 @@ import {
   BranchStatusConfig,
   FindPRConfig,
   EnsureCommentConfig,
+  EnsureIssueResult,
+  EnsureIssueConfig,
+  BranchStatus,
 } from '../common';
 import { sanitize } from '../../util/sanitize';
 import { smartTruncate } from '../utils/pr-body';
@@ -33,6 +36,7 @@ import {
   BRANCH_STATUS_PENDING,
   BRANCH_STATUS_SUCCESS,
 } from '../../constants/branch-constants';
+import { RenovateConfig } from '../../config';
 /*
  * Version: 5.3 (EOL Date: 15 Aug 2019)
  * See following docs for api information:
@@ -78,11 +82,7 @@ export function initPlatform({
   endpoint,
   username,
   password,
-}: {
-  endpoint: string;
-  username: string;
-  password: string;
-}): PlatformConfig {
+}: RenovateConfig): Promise<PlatformConfig> {
   if (!endpoint) {
     throw new Error('Init: You must configure a Bitbucket Server endpoint');
   }
@@ -97,7 +97,7 @@ export function initPlatform({
   const platformConfig: PlatformConfig = {
     endpoint: defaults.endpoint,
   };
-  return platformConfig;
+  return Promise.resolve(platformConfig);
 }
 
 // Get all repositories that the user has access to
@@ -119,12 +119,13 @@ export async function getRepos(): Promise<string[]> {
   }
 }
 
-export function cleanRepo(): void {
+export function cleanRepo(): Promise<void> {
   logger.debug(`cleanRepo()`);
   if (config.storage) {
     config.storage.cleanRepo();
   }
   config = {} as any;
+  return Promise.resolve();
 }
 
 // Initialize GitLab by getting base branch
@@ -235,13 +236,13 @@ export async function initRepo({
   }
 }
 
-export function getRepoForceRebase(): boolean {
+export function getRepoForceRebase(): Promise<boolean> {
   logger.debug(`getRepoForceRebase()`);
   // TODO if applicable
   // This function should return true only if the user has enabled a setting on the repo that enforces PRs to be kept up to date with master
   // In such cases we rebase Renovate branches every time they fall behind
   // In GitHub this is part of "branch protection"
-  return false;
+  return Promise.resolve(false);
 }
 
 export async function setBaseBranch(
@@ -525,8 +526,8 @@ async function getStatus(
 // https://docs.atlassian.com/bitbucket-server/rest/6.0.0/bitbucket-build-rest.html#idp2
 export async function getBranchStatus(
   branchName: string,
-  requiredStatusChecks?: string[] | boolean | null
-): Promise<string> {
+  requiredStatusChecks?: string[] | null
+): Promise<BranchStatus> {
   logger.debug(
     `getBranchStatus(${branchName}, requiredStatusChecks=${!!requiredStatusChecks})`
   );
@@ -658,7 +659,7 @@ export async function setBranchStatus({
 
 export /* istanbul ignore next */ function findIssue(
   title: string
-): Issue | null {
+): Promise<Issue | null> {
   logger.debug(`findIssue(${title})`);
   // TODO: Needs implementation
   // This is used by Renovate when creating its own issues, e.g. for deprecated package warnings, config error notifications, or "masterIssue"
@@ -666,10 +667,9 @@ export /* istanbul ignore next */ function findIssue(
   return null;
 }
 
-export /* istanbul ignore next */ function ensureIssue(
-  title: string,
-  body: string
-): Promise<'updated' | 'created' | null> {
+export /* istanbul ignore next */ function ensureIssue({
+  title,
+}: EnsureIssueConfig): Promise<EnsureIssueResult | null> {
   logger.warn({ title }, 'Cannot ensure issue');
   // TODO: Needs implementation
   // This is used by Renovate when creating its own issues, e.g. for deprecated package warnings, config error notifications, or "masterIssue"
diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts
index b357dbdb78049e94f03611f248a8d0fd3603fee4..5c872d33c9055868ce7798c25e151fb410994b6b 100644
--- a/lib/platform/bitbucket/index.ts
+++ b/lib/platform/bitbucket/index.ts
@@ -19,6 +19,8 @@ import {
   BranchStatusConfig,
   FindPRConfig,
   EnsureCommentConfig,
+  EnsureIssueResult,
+  BranchStatus,
 } from '../common';
 import { sanitize } from '../../util/sanitize';
 import { smartTruncate } from '../utils/pr-body';
@@ -32,6 +34,7 @@ import {
   BRANCH_STATUS_PENDING,
   BRANCH_STATUS_SUCCESS,
 } from '../../constants/branch-constants';
+import { RenovateConfig } from '../../config';
 
 let config: utils.Config = {} as any;
 
@@ -39,11 +42,7 @@ export function initPlatform({
   endpoint,
   username,
   password,
-}: {
-  endpoint?: string;
-  username: string;
-  password: string;
-}): PlatformConfig {
+}: RenovateConfig): Promise<PlatformConfig> {
   if (!(username && password)) {
     throw new Error(
       'Init: You must configure a Bitbucket username and password'
@@ -58,7 +57,7 @@ export function initPlatform({
   const platformConfig: PlatformConfig = {
     endpoint: 'https://api.bitbucket.org/',
   };
-  return platformConfig;
+  return Promise.resolve(platformConfig);
 }
 
 // Get all repositories that the user has access to
@@ -156,9 +155,9 @@ export async function initRepo({
 }
 
 // Returns true if repository has rule enforcing PRs are up-to-date with base branch before merging
-export function getRepoForceRebase(): boolean {
+export function getRepoForceRebase(): Promise<boolean> {
   // BB doesnt have an option to flag staled branches
-  return false;
+  return Promise.resolve(false);
 }
 
 // Search
@@ -407,7 +406,7 @@ async function getStatus(
 export async function getBranchStatus(
   branchName: string,
   requiredStatusChecks?: string[]
-): Promise<string> {
+): Promise<BranchStatus> {
   logger.debug(`getBranchStatus(${branchName})`);
   if (!requiredStatusChecks) {
     // null means disable status checks, so it always succeeds
@@ -550,7 +549,7 @@ export function getPrBody(input: string): string {
 export async function ensureIssue({
   title,
   body,
-}: EnsureIssueConfig): Promise<string | null> {
+}: EnsureIssueConfig): Promise<EnsureIssueResult | null> {
   logger.debug(`ensureIssue()`);
   const description = getPrBody(sanitize(body));
 
@@ -827,12 +826,13 @@ export async function mergePr(
 
 // Pull Request
 
-export function cleanRepo(): void {
+export function cleanRepo(): Promise<void> {
   // istanbul ignore if
   if (config.storage && config.storage.cleanRepo) {
     config.storage.cleanRepo();
   }
   config = {} as any;
+  return Promise.resolve();
 }
 
 export function getVulnerabilityAlerts(): Promise<VulnerabilityAlert[]> {
diff --git a/lib/platform/common.ts b/lib/platform/common.ts
index 44c3e554f1fbaeb8ca758b0df438866955cdf891..224bcbd2f25d1e6b3dfe0f37e1617199cdc572ab 100644
--- a/lib/platform/common.ts
+++ b/lib/platform/common.ts
@@ -145,8 +145,10 @@ export interface EnsureCommentConfig {
  */
 export type VulnerabilityAlert = any;
 
+export type EnsureIssueResult = 'updated' | 'created';
+
 export interface Platform {
-  findIssue(title: string): Promise<Issue>;
+  findIssue(title: string): Promise<Issue | null>;
   getIssueList(): Promise<Issue[]>;
   getVulnerabilityAlerts(): Promise<VulnerabilityAlert[]>;
   getCommitMessages(): Promise<string[]>;
@@ -160,7 +162,7 @@ export interface Platform {
   getFileList(): Promise<string[]>;
   ensureIssue(
     issueConfig: EnsureIssueConfig
-  ): Promise<'updated' | 'created' | null>;
+  ): Promise<EnsureIssueResult | null>;
   getPrBody(prBody: string): string;
   updatePr(number: number, prTitle: string, prBody?: string): Promise<void>;
   mergePr(number: number, branchName: string): Promise<boolean>;
diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts
index 37fcc030074e9d9688bb04eba8d2f1a3eb10c7fe..de873490641c246695e532a8c308f2ff9be6b52f 100644
--- a/lib/platform/github/index.ts
+++ b/lib/platform/github/index.ts
@@ -18,6 +18,8 @@ import {
   BranchStatusConfig,
   FindPRConfig,
   EnsureCommentConfig,
+  EnsureIssueResult,
+  BranchStatus,
 } from '../common';
 
 import { configFileNames } from '../../config/app-strings';
@@ -178,13 +180,14 @@ export async function getRepos(): Promise<string[]> {
   }
 }
 
-export function cleanRepo(): void {
+export function cleanRepo(): Promise<void> {
   // istanbul ignore if
   if (config.storage) {
     config.storage.cleanRepo();
   }
   // In theory most of this isn't necessary. In practice..
   config = {} as any;
+  return Promise.resolve();
 }
 
 async function getBranchProtection(
@@ -1054,14 +1057,14 @@ export async function getBranchPr(branchName: string): Promise<Pr | null> {
 
 type BranchState = 'failure' | 'pending' | 'success';
 
-interface BranchStatus {
+interface GhBranchStatus {
   context: string;
   state: BranchState;
 }
 
 interface CombinedBranchStatus {
   state: BranchState;
-  statuses: BranchStatus[];
+  statuses: GhBranchStatus[];
 }
 
 async function getStatus(
@@ -1079,7 +1082,7 @@ async function getStatus(
 export async function getBranchStatus(
   branchName: string,
   requiredStatusChecks: any
-): Promise<string> {
+): Promise<BranchStatus> {
   logger.debug(`getBranchStatus(${branchName})`);
   if (!requiredStatusChecks) {
     // null means disable status checks, so it always succeeds
@@ -1168,7 +1171,7 @@ export async function getBranchStatus(
 async function getStatusCheck(
   branchName: string,
   useCache = true
-): Promise<BranchStatus[]> {
+): Promise<GhBranchStatus[]> {
   const branchCommit = await config.storage.getBranchCommit(branchName);
 
   const url = `repos/${config.repository}/commits/${branchCommit}/statuses`;
@@ -1346,7 +1349,7 @@ export async function ensureIssue({
   body: rawBody,
   once = false,
   shouldReOpen = true,
-}: EnsureIssueConfig): Promise<string | null> {
+}: EnsureIssueConfig): Promise<EnsureIssueResult | null> {
   logger.debug(`ensureIssue(${title})`);
   const body = sanitize(rawBody);
   try {
diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts
index e86f7cb09272855800f4116a8f1833a47f2e2441..49b159d9783357d87ae0c04ca405e7735169cdf1 100644
--- a/lib/platform/gitlab/index.ts
+++ b/lib/platform/gitlab/index.ts
@@ -17,6 +17,7 @@ import {
   BranchStatusConfig,
   FindPRConfig,
   EnsureCommentConfig,
+  BranchStatus,
 } from '../common';
 import { configFileNames } from '../../config/app-strings';
 import { logger } from '../../logger';
@@ -119,13 +120,14 @@ function urlEscape(str: string): string {
   return str ? str.replace(/\//g, '%2F') : str;
 }
 
-export function cleanRepo(): void {
+export function cleanRepo(): Promise<void> {
   // istanbul ignore if
   if (config.storage) {
     config.storage.cleanRepo();
   }
   // In theory most of this isn't necessary. In practice..
   config = {} as any;
+  return Promise.resolve();
 }
 
 // Initialize GitLab by getting base branch
@@ -296,7 +298,7 @@ export function branchExists(branchName: string): Promise<boolean> {
 
 type BranchState = 'pending' | 'running' | 'success' | 'failed' | 'canceled';
 
-interface BranchStatus {
+interface GitlabBranchStatus {
   status: BranchState;
   name: string;
   allow_failure?: boolean;
@@ -305,7 +307,7 @@ interface BranchStatus {
 async function getStatus(
   branchName: string,
   useCache = true
-): Promise<BranchStatus[]> {
+): Promise<GitlabBranchStatus[]> {
   const branchSha = await config.storage.getBranchCommit(branchName);
   const url = `projects/${config.repository}/repository/commits/${branchSha}/statuses`;
 
@@ -316,7 +318,7 @@ async function getStatus(
 export async function getBranchStatus(
   branchName: string,
   requiredStatusChecks?: string[] | null
-): Promise<string> {
+): Promise<BranchStatus> {
   logger.debug(`getBranchStatus(${branchName})`);
   if (!requiredStatusChecks) {
     // null means disable status checks, so it always succeeds
@@ -338,13 +340,13 @@ export async function getBranchStatus(
     // Return 'pending' if we have no status checks
     return BRANCH_STATUS_PENDING;
   }
-  let status = BRANCH_STATUS_SUCCESS;
+  let status: BranchStatus = BRANCH_STATUS_SUCCESS;
   // Return 'success' if all are success
   res.forEach(check => {
     // If one is failed then don't overwrite that
     if (status !== 'failure') {
       if (!check.allow_failure) {
-        if (check.status === 'failed') {
+        if (check.status === 'failed' || check.status === 'canceled') {
           status = BRANCH_STATUS_FAILURE;
         } else if (check.status !== 'success') {
           ({ status } = check);
@@ -870,15 +872,15 @@ export async function ensureComment({
   number,
   topic,
   content,
-}: EnsureCommentConfig): Promise<void> {
+}: EnsureCommentConfig): Promise<boolean> {
   const sanitizedContent = sanitize(content);
   const massagedTopic = topic
     ? topic.replace(/Pull Request/g, 'Merge Request').replace(/PR/g, 'MR')
     : topic;
   const comments = await getComments(number);
   let body: string;
-  let commentId;
-  let commentNeedsUpdating;
+  let commentId: number;
+  let commentNeedsUpdating: boolean;
   if (topic) {
     logger.debug(`Ensuring comment "${massagedTopic}" in #${number}`);
     body = `### ${topic}\n\n${sanitizedContent}`;
@@ -914,6 +916,7 @@ export async function ensureComment({
   } else {
     logger.debug('Comment is already update-to-date');
   }
+  return true;
 }
 
 export async function ensureCommentRemoval(
@@ -922,7 +925,7 @@ export async function ensureCommentRemoval(
 ): Promise<void> {
   logger.debug(`Ensuring comment "${topic}" in #${issueNo} is removed`);
   const comments = await getComments(issueNo);
-  let commentId;
+  let commentId: number;
   comments.forEach((comment: { body: string; id: number }) => {
     if (comment.body.startsWith(`### ${topic}\n\n`)) {
       commentId = comment.id;
diff --git a/test/platform/azure/index.spec.ts b/test/platform/azure/index.spec.ts
index 5ea357bb3851d88a93bdb899660cfd7b7d4ad68c..fc690a14f130f02cacb2b7990d65f1cc60942f94 100644
--- a/test/platform/azure/index.spec.ts
+++ b/test/platform/azure/index.spec.ts
@@ -1,6 +1,6 @@
 import is from '@sindresorhus/is';
 import * as _hostRules from '../../../lib/util/host-rules';
-import { RepoParams } from '../../../lib/platform/common';
+import { RepoParams, Platform } from '../../../lib/platform/common';
 import { REPOSITORY_DISABLED } from '../../../lib/constants/error-messages';
 import {
   BRANCH_STATUS_FAILED,
@@ -10,11 +10,11 @@ import {
 
 describe('platform/azure', () => {
   let hostRules: jest.Mocked<typeof _hostRules>;
-  let azure: jest.Mocked<typeof import('../../../lib/platform/azure')>;
+  let azure: Platform;
   let azureApi: jest.Mocked<typeof import('../../../lib/platform/azure/azure-got-wrapper')>;
   let azureHelper: jest.Mocked<typeof import('../../../lib/platform/azure/azure-helper')>;
   let GitStorage;
-  beforeEach(() => {
+  beforeEach(async () => {
     // reset module
     jest.resetModules();
     jest.mock('../../../lib/platform/azure/azure-got-wrapper');
@@ -23,7 +23,7 @@ describe('platform/azure', () => {
     jest.mock('../../../lib/util/host-rules');
     hostRules = require('../../../lib/util/host-rules');
     require('../../../lib/util/sanitize').sanitize = jest.fn(input => input);
-    azure = require('../../../lib/platform/azure');
+    azure = await import('../../../lib/platform/azure');
     azureApi = require('../../../lib/platform/azure/azure-got-wrapper');
     azureHelper = require('../../../lib/platform/azure/azure-helper');
     GitStorage = require('../../../lib/platform/git/storage').Storage;
@@ -46,7 +46,7 @@ describe('platform/azure', () => {
     hostRules.find.mockReturnValue({
       token: 'token',
     });
-    azure.initPlatform({
+    await azure.initPlatform({
       endpoint: 'https://dev.azure.com/renovate12345',
       token: 'token',
     });
@@ -83,20 +83,20 @@ describe('platform/azure', () => {
 
   describe('initPlatform()', () => {
     it('should throw if no endpoint', () => {
-      expect(() => {
-        azure.initPlatform({} as any);
-      }).toThrow();
+      expect.assertions(1);
+      expect(() => azure.initPlatform({})).toThrow();
     });
     it('should throw if no token', () => {
-      expect(() => {
+      expect.assertions(1);
+      expect(() =>
         azure.initPlatform({
           endpoint: 'https://dev.azure.com/renovate12345',
-        } as any);
-      }).toThrow();
+        })
+      ).toThrow();
     });
-    it('should init', () => {
+    it('should init', async () => {
       expect(
-        azure.initPlatform({
+        await azure.initPlatform({
           endpoint: 'https://dev.azure.com/renovate12345',
           token: 'token',
         })
@@ -170,8 +170,8 @@ describe('platform/azure', () => {
   });
 
   describe('cleanRepo()', () => {
-    it('exists', () => {
-      azure.cleanRepo();
+    it('exists', async () => {
+      await azure.cleanRepo();
     });
   });
 
@@ -194,8 +194,8 @@ describe('platform/azure', () => {
   });
 
   describe('getRepoForceRebase', () => {
-    it('should return false', () => {
-      expect(azure.getRepoForceRebase()).toBe(false);
+    it('should return false', async () => {
+      expect(await azure.getRepoForceRebase()).toBe(false);
     });
   });
 
@@ -851,8 +851,8 @@ describe('platform/azure', () => {
   });
 
   describe('Not supported by Azure DevOps (yet!)', () => {
-    it('setBranchStatus', () => {
-      const res = azure.setBranchStatus({
+    it('setBranchStatus', async () => {
+      const res = await azure.setBranchStatus({
         branchName: 'test',
         context: 'test',
         description: 'test',
@@ -863,13 +863,13 @@ describe('platform/azure', () => {
     });
 
     it('mergePr', async () => {
-      const res = await azure.mergePr(0);
-      expect(res).toBeUndefined();
+      const res = await azure.mergePr(0, undefined);
+      expect(res).toBe(false);
     });
 
     // to become async?
-    it('getPrFiles', () => {
-      const res = azure.getPrFiles(46);
+    it('getPrFiles', async () => {
+      const res = await azure.getPrFiles(46);
       expect(res).toHaveLength(0);
     });
   });
diff --git a/test/platform/bitbucket-server/index.spec.ts b/test/platform/bitbucket-server/index.spec.ts
index b28b1d4ec6fcd0139cbc190e8eb7c8e85b86c217..a684667907b24549232b4ff3a35bdc882674faa8 100644
--- a/test/platform/bitbucket-server/index.spec.ts
+++ b/test/platform/bitbucket-server/index.spec.ts
@@ -1,5 +1,5 @@
 import responses from './_fixtures/responses';
-import { GotApi, RepoParams } from '../../../lib/platform/common';
+import { GotApi, RepoParams, Platform } from '../../../lib/platform/common';
 import { Storage } from '../../../lib/platform/git/storage';
 import {
   REPOSITORY_CHANGED,
@@ -13,18 +13,16 @@ import {
   BRANCH_STATUS_SUCCESS,
 } from '../../../lib/constants/branch-constants';
 
-type BbsApi = typeof import('../../../lib/platform/bitbucket-server');
-
 describe('platform/bitbucket-server', () => {
   Object.entries(responses).forEach(([scenarioName, mockResponses]) => {
     describe(scenarioName, () => {
-      let bitbucket: BbsApi;
+      let bitbucket: Platform;
       let api: jest.Mocked<GotApi>;
       let hostRules: jest.Mocked<typeof import('../../../lib/util/host-rules')>;
       let GitStorage: jest.Mock<Storage> & {
         getUrl: jest.MockInstance<any, any>;
       };
-      beforeEach(() => {
+      beforeEach(async () => {
         // reset module
         jest.resetModules();
         jest.mock('delay');
@@ -51,7 +49,7 @@ describe('platform/bitbucket-server', () => {
         jest.spyOn(api, 'post');
         jest.spyOn(api, 'put');
         jest.spyOn(api, 'delete');
-        bitbucket = require('../../../lib/platform/bitbucket-server');
+        bitbucket = await import('../../../lib/platform/bitbucket-server');
         GitStorage = require('../../../lib/platform/git/storage').Storage;
         GitStorage.mockImplementation(
           () =>
@@ -83,15 +81,15 @@ describe('platform/bitbucket-server', () => {
           username: 'abc',
           password: '123',
         });
-        bitbucket.initPlatform({
+        await bitbucket.initPlatform({
           endpoint,
           username: 'abc',
           password: '123',
         });
       });
 
-      afterEach(() => {
-        bitbucket.cleanRepo();
+      afterEach(async () => {
+        await bitbucket.cleanRepo();
       });
 
       function initRepo(config?: Partial<RepoParams>) {
@@ -104,18 +102,18 @@ describe('platform/bitbucket-server', () => {
 
       describe('initPlatform()', () => {
         it('should throw if no endpoint', () => {
-          expect(() => {
-            bitbucket.initPlatform({} as any);
-          }).toThrow();
+          expect.assertions(1);
+          expect(() => bitbucket.initPlatform({})).toThrow();
         });
         it('should throw if no username/password', () => {
-          expect(() => {
-            bitbucket.initPlatform({ endpoint: 'endpoint' } as any);
-          }).toThrow();
+          expect.assertions(1);
+          expect(() =>
+            bitbucket.initPlatform({ endpoint: 'endpoint' })
+          ).toThrow();
         });
-        it('should init', () => {
+        it('should init', async () => {
           expect(
-            bitbucket.initPlatform({
+            await bitbucket.initPlatform({
               endpoint: 'https://stash.renovatebot.com',
               username: 'abc',
               password: '123',
@@ -164,9 +162,9 @@ describe('platform/bitbucket-server', () => {
       });
 
       describe('repoForceRebase()', () => {
-        it('always return false, since bitbucket does not support force rebase', () => {
+        it('always return false, since bitbucket does not support force rebase', async () => {
           expect.assertions(1);
-          const actual = bitbucket.getRepoForceRebase();
+          const actual = await bitbucket.getRepoForceRebase();
           expect(actual).toBe(false);
         });
       });
@@ -479,7 +477,7 @@ describe('platform/bitbucket-server', () => {
           expect.assertions(2);
           await initRepo();
           expect(
-            await bitbucket.getBranchPr('userName1/pullRequest5', false)
+            await bitbucket.getBranchPr('userName1/pullRequest5')
           ).toMatchSnapshot();
           expect(api.get.mock.calls).toMatchSnapshot();
         });
@@ -788,7 +786,7 @@ Followed by some information.
           } as any);
 
           await expect(
-            bitbucket.getBranchStatus('somebranch', true)
+            bitbucket.getBranchStatus('somebranch', [])
           ).resolves.toEqual(BRANCH_STATUS_SUCCESS);
 
           await expect(
@@ -810,7 +808,7 @@ Followed by some information.
           } as any);
 
           await expect(
-            bitbucket.getBranchStatus('somebranch', true)
+            bitbucket.getBranchStatus('somebranch', [])
           ).resolves.toEqual(BRANCH_STATUS_PENDING);
 
           api.get.mockReturnValueOnce({
@@ -822,7 +820,7 @@ Followed by some information.
           } as any);
 
           await expect(
-            bitbucket.getBranchStatus('somebranch', true)
+            bitbucket.getBranchStatus('somebranch', [])
           ).resolves.toEqual(BRANCH_STATUS_PENDING);
 
           expect(api.get.mock.calls).toMatchSnapshot();
@@ -841,7 +839,7 @@ Followed by some information.
           } as any);
 
           await expect(
-            bitbucket.getBranchStatus('somebranch', true)
+            bitbucket.getBranchStatus('somebranch', [])
           ).resolves.toEqual(BRANCH_STATUS_FAILED);
 
           api.get.mockImplementationOnce(() => {
@@ -849,7 +847,7 @@ Followed by some information.
           });
 
           await expect(
-            bitbucket.getBranchStatus('somebranch', true)
+            bitbucket.getBranchStatus('somebranch', [])
           ).resolves.toEqual(BRANCH_STATUS_FAILED);
 
           expect(api.get.mock.calls).toMatchSnapshot();
@@ -867,7 +865,7 @@ Followed by some information.
           );
           await initRepo();
           await expect(
-            bitbucket.getBranchStatus('somebranch', true)
+            bitbucket.getBranchStatus('somebranch', [])
           ).rejects.toThrow(REPOSITORY_CHANGED);
         });
       });
diff --git a/test/platform/bitbucket/index.spec.ts b/test/platform/bitbucket/index.spec.ts
index a641900d1df52b615540d85a243adaf090246138..bd7407738a7c973d2276f830b12410cb764c656f 100644
--- a/test/platform/bitbucket/index.spec.ts
+++ b/test/platform/bitbucket/index.spec.ts
@@ -1,6 +1,6 @@
 import URL from 'url';
 import responses from './_fixtures/responses';
-import { GotApi, RepoParams } from '../../../lib/platform/common';
+import { GotApi, RepoParams, Platform } from '../../../lib/platform/common';
 import { REPOSITORY_DISABLED } from '../../../lib/constants/error-messages';
 import {
   BRANCH_STATUS_FAILED,
@@ -9,14 +9,14 @@ import {
 } from '../../../lib/constants/branch-constants';
 
 describe('platform/bitbucket', () => {
-  let bitbucket: typeof import('../../../lib/platform/bitbucket');
+  let bitbucket: Platform;
   let api: jest.Mocked<GotApi>;
   let hostRules: jest.Mocked<typeof import('../../../lib/util/host-rules')>;
   let GitStorage: jest.Mocked<
     import('../../../lib/platform/git/storage').Storage
   > &
     jest.Mock;
-  beforeEach(() => {
+  beforeEach(async () => {
     // reset module
     jest.resetModules();
     jest.mock('../../../lib/platform/bitbucket/bb-got-wrapper');
@@ -24,7 +24,7 @@ describe('platform/bitbucket', () => {
     jest.mock('../../../lib/util/host-rules');
     hostRules = require('../../../lib/util/host-rules');
     api = require('../../../lib/platform/bitbucket/bb-got-wrapper').api;
-    bitbucket = require('../../../lib/platform/bitbucket');
+    bitbucket = await import('../../../lib/platform/bitbucket');
     GitStorage = require('../../../lib/platform/git/storage').Storage;
     GitStorage.mockImplementation(() => ({
       initRepo: jest.fn(),
@@ -90,22 +90,22 @@ describe('platform/bitbucket', () => {
 
   describe('initPlatform()', () => {
     it('should throw if no username/password', () => {
-      expect(() => {
-        bitbucket.initPlatform({} as any);
-      }).toThrow();
+      expect.assertions(1);
+      expect(() => bitbucket.initPlatform({})).toThrow();
     });
     it('should throw if wrong endpoint', () => {
-      expect(() => {
+      expect.assertions(1);
+      expect(() =>
         bitbucket.initPlatform({
           endpoint: 'endpoint',
           username: 'abc',
           password: '123',
-        });
-      }).toThrow();
+        })
+      ).toThrow();
     });
-    it('should init', () => {
+    it('should init', async () => {
       expect(
-        bitbucket.initPlatform({
+        await bitbucket.initPlatform({
           username: 'abc',
           password: '123',
         })
@@ -138,8 +138,8 @@ describe('platform/bitbucket', () => {
   });
 
   describe('getRepoForceRebase()', () => {
-    it('always return false, since bitbucket does not support force rebase', () => {
-      const actual = bitbucket.getRepoForceRebase();
+    it('always return false, since bitbucket does not support force rebase', async () => {
+      const actual = await bitbucket.getRepoForceRebase();
       expect(actual).toBe(false);
     });
   });
diff --git a/test/platform/gitea/index.spec.ts b/test/platform/gitea/index.spec.ts
index a280c96a1f3b976e83463cff008b069dcb1b6c42..f1576b783aa2b7f811ad2a0cfc0a50a310d2170b 100644
--- a/test/platform/gitea/index.spec.ts
+++ b/test/platform/gitea/index.spec.ts
@@ -15,6 +15,7 @@ import {
   GotResponse,
   RepoConfig,
   RepoParams,
+  Platform,
 } from '../../../lib/platform';
 import { logger as _logger } from '../../../lib/logger';
 import {
@@ -26,7 +27,7 @@ import { GiteaGotApi } from '../../../lib/platform/gitea/gitea-got-wrapper';
 import { CommitFilesConfig, File } from '../../../lib/platform/git/storage';
 
 describe('platform/gitea', () => {
-  let gitea: typeof import('../../../lib/platform/gitea');
+  let gitea: Platform;
   let helper: jest.Mocked<typeof import('../../../lib/platform/gitea/gitea-helper')>;
   let api: jest.Mocked<GiteaGotApi>;
   let logger: jest.Mocked<typeof _logger>;
diff --git a/test/platform/github/index.spec.ts b/test/platform/github/index.spec.ts
index 66557f198aa5d1ea25b282b0ba90edc42d8abc6b..7d499b25e5a7cd7e1a9979411d8565a03f8dfa74 100644
--- a/test/platform/github/index.spec.ts
+++ b/test/platform/github/index.spec.ts
@@ -1,5 +1,10 @@
 import fs from 'fs-extra';
-import { GotApi, GotResponse, RepoConfig } from '../../../lib/platform/common';
+import {
+  GotApi,
+  GotResponse,
+  RepoConfig,
+  Platform,
+} from '../../../lib/platform/common';
 import {
   REPOSITORY_DISABLED,
   REPOSITORY_NOT_FOUND,
@@ -10,9 +15,10 @@ import {
   BRANCH_STATUS_PENDING,
   BRANCH_STATUS_SUCCESS,
 } from '../../../lib/constants/branch-constants';
+import { mocked } from '../../util';
 
 describe('platform/github', () => {
-  let github: typeof import('../../../lib/platform/github');
+  let github: Platform;
   let api: jest.Mocked<GotApi>;
   let got: jest.Mock<Promise<Partial<GotResponse>>>;
   let hostRules: jest.Mocked<typeof import('../../../lib/util/host-rules')>;
@@ -25,11 +31,12 @@ describe('platform/github', () => {
     jest.mock('../../../lib/platform/github/gh-got-wrapper');
     jest.mock('../../../lib/util/host-rules');
     jest.mock('../../../lib/util/got');
-    api = (await import('../../../lib/platform/github/gh-got-wrapper'))
-      .api as any;
+    api = mocked(
+      (await import('../../../lib/platform/github/gh-got-wrapper')).api
+    );
     got = (await import('../../../lib/util/got')).default as any;
     github = await import('../../../lib/platform/github');
-    hostRules = (await import('../../../lib/util/host-rules')) as any;
+    hostRules = mocked(await import('../../../lib/util/host-rules'));
     jest.mock('../../../lib/platform/git/storage');
     GitStorage = (await import('../../../lib/platform/git/storage'))
       .Storage as any;
diff --git a/test/platform/gitlab/index.spec.ts b/test/platform/gitlab/index.spec.ts
index 50dd26aee63f23500fc80adcec093df7b95928f9..3f24ec90cf4b10b9fb3cf44d370fdbb234241437 100644
--- a/test/platform/gitlab/index.spec.ts
+++ b/test/platform/gitlab/index.spec.ts
@@ -23,12 +23,12 @@ describe('platform/gitlab', () => {
     typeof import('../../../lib/platform/git/storage')
   > &
     jest.Mock;
-  beforeEach(() => {
+  beforeEach(async () => {
     // reset module
     jest.resetModules();
     jest.resetAllMocks();
     jest.mock('../../../lib/platform/gitlab/gl-got-wrapper');
-    gitlab = require('../../../lib/platform/gitlab');
+    gitlab = await import('../../../lib/platform/gitlab');
     api = require('../../../lib/platform/gitlab/gl-got-wrapper').api;
     jest.mock('../../../lib/util/host-rules');
     hostRules = require('../../../lib/util/host-rules');