diff --git a/lib/manager/composer/artifacts.spec.ts b/lib/manager/composer/artifacts.spec.ts index 60033b5845c38d..1488b1ee350f76 100644 --- a/lib/manager/composer/artifacts.spec.ts +++ b/lib/manager/composer/artifacts.spec.ts @@ -2,7 +2,7 @@ import { exec as _exec } from 'child_process'; import { join } from 'upath'; import { envMock, mockExecAll } from '../../../test/execUtil'; import { mocked, platform } from '../../../test/util'; -import { StatusResult } from '../../platform/git/storage'; +import { StatusResult } from '../../platform/git'; import { setUtilConfig } from '../../util'; import { BinarySource } from '../../util/exec/common'; import * as docker from '../../util/exec/docker'; diff --git a/lib/manager/gomod/artifacts.spec.ts b/lib/manager/gomod/artifacts.spec.ts index 22914528c80993..dec48a418b69f4 100644 --- a/lib/manager/gomod/artifacts.spec.ts +++ b/lib/manager/gomod/artifacts.spec.ts @@ -3,7 +3,7 @@ import _fs from 'fs-extra'; import { join } from 'upath'; import { envMock, mockExecAll } from '../../../test/execUtil'; import { mocked, platform } from '../../../test/util'; -import { StatusResult } from '../../platform/git/storage'; +import { StatusResult } from '../../platform/git'; import { setUtilConfig } from '../../util'; import { BinarySource } from '../../util/exec/common'; import * as docker from '../../util/exec/docker'; diff --git a/lib/manager/pipenv/artifacts.spec.ts b/lib/manager/pipenv/artifacts.spec.ts index 5b176f7f10cfaf..084f94254b66fb 100644 --- a/lib/manager/pipenv/artifacts.spec.ts +++ b/lib/manager/pipenv/artifacts.spec.ts @@ -3,7 +3,7 @@ import _fs from 'fs-extra'; import { join } from 'upath'; import { envMock, mockExecAll } from '../../../test/execUtil'; import { mocked, platform } from '../../../test/util'; -import { StatusResult } from '../../platform/git/storage'; +import { StatusResult } from '../../platform/git'; import { setUtilConfig } from '../../util'; import { BinarySource } from '../../util/exec/common'; import * as docker from '../../util/exec/docker'; diff --git a/lib/platform/azure/index.spec.ts b/lib/platform/azure/index.spec.ts index ae79418894ebb3..16aba35f38bdcd 100644 --- a/lib/platform/azure/index.spec.ts +++ b/lib/platform/azure/index.spec.ts @@ -15,14 +15,14 @@ describe('platform/azure', () => { jest.resetModules(); jest.mock('./azure-got-wrapper'); jest.mock('./azure-helper'); - jest.mock('../git/storage'); + jest.mock('../git'); jest.mock('../../util/host-rules'); hostRules = require('../../util/host-rules'); require('../../util/sanitize').sanitize = jest.fn((input) => input); azure = await import('.'); azureApi = require('./azure-got-wrapper'); azureHelper = require('./azure-helper'); - GitStorage = require('../git/storage').Storage; + GitStorage = require('../git').Storage; GitStorage.mockImplementation(() => ({ initRepo: jest.fn(), cleanRepo: jest.fn(), diff --git a/lib/platform/azure/index.ts b/lib/platform/azure/index.ts index f2e24997fbef57..af4f87ec9f1563 100644 --- a/lib/platform/azure/index.ts +++ b/lib/platform/azure/index.ts @@ -31,7 +31,7 @@ import { RepoParams, VulnerabilityAlert, } from '../common'; -import GitStorage, { StatusResult } from '../git/storage'; +import GitStorage, { StatusResult } from '../git'; import { smartTruncate } from '../utils/pr-body'; import * as azureApi from './azure-got-wrapper'; import * as azureHelper from './azure-helper'; diff --git a/lib/platform/bitbucket-server/index.spec.ts b/lib/platform/bitbucket-server/index.spec.ts index 5a824b49d9bd9a..9b147416b53a13 100644 --- a/lib/platform/bitbucket-server/index.spec.ts +++ b/lib/platform/bitbucket-server/index.spec.ts @@ -8,7 +8,7 @@ import { import { PR_STATE_CLOSED, PR_STATE_OPEN } from '../../constants/pull-requests'; import { BranchStatus } from '../../types'; import { Platform } from '../common'; -import { Storage } from '../git/storage'; +import { Storage } from '../git'; function repoMock( endpoint: URL | string, @@ -174,11 +174,11 @@ describe('platform/bitbucket-server', () => { httpMock.reset(); httpMock.setup(); jest.mock('delay'); - jest.mock('../git/storage'); + jest.mock('../git'); jest.mock('../../util/host-rules'); hostRules = require('../../util/host-rules'); bitbucket = await import('.'); - GitStorage = require('../git/storage').Storage; + GitStorage = require('../git').Storage; GitStorage.mockImplementation( () => ({ diff --git a/lib/platform/bitbucket-server/index.ts b/lib/platform/bitbucket-server/index.ts index 3dbf30082c510c..106e20ad4e6b3e 100644 --- a/lib/platform/bitbucket-server/index.ts +++ b/lib/platform/bitbucket-server/index.ts @@ -34,7 +34,7 @@ import { RepoParams, VulnerabilityAlert, } from '../common'; -import GitStorage, { StatusResult } from '../git/storage'; +import GitStorage, { StatusResult } from '../git'; import { smartTruncate } from '../utils/pr-body'; import { BbbsRestPr, BbsConfig, BbsPr, BbsRestUserRef } from './types'; import * as utils from './utils'; diff --git a/lib/platform/bitbucket-server/types.ts b/lib/platform/bitbucket-server/types.ts index aafd4b7dbac115..db1c5abf0ce470 100644 --- a/lib/platform/bitbucket-server/types.ts +++ b/lib/platform/bitbucket-server/types.ts @@ -1,5 +1,5 @@ import { Pr } from '../common'; -import GitStorage from '../git/storage'; +import GitStorage from '../git'; export interface BbsConfig { baseBranch: string; diff --git a/lib/platform/bitbucket/index.spec.ts b/lib/platform/bitbucket/index.spec.ts index 55effefbe7e511..d9e266459a12ff 100644 --- a/lib/platform/bitbucket/index.spec.ts +++ b/lib/platform/bitbucket/index.spec.ts @@ -47,20 +47,20 @@ const commits = { describe('platform/bitbucket', () => { let bitbucket: Platform; let hostRules: jest.Mocked; - let GitStorage: jest.Mocked & jest.Mock; + let GitStorage: jest.Mocked & jest.Mock; let logger: jest.Mocked; beforeEach(async () => { // reset module jest.resetModules(); httpMock.reset(); httpMock.setup(); - jest.mock('../git/storage'); + jest.mock('../git'); jest.mock('../../util/host-rules'); jest.mock('../../logger'); hostRules = require('../../util/host-rules'); bitbucket = await import('.'); logger = (await import('../../logger')).logger as any; - GitStorage = require('../git/storage').Storage; + GitStorage = require('../git').Storage; GitStorage.mockImplementation(() => ({ initRepo: jest.fn(), cleanRepo: jest.fn(), diff --git a/lib/platform/bitbucket/index.ts b/lib/platform/bitbucket/index.ts index cd5b87a0f3187a..903a66b65cf754 100644 --- a/lib/platform/bitbucket/index.ts +++ b/lib/platform/bitbucket/index.ts @@ -29,7 +29,7 @@ import { RepoParams, VulnerabilityAlert, } from '../common'; -import GitStorage, { StatusResult } from '../git/storage'; +import GitStorage, { StatusResult } from '../git'; import { smartTruncate } from '../utils/pr-body'; import { readOnlyIssueBody } from '../utils/read-only-issue-body'; import * as comments from './comments'; diff --git a/lib/platform/bitbucket/utils.ts b/lib/platform/bitbucket/utils.ts index 8e3185d90a06d6..0c4e6b4a5d6b9f 100644 --- a/lib/platform/bitbucket/utils.ts +++ b/lib/platform/bitbucket/utils.ts @@ -4,7 +4,7 @@ import { BranchStatus } from '../../types'; import { HttpResponse } from '../../util/http'; import { BitbucketHttp } from '../../util/http/bitbucket'; import { Pr } from '../common'; -import { Storage } from '../git/storage'; +import { Storage } from '../git'; const bitbucketHttp = new BitbucketHttp(); diff --git a/lib/platform/git/__snapshots__/index.spec.ts.snap b/lib/platform/git/__snapshots__/index.spec.ts.snap new file mode 100644 index 00000000000000..f068e0bb58571a --- /dev/null +++ b/lib/platform/git/__snapshots__/index.spec.ts.snap @@ -0,0 +1,59 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`platform/git getBranchCommit(branchName) should throw if branch does not exist 1`] = `[Error: Cannot fetch commit for branch that does not exist: not_found]`; + +exports[`platform/git getBranchFiles(branchName, baseBranchName?) detects changed files 1`] = ` +Array [ + "some-new-file", +] +`; + +exports[`platform/git getBranchFiles(branchName, baseBranchName?) detects changed files compared to current base branch 1`] = ` +Array [ + "some-new-file", +] +`; + +exports[`platform/git getCommitMessages() returns commit messages 1`] = ` +Array [ + "master message", + "past message", +] +`; + +exports[`platform/git getFile(filePath, branchName) returns null for 404 1`] = `[Error: repository-changed]`; + +exports[`platform/git getFileList() should exclude submodules 1`] = ` +Array [ + ".gitmodules", + "file_to_delete", + "master_file", + "past_file", +] +`; + +exports[`platform/git getFileList() should return the correct files 1`] = ` +Array [ + "file_to_delete", + "master_file", + "past_file", +] +`; + +exports[`platform/git initRepo()) should fetch latest 1`] = ` +Array [ + "master message", + "past message", +] +`; + +exports[`platform/git initRepo()) should fetch latest 2`] = ` +Array [ + "past message2", + "master message", +] +`; + +exports[`platform/git isBranchStale() should throw if branch does not exist 1`] = `[Error: Cannot check staleness for branch that does not exist: not_found]`; + +exports[`platform/git setBaseBranch(branchName) should throw if branch does not exist 1`] = `[Error: config-validation]`; diff --git a/lib/platform/git/__snapshots__/storage.spec.ts.snap b/lib/platform/git/__snapshots__/storage.spec.ts.snap deleted file mode 100644 index 6d93d316576d08..00000000000000 --- a/lib/platform/git/__snapshots__/storage.spec.ts.snap +++ /dev/null @@ -1,59 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`platform/git/storage getBranchCommit(branchName) should throw if branch does not exist 1`] = `[Error: Cannot fetch commit for branch that does not exist: not_found]`; - -exports[`platform/git/storage getBranchFiles(branchName, baseBranchName?) detects changed files 1`] = ` -Array [ - "some-new-file", -] -`; - -exports[`platform/git/storage getBranchFiles(branchName, baseBranchName?) detects changed files compared to current base branch 1`] = ` -Array [ - "some-new-file", -] -`; - -exports[`platform/git/storage getCommitMessages() returns commit messages 1`] = ` -Array [ - "master message", - "past message", -] -`; - -exports[`platform/git/storage getFile(filePath, branchName) returns null for 404 1`] = `[Error: repository-changed]`; - -exports[`platform/git/storage getFileList() should exclude submodules 1`] = ` -Array [ - ".gitmodules", - "file_to_delete", - "master_file", - "past_file", -] -`; - -exports[`platform/git/storage getFileList() should return the correct files 1`] = ` -Array [ - "file_to_delete", - "master_file", - "past_file", -] -`; - -exports[`platform/git/storage initRepo()) should fetch latest 1`] = ` -Array [ - "master message", - "past message", -] -`; - -exports[`platform/git/storage initRepo()) should fetch latest 2`] = ` -Array [ - "past message2", - "master message", -] -`; - -exports[`platform/git/storage isBranchStale() should throw if branch does not exist 1`] = `[Error: Cannot check staleness for branch that does not exist: not_found]`; - -exports[`platform/git/storage setBaseBranch(branchName) should throw if branch does not exist 1`] = `[Error: config-validation]`; diff --git a/lib/platform/git/storage.spec.ts b/lib/platform/git/index.spec.ts similarity index 99% rename from lib/platform/git/storage.spec.ts rename to lib/platform/git/index.spec.ts index 7e1efd4a935c1c..6aa6a32cdd5aaa 100644 --- a/lib/platform/git/storage.spec.ts +++ b/lib/platform/git/index.spec.ts @@ -1,9 +1,9 @@ import fs from 'fs-extra'; import Git from 'simple-git/promise'; import tmp from 'tmp-promise'; -import GitStorage from './storage'; +import GitStorage from '.'; -describe('platform/git/storage', () => { +describe('platform/git', () => { jest.setTimeout(15000); const git = new GitStorage(); diff --git a/lib/platform/git/storage.ts b/lib/platform/git/index.ts similarity index 100% rename from lib/platform/git/storage.ts rename to lib/platform/git/index.ts diff --git a/lib/platform/gitea/index.spec.ts b/lib/platform/gitea/index.spec.ts index b44eddadda5a26..3479e56952e268 100644 --- a/lib/platform/gitea/index.spec.ts +++ b/lib/platform/gitea/index.spec.ts @@ -25,8 +25,7 @@ describe('platform/gitea', () => { let gitea: Platform; let helper: jest.Mocked; let logger: jest.Mocked; - let GitStorage: jest.Mocked & - jest.Mock; + let GitStorage: jest.Mocked & jest.Mock; const mockCommitHash = '0d9c7726c3d628b7e28af234595cfd20febdbf8e'; @@ -174,13 +173,13 @@ describe('platform/gitea', () => { jest.resetModules(); jest.clearAllMocks(); jest.mock('./gitea-helper'); - jest.mock('../git/storage'); + jest.mock('../git'); jest.mock('../../logger'); gitea = await import('.'); helper = (await import('./gitea-helper')) as any; logger = (await import('../../logger')).logger as any; - GitStorage = (await import('../git/storage')).Storage as any; + GitStorage = (await import('../git')).Storage as any; GitStorage.mockImplementation(() => ({ initRepo: gsmInitRepo, diff --git a/lib/platform/gitea/index.ts b/lib/platform/gitea/index.ts index 9552a8e3fe6cc4..9bfe2e72e592b5 100644 --- a/lib/platform/gitea/index.ts +++ b/lib/platform/gitea/index.ts @@ -34,7 +34,7 @@ import { RepoParams, VulnerabilityAlert, } from '../common'; -import GitStorage, { StatusResult } from '../git/storage'; +import GitStorage, { StatusResult } from '../git'; import { smartTruncate } from '../utils/pr-body'; import * as helper from './gitea-helper'; diff --git a/lib/platform/github/index.spec.ts b/lib/platform/github/index.spec.ts index 567eaadfe7a7d8..ce5cf336c7b87e 100644 --- a/lib/platform/github/index.spec.ts +++ b/lib/platform/github/index.spec.ts @@ -14,7 +14,7 @@ const githubApiHost = 'https://api.github.com'; describe('platform/github', () => { let github: Platform; let hostRules: jest.Mocked; - let GitStorage: jest.Mock; + let GitStorage: jest.Mock; beforeEach(async () => { // reset module jest.resetModules(); @@ -23,8 +23,8 @@ describe('platform/github', () => { jest.mock('../../util/host-rules'); github = await import('.'); hostRules = mocked(await import('../../util/host-rules')); - jest.mock('../git/storage'); - GitStorage = (await import('../git/storage')).Storage as any; + jest.mock('../git'); + GitStorage = (await import('../git')).Storage as any; GitStorage.mockImplementation( () => ({ diff --git a/lib/platform/github/index.ts b/lib/platform/github/index.ts index d45a87d29a569a..3d6381109e32ac 100644 --- a/lib/platform/github/index.ts +++ b/lib/platform/github/index.ts @@ -44,7 +44,7 @@ import { RepoParams, VulnerabilityAlert, } from '../common'; -import GitStorage, { StatusResult } from '../git/storage'; +import GitStorage, { StatusResult } from '../git'; import { smartTruncate } from '../utils/pr-body'; import { BranchProtection, diff --git a/lib/platform/github/types.ts b/lib/platform/github/types.ts index 1dad39f300c757..7c8948b3d91a02 100644 --- a/lib/platform/github/types.ts +++ b/lib/platform/github/types.ts @@ -1,5 +1,5 @@ import { Pr } from '../common'; -import GitStorage from '../git/storage'; +import GitStorage from '../git'; // https://developer.github.com/v3/repos/statuses // https://developer.github.com/v3/checks/runs/ diff --git a/lib/platform/gitlab/index.spec.ts b/lib/platform/gitlab/index.spec.ts index 4fdfdf8cd0afb5..6341c5760e3dbd 100644 --- a/lib/platform/gitlab/index.spec.ts +++ b/lib/platform/gitlab/index.spec.ts @@ -21,7 +21,7 @@ const gitlabApiHost = 'https://gitlab.com'; describe('platform/gitlab', () => { let gitlab: Platform; let hostRules: jest.Mocked; - let GitStorage: jest.Mocked & jest.Mock; + let GitStorage: jest.Mocked & jest.Mock; beforeEach(async () => { // reset module jest.resetModules(); @@ -30,8 +30,8 @@ describe('platform/gitlab', () => { jest.mock('../../util/host-rules'); jest.mock('delay'); hostRules = require('../../util/host-rules'); - jest.mock('../git/storage'); - GitStorage = require('../git/storage').Storage; + jest.mock('../git'); + GitStorage = require('../git').Storage; GitStorage.mockImplementation(() => ({ initRepo: jest.fn(), cleanRepo: jest.fn(), diff --git a/lib/platform/gitlab/index.ts b/lib/platform/gitlab/index.ts index f3b61624f57f93..4d94406115bbae 100644 --- a/lib/platform/gitlab/index.ts +++ b/lib/platform/gitlab/index.ts @@ -38,7 +38,7 @@ import { RepoParams, VulnerabilityAlert, } from '../common'; -import GitStorage, { StatusResult } from '../git/storage'; +import GitStorage, { StatusResult } from '../git'; import { smartTruncate } from '../utils/pr-body'; const gitlabApi = new GitlabHttp(); diff --git a/lib/workers/branch/index.spec.ts b/lib/workers/branch/index.spec.ts index 55c9ad5ed7656f..83aadfb209a64d 100644 --- a/lib/workers/branch/index.spec.ts +++ b/lib/workers/branch/index.spec.ts @@ -11,7 +11,7 @@ import { } from '../../constants/pull-requests'; import * as _npmPostExtract from '../../manager/npm/post-update'; import { File } from '../../platform'; -import { StatusResult } from '../../platform/git/storage'; +import { StatusResult } from '../../platform/git'; import * as _exec from '../../util/exec'; import { BranchConfig, PrResult } from '../common'; import * as _prWorker from '../pr';