From a26d9f3d16799002e7fe06f091f39d41d122f42e Mon Sep 17 00:00:00 2001 From: Michael Kriese <michael.kriese@visualon.de> Date: Mon, 25 Nov 2019 12:46:21 +0100 Subject: [PATCH] test: fix failing tests (#4870) --- test/datasource/git-tags.spec.ts | 2 +- test/datasource/orb.spec.ts | 3 --- test/platform/git/storage.spec.ts | 14 +++++++------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/test/datasource/git-tags.spec.ts b/test/datasource/git-tags.spec.ts index 7825d74908..c4a447da9b 100644 --- a/test/datasource/git-tags.spec.ts +++ b/test/datasource/git-tags.spec.ts @@ -1,7 +1,7 @@ import _simpleGit from 'simple-git/promise'; import { getPkgReleases } from '../../lib/datasource/git-tags'; -jest.mock('simple-git/promise.js'); +jest.mock('simple-git/promise'); const simpleGit: any = _simpleGit; // const lookupName = 'vapor'; diff --git a/test/datasource/orb.spec.ts b/test/datasource/orb.spec.ts index 6e3227cc9b..4db9ad0bf9 100644 --- a/test/datasource/orb.spec.ts +++ b/test/datasource/orb.spec.ts @@ -2,9 +2,6 @@ import _got from '../../lib/util/got'; import * as datasource from '../../lib/datasource'; jest.mock('../../lib/util/got'); -jest.mock('simple-git', () => { - throw new Error('Test'); -}); const got: any = _got; diff --git a/test/platform/git/storage.spec.ts b/test/platform/git/storage.spec.ts index e4dfefbb6c..d8ad8dde3b 100644 --- a/test/platform/git/storage.spec.ts +++ b/test/platform/git/storage.spec.ts @@ -57,14 +57,14 @@ describe('platform/git/storage', () => { }); }); - afterEach(() => { - tmpDir.cleanup(); - origin.cleanup(); + afterEach(async () => { + await tmpDir.cleanup(); + await origin.cleanup(); git.cleanRepo(); }); - afterAll(() => { - base.cleanup(); + afterAll(async () => { + await base.cleanup(); }); describe('setBaseBranch(branchName)', () => { @@ -96,7 +96,7 @@ describe('platform/git/storage', () => { }); expect(await fs.exists(tmpDir.path + '/.gitmodules')).toBeTruthy(); expect(await git.getFileList()).toMatchSnapshot(); - repo.reset(['--hard', 'HEAD^']); + await repo.reset(['--hard', 'HEAD^']); }); }); describe('branchExists(branchName)', () => { @@ -370,7 +370,7 @@ describe('platform/git/storage', () => { url: base.path, }); expect(await fs.exists(tmpDir.path + '/.gitmodules')).toBeTruthy(); - repo.reset(['--hard', 'HEAD^']); + await repo.reset(['--hard', 'HEAD^']); }); }); }); -- GitLab